📄 create-program/shared¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 7 |
| 📦 Imports | 4 |
| 📊 Variables & Constants | 5 |
| 📐 Interfaces | 2 |
| 📑 Type Aliases | 2 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/typescript-estree/src/create-program/shared.ts
📦 Imports¶
| Name | Source |
|---|---|
Program |
typescript |
CORE_COMPILER_OPTIONS |
@typescript-eslint/tsconfig-utils |
path |
node:path |
ParseSettings |
../parseSettings |
Variables & Constants¶
| Name | Type | Kind | Value | Exported |
|---|---|---|---|---|
DEFAULT_COMPILER_OPTIONS |
ts.CompilerOptions |
const | { ...CORE_COMPILER_OPTIONS, allowJs: true, allowNonTsExtensions: true, checkJ... |
✗ |
DEFAULT_EXTRA_FILE_EXTENSIONS |
Set<string> |
const | new Set<string>([ ts.Extension.Cjs, ts.Extension.Cts, ts.Extension.Js, ts.Ext... |
✓ |
useCaseSensitiveFileNames |
any |
const | ts.sys !== undefined ? ts.sys.useCaseSensitiveFileNames : true |
✗ |
correctPathCasing |
(filePath: string) => string |
const | useCaseSensitiveFileNames ? (filePath: string): string => filePath : (filePat... |
✗ |
DEFINITION_EXTENSIONS |
readonly [any, any, any] |
const | [ ts.Extension.Dts, ts.Extension.Dcts, ts.Extension.Dmts, ] as const |
✗ |
Functions¶
createDefaultCompilerOptionsFromExtra(parseSettings: ParseSettings): ts.CompilerOptions¶
Parameters:
parseSettingsParseSettings
Returns: ts.CompilerOptions
Calls:
parseSettings.debugLevel.has
Code
getCanonicalFileName(filePath: string): CanonicalPath¶
Parameters:
filePathstring
Returns: CanonicalPath
Calls:
path.normalizenormalized.endsWithnormalized.slicecorrectPathCasing
Code
ensureAbsolutePath(p: string, tsconfigRootDir: string): string¶
Parameters:
pstringtsconfigRootDirstring
Returns: string
Calls:
path.resolve
Code
canonicalDirname(p: CanonicalPath): CanonicalPath¶
Parameters:
pCanonicalPath
Returns: CanonicalPath
Calls:
path.dirname
Code
getAstFromProgram(currentProgram: Program, filePath: string): ASTAndDefiniteProgram | undefined¶
Parameters:
currentProgramProgramfilePathstring
Returns: ASTAndDefiniteProgram | undefined
Calls:
currentProgram.getSourceFilegetExtension
Internal Comments:
Code
export function getAstFromProgram(
currentProgram: Program,
filePath: string,
): ASTAndDefiniteProgram | undefined {
const ast = currentProgram.getSourceFile(filePath);
// working around https://github.com/typescript-eslint/typescript-eslint/issues/1573
const expectedExt = getExtension(filePath);
const returnedExt = getExtension(ast?.fileName);
if (expectedExt !== returnedExt) {
return undefined;
}
return ast && { ast, program: currentProgram };
}
createHash(content: string): string¶
Hash content for compare content.
Parameters:
contentany: hashed contend
Returns: undefined
hashed result
Raw JSDoc
Calls:
ts.sys.createHash
Internal Comments:
// No ts.sys in browser environments.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
Code
getExtension(fileName: string | undefined): string | null¶
Parameters:
fileNamestring | undefined
Returns: string | null
Calls:
DEFINITION_EXTENSIONS.findfileName.endsWithpath.extname
Code
Interfaces¶
ASTAndNoProgram¶
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
ast |
ts.SourceFile |
✗ | not shown |
program |
null |
✗ | not shown |
ASTAndDefiniteProgram¶
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
ast |
ts.SourceFile |
✗ | not shown |
program |
ts.Program |
✗ | not shown |
Type Aliases¶
ASTAndProgram¶
CanonicalPath¶
Generated by Syntax Scribe