⬅️ Back to Table of Contents
📄 semanticInfo.test.ts
📊 Analysis Summary
Metric |
Count |
🔧 Functions |
1 |
📦 Imports |
8 |
📊 Variables & Constants |
36 |
📚 Table of Contents
🛠️ File Location:
📂 packages/typescript-estree/tests/lib/semanticInfo.test.ts
📦 Imports
Name |
Source |
TSESTree |
../../src/index.js |
TSESTreeOptions |
../../src/index.js |
createProgram |
../../src/create-program/useProvidedPrograms.js |
clearCaches |
../../src/index.js |
parseAndGenerateServices |
../../src/index.js |
deeplyCopy |
../test-utils/test-utils.js |
formatSnapshotName |
../test-utils/test-utils.js |
parseCodeAndGenerateServices |
../test-utils/test-utils.js |
Variables & Constants
Name |
Type |
Kind |
Value |
Exported |
code |
string |
let/var |
`await fs.readFile(path.join(FIXTURES_DIR, filename), { |
|
encoding: 'utf-8', |
|
|
|
|
})` |
✗ |
|
|
|
testCases |
any |
let/var |
`await Promise.all( |
|
testFiles.map(async filename => { |
|
|
|
|
const code = await fs.readFile(path.join(FIXTURES_DIR, filename), { |
|
|
|
|
encoding: 'utf-8', |
|
|
|
|
}); |
|
|
|
|
const snapshotName = formatSnapshotName( |
|
|
|
|
filename, |
|
|
|
|
FIXTURES_DIR, |
|
|
|
|
path.extname(filename), |
|
|
|
|
); |
|
|
|
|
const { ast } = parseAndGenerateServices(code, createOptions(filename));
const result = deeplyCopy(ast);
return [snapshotName, result] as const;
}),
)| ✗ |
|
filename|
any| let/var |
testFiles[0]| ✗ |
|
code|
string| let/var |
await fs.readFile(path.join(FIXTURES_DIR, filename), {
encoding: 'utf-8',
})| ✗ |
|
optionsProjectString|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; ... 17 more ...; suppressDeprecatedPropertyWarnings?: boolean; | let/var |
{
...options,
project: './tsconfig.json',
}| ✗ |
|
filename|
any| let/var |
testFiles[0]| ✗ |
|
code|
string| let/var |
await fs.readFile(path.join(FIXTURES_DIR, filename), {
encoding: 'utf-8',
})| ✗ |
|
optionsProjectString|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; ... 17 more ...; suppressDeprecatedPropertyWarnings?: boolean; | let/var |
{
...options,
project: './tsconfig.json',
}| ✗ |
|
optionsProjectArray|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; ... 17 more ...; suppressDeprecatedPropertyWarnings?: boolean; | let/var |
{
...options,
project: ['./tsconfig.json'],
}| ✗ |
|
filename|
any| let/var |
testFiles[0]| ✗ |
|
code|
string| let/var |
await fs.readFile(path.join(FIXTURES_DIR, filename), {
encoding: 'utf-8',
})| ✗ |
|
optionsAbsolutePath|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; ... 17 more ...; suppressDeprecatedPropertyWarnings?: boolean; | let/var |
{
...options,
project: ${__dirname}/../fixtures/semanticInfo/tsconfig.json
,
}| ✗ |
|
optionsRelativePath|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; ... 17 more ...; suppressDeprecatedPropertyWarnings?: boolean; | let/var |
{
...options,
project: ./tsconfig.json
,
}| ✗ |
|
declaration|
any| let/var |
(
parseResult.ast.body[0] as TSESTree.VariableDeclaration
).declarations[0]| ✗ |
|
arrayMember|
any| let/var |
(declaration.init as TSESTree.ArrayExpression)
.elements[0]| ✗ |
|
boundName|
TSESTree.Identifier| let/var |
declaration.id as TSESTree.Identifier| ✗ |
|
declaration|
any| let/var |
(
parseResult.ast.body[0] as TSESTree.VariableDeclaration
).declarations[0]| ✗ |
|
arrayMember|
any| let/var |
(declaration.init as TSESTree.ArrayExpression)
.elements[0]| ✗ |
|
boundName|
TSESTree.Identifier| let/var |
declaration.id as TSESTree.Identifier| ✗ |
|
binaryExpression|
any| let/var |
(
parseResult.ast.body[0] as TSESTree.VariableDeclaration
).declarations[0].init| ✗ |
|
computedPropertyString|
any| let/var |
(
(parseResult.ast.body[1] as TSESTree.ClassDeclaration).body
.body[0] as TSESTree.PropertyDefinition
).key| ✗ |
|
arrayBoundName|
TSESTree.Identifier| let/var |
(
(
(parseResult.ast.body[1] as TSESTree.ExpressionStatement)
.expression as TSESTree.CallExpression
).callee as TSESTree.MemberExpression
).object as TSESTree.Identifier| ✗ |
|
boundName|
TSESTree.Identifier| const |
(parseResult.ast.body[0] as TSESTree.VariableDeclaration)
.declarations[0].id as TSESTree.Identifier| ✗ |
|
code|
string| let/var |
await fs.readFile(fileName, { encoding: 'utf-8' })| ✗ |
|
code|
string| let/var |
await fs.readFile(fileName, { encoding: 'utf-8' })| ✗ |
|
code|
string| let/var |
await fs.readFile(fileName, { encoding: 'utf-8' })| ✗ |
|
filename|
any| let/var |
testFiles[0]| ✗ |
|
code|
string| let/var |
await fs.readFile(path.join(FIXTURES_DIR, filename), {
encoding: 'utf-8',
})| ✗ |
|
optionsProjectString|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; ... 16 more ...; suppressDeprecatedPropertyWarnings?: boolean; | let/var |
{
...options,
programs: [program1, program2],
project: './tsconfig.json',
}| ✗ |
|
filename|
"non-existent-file.ts"| const |
'non-existent-file.ts'| ✗ |
|
optionsWithProjectTrue|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; ... 16 more ...; suppressDeprecatedPropertyWarnings?: boolean; | const |
{
...options,
programs: undefined,
project: true,
}| ✗ |
|
filename|
"non-existent-file.ts"| const |
'non-existent-file.ts'| ✗ |
|
optionsWithSingleProgram|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; filePath?: string; ... 16 more ...; suppressDeprecatedPropertyWarnings?: boolean; | const |
{
...options,
programs: [program],
}| ✗ |
|
filename|
"non-existent-file.ts"| const |
'non-existent-file.ts'| ✗ |
|
optionsWithSingleProgram|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; filePath?: string; ... 16 more ...; suppressDeprecatedPropertyWarnings?: boolean; | const |
{
...options,
programs: [program1],
}| ✗ |
|
optionsWithMultiplePrograms|
}; disallowAutomaticSingleRunInference?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; extraFileExtensions?: string[]; ... 17 more ...; suppressDeprecatedPropertyWarnings?: boolean; | const |
{
...options,
programs: [program1, program2],
}` | ✗ |
Functions
createOptions(fileName: string): { cwd?: string } & TSESTreeOptions
Code
function createOptions(fileName: string): { cwd?: string } & TSESTreeOptions {
return {
comment: true,
disallowAutomaticSingleRunInference: true,
errorOnUnknownASTType: true,
filePath: fileName,
jsx: false,
loc: true,
loggerFn: false,
project: `./tsconfig.json`,
range: true,
tokens: true,
tsconfigRootDir: FIXTURES_DIR,
};
}
- Parameters:
fileName: string
- Return Type:
{ cwd?: string } & TSESTreeOptions