From 5ab70f1da34d6cc13651d37afcbba09eb4e7cacc Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 23 Nov 2022 16:21:44 +1030 Subject: [PATCH 1/7] feat: remove partial type-information program --- .husky/pre-commit | 2 +- .../src/rules/consistent-type-exports.ts | 47 +- .../src/rules/naming-convention.ts | 6 +- packages/parser/src/index.ts | 2 + packages/parser/src/parser.ts | 2 +- .../type-utils/tests/isTypeReadonly.test.ts | 2 + .../tests/isUnsafeAssignment.test.ts | 2 + .../test-utils/expectToHaveParserServices.ts | 12 + packages/typescript-estree/jest.config.js | 2 +- .../create-program/createDefaultProgram.ts | 4 +- .../create-program/createIsolatedProgram.ts | 6 +- .../create-program/createProjectProgram.ts | 4 +- .../src/create-program/createSourceFile.ts | 10 +- .../src/create-program/shared.ts | 11 +- .../src/create-program/useProvidedPrograms.ts | 6 +- packages/typescript-estree/src/index.ts | 7 +- .../typescript-estree/src/parser-options.ts | 15 +- packages/typescript-estree/src/parser.ts | 106 +- .../src/semantic-or-syntactic-errors.ts | 10 +- .../tests/ast-alignment/parse.ts | 10 + .../tests/fixtures/simpleProject/file-jsx.tsx | 0 .../fixtures/simpleProject/tsconfig.json | 6 +- .../lib/__snapshots__/parse.test.ts.snap | 54 +- .../semantic-diagnostics-enabled.test.ts.snap | 2801 ----------------- .../typescript-estree/tests/lib/parse.test.ts | 130 +- .../lib/semantic-diagnostics-enabled.test.ts | 45 - .../tests/lib/semanticInfo.test.ts | 38 +- .../test-utils/expectToHaveParserServices.ts | 12 + .../src/eslint-utils/getParserServices.ts | 30 +- packages/utils/src/ts-estree.ts | 9 +- .../src/components/linter/WebLinter.ts | 1 - 31 files changed, 307 insertions(+), 3085 deletions(-) create mode 100644 packages/type-utils/tests/test-utils/expectToHaveParserServices.ts create mode 100644 packages/typescript-estree/tests/fixtures/simpleProject/file-jsx.tsx delete mode 100644 packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap delete mode 100644 packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.test.ts create mode 100644 packages/typescript-estree/tests/lib/test-utils/expectToHaveParserServices.ts diff --git a/.husky/pre-commit b/.husky/pre-commit index 025779ed2ba..a3c91c55c26 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh . "$(dirname "$0")/_/husky.sh" yarn pre-commit diff --git a/packages/eslint-plugin/src/rules/consistent-type-exports.ts b/packages/eslint-plugin/src/rules/consistent-type-exports.ts index 54364054690..3836525d9fa 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-exports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -75,6 +75,28 @@ export default util.createRule({ const sourceExportsMap: { [key: string]: SourceExports } = {}; const parserServices = util.getParserServices(context); + /** + * Helper for identifying if an export specifier resolves to a + * JavaScript value or a TypeScript type. + * + * @returns True/false if is a type or not, or undefined if the specifier + * can't be resolved. + */ + function isSpecifierTypeBased( + specifier: TSESTree.ExportSpecifier, + ): boolean | undefined { + const checker = parserServices.program.getTypeChecker(); + const node = parserServices.esTreeNodeToTSNodeMap.get(specifier.exported); + const symbol = checker.getSymbolAtLocation(node); + const aliasedSymbol = checker.getAliasedSymbol(symbol!); + + if (!aliasedSymbol || aliasedSymbol.escapedName === 'unknown') { + return undefined; + } + + return !(aliasedSymbol.flags & SymbolFlags.Value); + } + return { ExportNamedDeclaration(node: TSESTree.ExportNamedDeclaration): void { // Coerce the source into a string for use as a lookup entry. @@ -112,7 +134,7 @@ export default util.createRule({ continue; } - const isTypeBased = isSpecifierTypeBased(parserServices, specifier); + const isTypeBased = isSpecifierTypeBased(specifier); if (isTypeBased === true) { typeBasedSpecifiers.push(specifier); @@ -199,29 +221,6 @@ export default util.createRule({ }, }); -/** - * Helper for identifying if an export specifier resolves to a - * JavaScript value or a TypeScript type. - * - * @returns True/false if is a type or not, or undefined if the specifier - * can't be resolved. - */ -function isSpecifierTypeBased( - parserServices: ParserServices, - specifier: TSESTree.ExportSpecifier, -): boolean | undefined { - const checker = parserServices.program.getTypeChecker(); - const node = parserServices.esTreeNodeToTSNodeMap.get(specifier.exported); - const symbol = checker.getSymbolAtLocation(node); - const aliasedSymbol = checker.getAliasedSymbol(symbol!); - - if (!aliasedSymbol || aliasedSymbol.escapedName === 'unknown') { - return undefined; - } - - return !(aliasedSymbol.flags & SymbolFlags.Value); -} - /** * Inserts "type" into an export. * diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 05f3dd0f2a6..5a1ff941686 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -90,10 +90,8 @@ export default util.createRule({ const validators = parseOptions(context); - // getParserServices(context, false) -- dirty hack to work around the docs checker test... - const compilerOptions = util - .getParserServices(context, true) - .program.getCompilerOptions(); + const compilerOptions = + util.getParserServices(context, true).program?.getCompilerOptions() ?? {}; function handleMember( validator: ValidatorFunction | null, node: diff --git a/packages/parser/src/index.ts b/packages/parser/src/index.ts index 928671a3c5c..12783370be9 100644 --- a/packages/parser/src/index.ts +++ b/packages/parser/src/index.ts @@ -1,6 +1,8 @@ export { parse, parseForESLint, ParserOptions } from './parser'; export { ParserServices, + ParserServicesWithTypeInformation, + ParserServicesWithoutTypeInformation, clearCaches, createProgram, } from '@typescript-eslint/typescript-estree'; diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index f619f5e17c1..276d6ff1246 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -128,7 +128,7 @@ function parseForESLint( ast.sourceType = options.sourceType; let emitDecoratorMetadata = options.emitDecoratorMetadata === true; - if (services.hasFullTypeInformation) { + if (services.program) { // automatically apply the options configured for the program const compilerOptions = services.program.getCompilerOptions(); if (analyzeOptions.lib == null) { diff --git a/packages/type-utils/tests/isTypeReadonly.test.ts b/packages/type-utils/tests/isTypeReadonly.test.ts index 382091a2375..f200af13204 100644 --- a/packages/type-utils/tests/isTypeReadonly.test.ts +++ b/packages/type-utils/tests/isTypeReadonly.test.ts @@ -7,6 +7,7 @@ import { type ReadonlynessOptions, isTypeReadonly, } from '../src/isTypeReadonly'; +import { expectToHaveParserServices } from './test-utils/expectToHaveParserServices'; describe('isTypeReadonly', () => { const rootDir = path.join(__dirname, 'fixtures'); @@ -21,6 +22,7 @@ describe('isTypeReadonly', () => { filePath: path.join(rootDir, 'file.ts'), tsconfigRootDir: rootDir, }); + expectToHaveParserServices(services); const checker = services.program.getTypeChecker(); const esTreeNodeToTSNodeMap = services.esTreeNodeToTSNodeMap; diff --git a/packages/type-utils/tests/isUnsafeAssignment.test.ts b/packages/type-utils/tests/isUnsafeAssignment.test.ts index e49e25c8655..e7ba11fda28 100644 --- a/packages/type-utils/tests/isUnsafeAssignment.test.ts +++ b/packages/type-utils/tests/isUnsafeAssignment.test.ts @@ -4,6 +4,7 @@ import path from 'path'; import type * as ts from 'typescript'; import { isUnsafeAssignment } from '../src/isUnsafeAssignment'; +import { expectToHaveParserServices } from './test-utils/expectToHaveParserServices'; describe('isUnsafeAssignment', () => { const rootDir = path.join(__dirname, 'fixtures'); @@ -19,6 +20,7 @@ describe('isUnsafeAssignment', () => { filePath: path.join(rootDir, 'file.ts'), tsconfigRootDir: rootDir, }); + expectToHaveParserServices(services); const checker = services.program.getTypeChecker(); const esTreeNodeToTSNodeMap = services.esTreeNodeToTSNodeMap; diff --git a/packages/type-utils/tests/test-utils/expectToHaveParserServices.ts b/packages/type-utils/tests/test-utils/expectToHaveParserServices.ts new file mode 100644 index 00000000000..6ff95a7076b --- /dev/null +++ b/packages/type-utils/tests/test-utils/expectToHaveParserServices.ts @@ -0,0 +1,12 @@ +import type { + ParserServices, + ParserServicesWithTypeInformation, +} from '@typescript-eslint/typescript-estree'; + +export function expectToHaveParserServices( + services: ParserServices | null | undefined, +): asserts services is ParserServicesWithTypeInformation { + expect(services?.program).toBeDefined(); + expect(services?.esTreeNodeToTSNodeMap).toBeDefined(); + expect(services?.tsNodeToESTreeNodeMap).toBeDefined(); +} diff --git a/packages/typescript-estree/jest.config.js b/packages/typescript-estree/jest.config.js index 43f847a6fbf..754a2599294 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -5,7 +5,7 @@ module.exports = { ...require('../../jest.config.base.js'), testRegex: [ - './tests/lib/.*\\.ts$', + './tests/lib/.*\\.test\\.ts$', './tests/ast-alignment/spec\\.ts$', './tests/[^/]+\\.test\\.ts$', ], diff --git a/packages/typescript-estree/src/create-program/createDefaultProgram.ts b/packages/typescript-estree/src/create-program/createDefaultProgram.ts index 174783f43db..9ea0fabfd0d 100644 --- a/packages/typescript-estree/src/create-program/createDefaultProgram.ts +++ b/packages/typescript-estree/src/create-program/createDefaultProgram.ts @@ -3,7 +3,7 @@ import path from 'path'; import * as ts from 'typescript'; import type { ParseSettings } from '../parseSettings'; -import type { ASTAndProgram } from './shared'; +import type { ASTAndDefiniteProgram } from './shared'; import { createDefaultCompilerOptionsFromExtra, getModuleResolver, @@ -20,7 +20,7 @@ const log = debug('typescript-eslint:typescript-estree:createDefaultProgram'); */ function createDefaultProgram( parseSettings: ParseSettings, -): ASTAndProgram | undefined { +): ASTAndDefiniteProgram | undefined { log( 'Getting default program for: %s', parseSettings.filePath || 'unnamed file', diff --git a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts index 58d7ec8a61a..0b6520f22aa 100644 --- a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts +++ b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts @@ -3,7 +3,7 @@ import * as ts from 'typescript'; import type { ParseSettings } from '../parseSettings'; import { getScriptKind } from './getScriptKind'; -import type { ASTAndProgram } from './shared'; +import type { ASTAndDefiniteProgram } from './shared'; import { createDefaultCompilerOptionsFromExtra } from './shared'; const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); @@ -12,7 +12,9 @@ const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); * @param code The code of the file being linted * @returns Returns a new source file and program corresponding to the linted code */ -function createIsolatedProgram(parseSettings: ParseSettings): ASTAndProgram { +function createIsolatedProgram( + parseSettings: ParseSettings, +): ASTAndDefiniteProgram { log( 'Getting isolated program in %s mode for: %s', parseSettings.jsx ? 'TSX' : 'TS', diff --git a/packages/typescript-estree/src/create-program/createProjectProgram.ts b/packages/typescript-estree/src/create-program/createProjectProgram.ts index 315e3b05c2f..658bb189a21 100644 --- a/packages/typescript-estree/src/create-program/createProjectProgram.ts +++ b/packages/typescript-estree/src/create-program/createProjectProgram.ts @@ -5,7 +5,7 @@ import * as ts from 'typescript'; import { firstDefined } from '../node-utils'; import type { ParseSettings } from '../parseSettings'; import { getProgramsForProjects } from './createWatchProgram'; -import type { ASTAndProgram } from './shared'; +import type { ASTAndDefiniteProgram } from './shared'; import { getAstFromProgram } from './shared'; const log = debug('typescript-eslint:typescript-estree:createProjectProgram'); @@ -27,7 +27,7 @@ const DEFAULT_EXTRA_FILE_EXTENSIONS = [ */ function createProjectProgram( parseSettings: ParseSettings, -): ASTAndProgram | undefined { +): ASTAndDefiniteProgram | undefined { log('Creating project program for: %s', parseSettings.filePath); const programsForProjects = getProgramsForProjects(parseSettings); diff --git a/packages/typescript-estree/src/create-program/createSourceFile.ts b/packages/typescript-estree/src/create-program/createSourceFile.ts index 0214802f73f..a89a364ac54 100644 --- a/packages/typescript-estree/src/create-program/createSourceFile.ts +++ b/packages/typescript-estree/src/create-program/createSourceFile.ts @@ -4,6 +4,7 @@ import * as ts from 'typescript'; import type { ParseSettings } from '../parseSettings'; import { isSourceFile } from '../source-files'; import { getScriptKind } from './getScriptKind'; +import type { ASTAndNoProgram } from './shared'; const log = debug('typescript-eslint:typescript-estree:createSourceFile'); @@ -25,4 +26,11 @@ function createSourceFile(parseSettings: ParseSettings): ts.SourceFile { ); } -export { createSourceFile }; +function createNoProgram(parseSettings: ParseSettings): ASTAndNoProgram { + return { + ast: createSourceFile(parseSettings), + program: null, + }; +} + +export { createSourceFile, createNoProgram }; diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index dd50f757dce..98c3fc01510 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -5,10 +5,15 @@ import * as ts from 'typescript'; import type { ModuleResolver } from '../parser-options'; import type { ParseSettings } from '../parseSettings'; -interface ASTAndProgram { +interface ASTAndNoProgram { + ast: ts.SourceFile; + program: null; +} +interface ASTAndDefiniteProgram { ast: ts.SourceFile; program: ts.Program; } +type ASTAndProgram = ASTAndNoProgram | ASTAndDefiniteProgram; /** * Compiler options required to avoid critical functionality issues @@ -94,7 +99,7 @@ function getExtension(fileName: string | undefined): string | null { function getAstFromProgram( currentProgram: Program, parseSettings: ParseSettings, -): ASTAndProgram | undefined { +): ASTAndDefiniteProgram | undefined { const ast = currentProgram.getSourceFile(parseSettings.filePath); // working around https://github.com/typescript-eslint/typescript-eslint/issues/1573 @@ -125,6 +130,8 @@ function getModuleResolver(moduleResolverPath: string): ModuleResolver { } export { + ASTAndDefiniteProgram, + ASTAndNoProgram, ASTAndProgram, CORE_COMPILER_OPTIONS, canonicalDirname, diff --git a/packages/typescript-estree/src/create-program/useProvidedPrograms.ts b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts index fc99416faa5..96093e9a3af 100644 --- a/packages/typescript-estree/src/create-program/useProvidedPrograms.ts +++ b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts @@ -4,7 +4,7 @@ import * as path from 'path'; import * as ts from 'typescript'; import type { ParseSettings } from '../parseSettings'; -import type { ASTAndProgram } from './shared'; +import type { ASTAndDefiniteProgram } from './shared'; import { CORE_COMPILER_OPTIONS, getAstFromProgram } from './shared'; const log = debug('typescript-eslint:typescript-estree:useProvidedProgram'); @@ -12,13 +12,13 @@ const log = debug('typescript-eslint:typescript-estree:useProvidedProgram'); function useProvidedPrograms( programInstances: Iterable, parseSettings: ParseSettings, -): ASTAndProgram | undefined { +): ASTAndDefiniteProgram | undefined { log( 'Retrieving ast for %s from provided program instance(s)', parseSettings.filePath, ); - let astAndProgram: ASTAndProgram | undefined; + let astAndProgram: ASTAndDefiniteProgram | undefined; for (const programInstance of programInstances) { astAndProgram = getAstFromProgram(programInstance, parseSettings); // Stop at the first applicable program instance diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts index 48c9fb1ab88..456e0f31931 100644 --- a/packages/typescript-estree/src/index.ts +++ b/packages/typescript-estree/src/index.ts @@ -7,7 +7,12 @@ export { ParseWithNodeMapsResult, clearProgramCache, } from './parser'; -export { ParserServices, TSESTreeOptions } from './parser-options'; +export { + ParserServices, + ParserServicesWithTypeInformation, + ParserServicesWithoutTypeInformation, + TSESTreeOptions, +} from './parser-options'; export { simpleTraverse } from './simple-traverse'; export * from './ts-estree'; export { clearWatchCaches as clearCaches } from './create-program/createWatchProgram'; diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index 8a4054f9237..0365b8a4f83 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -182,12 +182,21 @@ export interface ParserWeakMapESTreeToTSNode< has(key: unknown): boolean; } -export interface ParserServices { - program: ts.Program; +export interface ParserServicesNodeMaps { esTreeNodeToTSNodeMap: ParserWeakMapESTreeToTSNode; tsNodeToESTreeNodeMap: ParserWeakMap; - hasFullTypeInformation: boolean; } +export interface ParserServicesWithTypeInformation + extends ParserServicesNodeMaps { + program: ts.Program; +} +export interface ParserServicesWithoutTypeInformation + extends ParserServicesNodeMaps { + program: null; +} +export type ParserServices = + | ParserServicesWithTypeInformation + | ParserServicesWithoutTypeInformation; export interface ModuleResolver { version: 1; diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 6e8c01a974c..43cbb649319 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -6,13 +6,20 @@ import { convertError } from './convert'; import { createDefaultProgram } from './create-program/createDefaultProgram'; import { createIsolatedProgram } from './create-program/createIsolatedProgram'; import { createProjectProgram } from './create-program/createProjectProgram'; -import { createSourceFile } from './create-program/createSourceFile'; +import { + createNoProgram, + createSourceFile, +} from './create-program/createSourceFile'; import type { ASTAndProgram, CanonicalPath } from './create-program/shared'; import { createProgramFromConfigFile, useProvidedPrograms, } from './create-program/useProvidedPrograms'; -import type { ParserServices, TSESTreeOptions } from './parser-options'; +import type { + ParserServices, + ParserServicesNodeMaps, + TSESTreeOptions, +} from './parser-options'; import type { ParseSettings } from './parseSettings'; import { createParseSettings } from './parseSettings/createParseSettings'; import { getFirstSemanticOrSyntacticError } from './semantic-or-syntactic-errors'; @@ -39,17 +46,37 @@ function getProgramAndAST( parseSettings: ParseSettings, shouldProvideParserServices: boolean, ): ASTAndProgram { - return ( - (parseSettings.programs && - useProvidedPrograms(parseSettings.programs, parseSettings)) || - (shouldProvideParserServices && createProjectProgram(parseSettings)) || - (shouldProvideParserServices && - // eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major - parseSettings.DEPRECATED__createDefaultProgram && + if (parseSettings.programs) { + const fromProvidedPrograms = useProvidedPrograms( + parseSettings.programs, + parseSettings, + ); + if (fromProvidedPrograms) { + return fromProvidedPrograms; + } + } + + if (shouldProvideParserServices) { + const fromProjectProgram = createProjectProgram(parseSettings); + if (fromProjectProgram) { + return fromProjectProgram; + } + + // eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major + if (parseSettings.DEPRECATED__createDefaultProgram) { // eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major - createDefaultProgram(parseSettings)) || - createIsolatedProgram(parseSettings) - ); + const fromDefaultProgram = createDefaultProgram(parseSettings); + if (fromDefaultProgram) { + return fromDefaultProgram; + } + } + + return createIsolatedProgram(parseSettings); + } + + // no need to waste time creating a program as the caller didn't want parser services + // so we can save time and just create a lonesome source file + return createNoProgram(parseSettings); } // eslint-disable-next-line @typescript-eslint/no-empty-interface @@ -62,10 +89,9 @@ interface ParseAndGenerateServicesResult { ast: AST; services: ParserServices; } -interface ParseWithNodeMapsResult { +interface ParseWithNodeMapsResult + extends ParserServicesNodeMaps { ast: AST; - esTreeNodeToTSNodeMap: ParserServices['esTreeNodeToTSNodeMap']; - tsNodeToESTreeNodeMap: ParserServices['tsNodeToESTreeNodeMap']; } function parse( @@ -138,16 +164,6 @@ function parseAndGenerateServices( */ const parseSettings = createParseSettings(code, options); - if (typeof options !== 'undefined') { - if ( - typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === - 'boolean' && - options.errorOnTypeScriptSyntacticAndSemanticIssues - ) { - parseSettings.errorOnTypeScriptSyntacticAndSemanticIssues = true; - } - } - /** * If this is a single run in which the user has not provided any existing programs but there * are programs which need to be created from the provided "project" option, @@ -184,6 +200,25 @@ function parseAndGenerateServices( const shouldProvideParserServices = parseSettings.programs != null || parseSettings.projects?.length > 0; + if (typeof options !== 'undefined') { + if ( + typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === + 'boolean' && + options.errorOnTypeScriptSyntacticAndSemanticIssues + ) { + parseSettings.errorOnTypeScriptSyntacticAndSemanticIssues = true; + } + + if ( + parseSettings.errorOnTypeScriptSyntacticAndSemanticIssues && + !shouldProvideParserServices + ) { + throw new Error( + 'Cannot calculate TypeScript semantic issues without a valid project.', + ); + } + } + /** * If we are in singleRun mode but the parseAndGenerateServices() function has been called more than once for the current file, * it must mean that we are in the middle of an ESLint automated fix cycle (in which parsing can be performed up to an additional @@ -235,12 +270,21 @@ function parseAndGenerateServices( */ return { ast: estree as AST, - services: { - hasFullTypeInformation: shouldProvideParserServices, - program, - esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, - tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, - }, + services: + shouldProvideParserServices && program != null + ? { + program, + esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, + tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, + } + : { + program: null, + // we still return the node maps because + // (a) they don't require type info and + // (b) they can be useful when using some of TS's internal non-type-aware AST utils + esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, + tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, + }, }; } diff --git a/packages/typescript-estree/src/semantic-or-syntactic-errors.ts b/packages/typescript-estree/src/semantic-or-syntactic-errors.ts index af6f33918df..d5d5ce42ad9 100644 --- a/packages/typescript-estree/src/semantic-or-syntactic-errors.ts +++ b/packages/typescript-estree/src/semantic-or-syntactic-errors.ts @@ -22,18 +22,18 @@ export function getFirstSemanticOrSyntacticError( ast: SourceFile, ): SemanticOrSyntacticError | undefined { try { - const supportedSyntacticDiagnostics = whitelistSupportedDiagnostics( + const supportedSyntacticDiagnostics = allowlistSupportedDiagnostics( program.getSyntacticDiagnostics(ast), ); - if (supportedSyntacticDiagnostics.length) { + if (supportedSyntacticDiagnostics.length > 0) { return convertDiagnosticToSemanticOrSyntacticError( supportedSyntacticDiagnostics[0], ); } - const supportedSemanticDiagnostics = whitelistSupportedDiagnostics( + const supportedSemanticDiagnostics = allowlistSupportedDiagnostics( program.getSemanticDiagnostics(ast), ); - if (supportedSemanticDiagnostics.length) { + if (supportedSemanticDiagnostics.length > 0) { return convertDiagnosticToSemanticOrSyntacticError( supportedSemanticDiagnostics[0], ); @@ -57,7 +57,7 @@ export function getFirstSemanticOrSyntacticError( } } -function whitelistSupportedDiagnostics( +function allowlistSupportedDiagnostics( diagnostics: readonly (DiagnosticWithLocation | Diagnostic)[], ): readonly (DiagnosticWithLocation | Diagnostic)[] { return diagnostics.filter(diagnostic => { diff --git a/packages/typescript-estree/tests/ast-alignment/parse.ts b/packages/typescript-estree/tests/ast-alignment/parse.ts index b4d5ea1c8f9..5837090f47a 100644 --- a/packages/typescript-estree/tests/ast-alignment/parse.ts +++ b/packages/typescript-estree/tests/ast-alignment/parse.ts @@ -4,6 +4,7 @@ import type babelParser from '@babel/parser'; import type { ParserPlugin } from '@babel/parser'; import type { File } from '@babel/types'; import type { TSESTree } from '@typescript-eslint/types'; +import * as path from 'path'; import type { TSError } from '../../src/node-utils'; import type { AST } from '../../src/parser'; @@ -50,6 +51,12 @@ function parseWithBabelParser(text: string, jsx = true): File { }); } +const emptyProjectPath = path.resolve( + __dirname, + '..', + 'fixtures', + 'simpleProject', +); function parseWithTypeScriptESTree(text: string, jsx = true): AST { try { const result = parseAndGenerateServices(text, { @@ -65,6 +72,9 @@ function parseWithTypeScriptESTree(text: string, jsx = true): AST { * forgiving. */ errorOnTypeScriptSyntacticAndSemanticIssues: true, + project: [path.join(emptyProjectPath, 'tsconfig.json')], + tsconfigRootDir: emptyProjectPath, + filePath: path.join(emptyProjectPath, jsx ? 'file-jsx.tsx' : 'file.ts'), jsx, }); return result.ast; diff --git a/packages/typescript-estree/tests/fixtures/simpleProject/file-jsx.tsx b/packages/typescript-estree/tests/fixtures/simpleProject/file-jsx.tsx new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json b/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json index 0967ef424bc..90c5f25ad29 100644 --- a/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json +++ b/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "ES2022" + } +} diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap index 81341b5e35f..7537911ab64 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap @@ -365,8 +365,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -655,8 +654,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -835,8 +833,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -1015,8 +1012,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -1234,8 +1230,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .json file - wit }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -1524,8 +1519,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -1814,8 +1808,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -1994,8 +1987,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -2174,8 +2166,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -2354,8 +2345,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -2534,8 +2524,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -2824,8 +2813,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3114,8 +3102,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3294,8 +3281,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3474,8 +3460,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3764,8 +3749,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3944,8 +3928,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -4124,8 +4107,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap deleted file mode 100644 index 204da250a86..00000000000 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ /dev/null @@ -1,2801 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/block-trailing-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/comment-within-condition.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/export-default-anonymous-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsdoc-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-attr-and-text-with-url.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-block-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-jsx.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-self-closing-jsx.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-generic-with-comment-in-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comment-after-prop.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-multiline-non-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-url.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-greather-than.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-with-operators.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/line-comment-with-block-syntax.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/mix-line-and-block-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/no-comment-regex.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/no-comment-template.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/surrounding-call-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/surrounding-debugger-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/surrounding-return-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/surrounding-throw-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/surrounding-while-loop-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/switch-fallthrough-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/switch-fallthrough-comment-in-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/switch-no-default-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/switch-no-default-comment-in-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/switch-no-default-comment-in-nested-functions.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/template-string-block.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/type-assertion-regression-test.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrayLiteral/array-literal-in-lhs.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrayLiteral/array-literals-in-binary-expr.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/as-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/as-param-with-params.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/basic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/basic-in-binary-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/block-body.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/block-body-not-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-dup-params.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-missing-paren.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-not-arrow.src 1`] = ` -TSError { - "column": 26, - "index": 26, - "lineNumber": 1, - "message": "Expression expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-numeric-param.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-numeric-param-multi.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-reverse-arrow.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "Expression expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-default-param-eval.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-dup-params.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-eval.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-eval-return.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-octal.src 1`] = ` -TSError { - "column": 21, - "index": 21, - "lineNumber": 1, - "message": "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-param-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-param-eval.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-param-names.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-param-no-paren-eval.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-two-lines.src 1`] = ` -TSError { - "column": 1, - "index": 12, - "lineNumber": 2, - "message": "Line terminator not permitted before arrow.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-wrapped-param.src 1`] = ` -TSError { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/iife.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/multiple-params.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/no-auto-return.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/not-strict-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/not-strict-eval.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/not-strict-eval-params.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/not-strict-octal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/return-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/return-sequence.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/single-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/single-param-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/single-param-return-identifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/and-operator-array-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/delete-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/do-while-statements.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/identifiers-double-underscore.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/instanceof.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/new-with-member-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/new-without-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/or-operator-array-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/typeof-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/update-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/basics/void-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/bigIntLiterals/binary.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/bigIntLiterals/decimal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/bigIntLiterals/hex.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/bigIntLiterals/numeric-separator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/bigIntLiterals/octal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/binaryLiterals/invalid.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/binaryLiterals/lowercase.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/binaryLiterals/uppercase.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/blockBindings/const.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/blockBindings/let.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/blockBindings/let-in-switchcase.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/callExpression/call-expression-with-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/callExpression/call-expression-with-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/callExpression/mixed-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/callExpression/new-expression-with-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/callExpression/new-expression-with-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-accessor-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-computed-static-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-method-named-prototype.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-method-named-static.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-method-named-with-space.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-one-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-one-method-super.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-private-identifier-accessor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-private-identifier-field.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-private-identifier-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-static-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-static-method-named-prototype.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-static-method-named-static.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-static-methods-and-accessor-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-two-computed-static-methods.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-two-methods.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-two-methods-computed-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-two-methods-semi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-two-methods-three-semi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-two-methods-two-semi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-two-static-methods-named-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-with-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-with-constructor-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-with-constructor-with-space.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-with-no-body.src 1`] = ` -TSError { - "column": 0, - "index": 10, - "lineNumber": 2, - "message": "'{' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/derived-class-assign-to-var.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/derived-class-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/empty-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/empty-class-double-semi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/empty-class-semi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/empty-literal-derived-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/invalid-class-declaration.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "A class declaration without the 'default' modifier must have a name.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/invalid-class-setter-declaration.src 1`] = ` -TSError { - "column": 14, - "index": 14, - "lineNumber": 1, - "message": "A 'set' accessor must have exactly one parameter.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/invalid-class-two-super-classes.src 1`] = ` -TSError { - "column": 18, - "index": 18, - "lineNumber": 1, - "message": "Classes can only extend a single class.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/named-class-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/named-derived-class-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/commaOperator/comma-operator-conditional.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/commaOperator/comma-operator-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/commaOperator/comma-operator-nested.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/commaOperator/comma-operator-return.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/commaOperator/comma-operator-simple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/commaOperator/comma-operator-simple-nested.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/defaultParams/class-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/defaultParams/class-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/defaultParams/declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/defaultParams/expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/defaultParams/method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/defaultParams/not-all-params.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/array-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/array-to-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/array-var-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/call-expression-destruction-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/call-expression-destruction-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/class-constructor-params-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/class-constructor-params-defaults-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/class-constructor-params-defaults-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/class-constructor-params-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/class-method-params-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/class-method-params-defaults-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/class-method-params-defaults-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/class-method-params-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-array-all.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-array-longform-nested-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-array-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-array-nested-all.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-array-nested-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object-all.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object-assign.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object-longform.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object-longform-all.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object-longform-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object-mixed-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object-nested-all.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/defaults-object-nested-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/destructured-array-catch.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/destructured-object-catch.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/invalid-defaults-object-assign.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "The left-hand side of an assignment expression must be a variable or a property access.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/named-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/nested-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/nested-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/object-var-named.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/object-var-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/param-defaults-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/param-defaults-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/param-defaults-object-nested.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/params-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/params-array-wrapped.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/params-multi-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/params-nested-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/params-nested-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/params-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/params-object-wrapped.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/sparse-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-arrowFunctions/arrow-param-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-blockBindings/array-const-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-blockBindings/array-let-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-blockBindings/object-const-named.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-blockBindings/object-const-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-blockBindings/object-let-named.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-blockBindings/object-let-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-defaultParams/param-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-defaultParams/param-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-defaultParams/param-object-short.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-defaultParams/param-object-wrapped.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-forOf/loop.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/complex-destructured.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/destructured-array-literal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/destructuring-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "A rest element must be last in a destructuring pattern.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/invalid-not-final-array-empty.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "A rest parameter or binding pattern may not have a trailing comma.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/multi-destructured.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/not-final-array.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "A rest element must be last in a destructuring pattern.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/single-destructured.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/var-complex-destructured.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/var-destructured-array-literal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/var-multi-destructured.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/var-single-destructured.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/directives/block.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/directives/directive-in-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/directives/first-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/directives/function-non-strict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/directives/non-directive-string.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/directives/non-unique-directive.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/directives/program.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/directives/program-order.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/directives/raw.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalAsyncIteration/async-generators.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalAsyncIteration/async-iterator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalDynamicImport/dynamic-import.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalDynamicImport/error-dynamic-import-params.src 1`] = ` -TSError { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "Dynamic import requires exactly one or two arguments.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/arg-spread.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/invalid-rest.src 1`] = ` -TSError { - "column": 18, - "index": 18, - "lineNumber": 1, - "message": "',' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src 1`] = ` -TSError { - "column": 16, - "index": 16, - "lineNumber": 1, - "message": "A rest parameter or binding pattern may not have a trailing comma.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/object-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/property-spread.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/shorthand-method-args.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/shorthand-methods.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/shorthand-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/single-spread.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/spread-trailing-comma.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/two-spread.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalOptionalCatchBinding/optional-catch-binding-finally.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/exponentiationOperators/exponential-operators.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/for/for-empty.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/for/for-loop.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/for/for-with-coma.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/for/for-with-const.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/for/for-with-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/for/for-with-let.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-bare-nonstrict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-destruction-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-object.src 1`] = ` -TSError { - "column": 14, - "index": 14, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-object-with-body.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-with-assigment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-with-bare-assigment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-with-const.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-with-milti-asigment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-with-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-with-var.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-destruction-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-with-function-initializer.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "The variable declaration of a 'for...of' statement cannot have an initializer.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-with-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-with-var-and-braces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-with-var-and-no-braces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/invalid-for-of-with-const-and-no-braces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/invalid-for-of-with-let-and-no-braces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/function/return-multiline-sequence.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/function/return-sequence.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/anonymous-generator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/async-generator-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/async-generator-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/double-yield.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/empty-generator-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/generator-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/yield-delegation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/yield-without-value.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/yield-without-value-in-call.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/yield-without-value-no-semi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/globalReturn/return-identifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/globalReturn/return-no-arg.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/globalReturn/return-true.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/hexLiterals/invalid.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/hexLiterals/lowercase.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/hexLiterals/uppercase.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/importMeta/simple-import-meta.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/labels/label-break.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/labels/label-continue.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/error-delete.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/error-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/error-strict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-async-named-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-const.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-async-named-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-named-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-named-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-number.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-value.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-from-batch.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-from-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-from-named-as-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-from-named-as-specifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-from-named-as-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-from-specifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-from-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-let.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-as-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-as-specifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-as-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-empty.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-specifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-specifiers-comma.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-var.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-var-anonymous-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-var-number.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-default-and-named-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-default-and-namespace-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-default-as.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-jquery.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-module.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-named-as-specifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-named-as-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-named-empty.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-named-specifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-named-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-named-specifiers-comma.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-namespace-specifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/import-null-as-nil.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-await.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-batch-missing-from-clause.src 1`] = ` -TSError { - "column": 0, - "index": 9, - "lineNumber": 2, - "message": "'from' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-batch-token.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "'from' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-default.src 1`] = ` -TSError { - "column": 20, - "index": 20, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-default-equal.src 1`] = ` -TSError { - "column": 15, - "index": 15, - "lineNumber": 1, - "message": "Expression expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-default-token.src 1`] = ` -TSError { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-module-specifier.src 1`] = ` -TSError { - "column": 19, - "index": 19, - "lineNumber": 1, - "message": "Module specifier must be a string literal.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-named-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-named-extra-comma.src 1`] = ` -TSError { - "column": 16, - "index": 16, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-named-middle-comma.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default.src 1`] = ` -TSError { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "Expression expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default-after-named.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "'from' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default-after-named-after-default.src 1`] = ` -TSError { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "'from' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default-missing-module-specifier.src 1`] = ` -TSError { - "column": 0, - "index": 11, - "lineNumber": 2, - "message": "'=' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default-module-specifier.src 1`] = ` -TSError { - "column": 15, - "index": 15, - "lineNumber": 1, - "message": "Module specifier must be a string literal.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-missing-module-specifier.src 1`] = ` -TSError { - "column": 0, - "index": 20, - "lineNumber": 2, - "message": "'from' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-module-specifier.src 1`] = ` -TSError { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "Module specifier must be a string literal.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-after-named.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "'from' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-after-namespace.src 1`] = ` -TSError { - "column": 15, - "index": 15, - "lineNumber": 1, - "message": "'from' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-as-missing-from.src 1`] = ` -TSError { - "column": 0, - "index": 24, - "lineNumber": 2, - "message": "'from' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-extra-comma.src 1`] = ` -TSError { - "column": 16, - "index": 16, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-middle-comma.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-namespace-after-named.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "'from' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-namespace-missing-as.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "'as' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/newTarget/invalid-new-target.src 1`] = ` -TSError { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/newTarget/invalid-unknown-property.src 1`] = ` -TSError { - "column": 25, - "index": 25, - "lineNumber": 1, - "message": "'unknown_property' is not a valid meta-property for keyword 'new'. Did you mean 'target'?", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/newTarget/simple-new-target.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteral/object-literal-in-lhs.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/computed-addition-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/computed-and-identifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/computed-string-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/computed-variable-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src 1`] = ` -TSError { - "column": 0, - "index": 20, - "lineNumber": 3, - "message": "':' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "':' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/standalone-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralDuplicateProperties/error-proto-property.src 1`] = ` -TSError { - "column": 1, - "index": 62, - "lineNumber": 7, - "message": "An object literal cannot have multiple properties with the same name.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src 1`] = ` -TSError { - "column": 1, - "index": 64, - "lineNumber": 7, - "message": "An object literal cannot have multiple properties with the same name.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src 1`] = ` -TSError { - "column": 1, - "index": 39, - "lineNumber": 5, - "message": "An object literal cannot have multiple properties with the same name.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src 1`] = ` -TSError { - "column": 1, - "index": 41, - "lineNumber": 5, - "message": "An object literal cannot have multiple properties with the same name.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src 1`] = ` -TSError { - "column": 13, - "index": 19, - "lineNumber": 2, - "message": "'{' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandMethods/method-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandMethods/simple-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-get.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandMethods/simple-method-named-set.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandMethods/string-name-method-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandProperties/shorthand-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/octalLiterals/invalid.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "';' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/octalLiterals/legacy.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o2343'.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/octalLiterals/lowercase.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/octalLiterals/strict-uppercase.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/octalLiterals/uppercase.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/regex/regexp-simple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/regexUFlag/regex-u-extended-escape.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/regexUFlag/regex-u-invalid-extended-escape.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/regexUFlag/regex-u-simple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/regexYFlag/regexp-y-simple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/basic-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/class-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/class-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/error-no-default.src 1`] = ` -TSError { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "A rest parameter cannot have an initializer.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/error-not-last.src 1`] = ` -TSError { - "column": 14, - "index": 14, - "lineNumber": 1, - "message": "A rest parameter must be last in a parameter list.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/func-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/func-expression-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/invalid-rest-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/single-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/simple-literals/literal-float.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/simple-literals/literal-float-negative.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/simple-literals/literal-null.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/simple-literals/literal-number.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/simple-literals/literal-number-negative.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/simple-literals/literal-string.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/simple-literals/literal-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/spread/complex-spread.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/spread/error-invalid-if.src 1`] = ` -TSError { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "Expression expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/spread/error-invalid-sequence.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "Expression expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/spread/multi-function-call.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/spread/not-final-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/spread/simple-function-call.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/templateStrings/deeply-nested.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/templateStrings/error-octal-literal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/templateStrings/escape-characters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/templateStrings/expressions.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/templateStrings/multi-line-template-string.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/templateStrings/simple-template-string.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/templateStrings/single-dollar-sign.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/templateStrings/tagged-no-placeholders.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/templateStrings/tagged-template-string.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/basic-string-literal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/complex-string-literal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/ignored.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/invalid-empty-escape.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "Hexadecimal digit expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src 1`] = ` -TSError { - "column": 10, - "index": 10, - "lineNumber": 1, - "message": "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/attributes.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/element-keyword-name.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-conditional.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-invalid-js-identifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-tags.src 1`] = ` -TSError { - "column": 40, - "index": 40, - "lineNumber": 1, - "message": "Unexpected token. Did you mean \`{'>'}\` or \`>\`?", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/empty-placeholder.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns-ignored.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns-unknown.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patterns-valid.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patters-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-attribute.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'{' or JSX element expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-attribute-missing-equals.src 1`] = ` -TSError { - "column": 14, - "index": 14, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-broken-tag.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "Unterminated string literal.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-computed-end-tag-name.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-computed-string-end-tag-name.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-embedded-expression.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "'}' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-leading-dot-tag-name.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Expression expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src 1`] = ` -TSError { - "column": 27, - "index": 27, - "lineNumber": 1, - "message": "'>' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-closing-tag.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "Expected corresponding JSX closing tag for 'a'.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-closing-tags.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "JSX element 'a' has no corresponding closing tag.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-dot-tag-name.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "Expected corresponding JSX closing tag for 'a.b.c'.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-namespace-tag.src 1`] = ` -TSError { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "Expected corresponding JSX closing tag for 'a:b'.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-closing-tag.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "JSX element 'a' has no corresponding closing tag.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "JSX element 'a' has no corresponding closing tag.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-namespace-name.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Expression expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-namespace-value.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-spread-operator.src 1`] = ` -TSError { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "'...' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-namespace-name-with-docts.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-namespace-value-with-dots.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-common-parent.src 1`] = ` -TSError { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "JSX expressions must have one parent element.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-common-parent-with-comment.src 1`] = ` -TSError { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "JSX expressions must have one parent element.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-tag-name.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Declaration or statement expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-placeholder-in-closing-tag.src 1`] = ` -TSError { - "column": 16, - "index": 16, - "lineNumber": 1, - "message": "'>' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-shorthand-fragment-no-closing.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "JSX fragment has no corresponding closing tag.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-trailing-dot-tag-name.src 1`] = ` -TSError { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-unexpected-comma.src 1`] = ` -TSError { - "column": 19, - "index": 19, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/japanese-characters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/less-than-operator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression-private.src 1`] = ` -TSError { - "column": 10, - "index": 10, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/multiple-blank-spaces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespace-this-name.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-attribute-and-value-inserted.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-name-and-attribute.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/newslines-and-entities.src 1`] = ` -TSError { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "Invalid character.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-inside-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-with-newline.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Invalid character.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/shorthand-fragment-with-child.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-child.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attribute-and-regular-attribute.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/spread-operator-attributes.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-dots.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-multi-dots.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/tag-names-with-multi-dots-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/test-content.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/trailing-spread-operator-attribute.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx-useJSXTextNode/test-content.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-element.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-member-expression-private.src 1`] = ` -TSError { - "column": 22, - "index": 22, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-opening-element.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/react-typed-props.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/babylon-convergence/type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-constructor.src 1`] = ` -TSError { - "column": 4, - "index": 43, - "lineNumber": 2, - "message": "'abstract' modifier can only appear on a class, method, or property declaration.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-static-constructor.src 1`] = ` -TSError { - "column": 2, - "index": 41, - "lineNumber": 2, - "message": "'abstract' modifier can only appear on a class, method, or property declaration.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-declare-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-optional-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-override-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-override-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-interface.src 1`] = ` -TSError { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "'abstract' modifier can only appear on a class, method, or property declaration.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/angle-bracket-type-assertion.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/angle-bracket-type-assertion-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/arrow-function-with-optional-parameter.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/arrow-function-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/async-function-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/async-function-with-var-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/await-without-async-function.src 1`] = ` -TSError { - "column": 14, - "index": 31, - "lineNumber": 2, - "message": "'await' expressions are only allowed within async functions and at the top levels of modules.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/call-signatures.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/call-signatures-with-generics.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-multi-assign.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-operator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-simple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/catch-clause-with-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/catch-clause-with-invalid-annotation.src 1`] = ` -TSError { - "column": 12, - "index": 19, - "lineNumber": 3, - "message": "Catch clause variable type annotation must be 'any' or 'unknown' if specified.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-multi-line-keyword-abstract.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-multi-line-keyword-declare.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-private-identifier-field-with-accessibility-error.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-private-identifier-field-with-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-private-identifier-readonly-field.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-static-blocks.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-accessibility-modifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-modifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-return-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-declare-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-definite-assignment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-export-parameter-properties.src 1`] = ` -TSError { - "column": 16, - "index": 28, - "lineNumber": 2, - "message": "'export' modifier cannot appear on a parameter.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-extends-and-implements.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-extends-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-extends-generic-multiple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-generic-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-generic-method-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-implements.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-implements-and-extends.src 1`] = ` -TSError { - "column": 57, - "index": 57, - "lineNumber": 1, - "message": "'extends' clause must precede 'implements' clause.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-implements-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-implements-generic-multiple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-mixin.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-mixin-reference.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-optional-computed-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-optional-computed-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-optional-methods.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-optional-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-optional-property-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-override-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-override-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-private-optional-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-private-parameter-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-property-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-property-values.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-protected-parameter-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-public-parameter-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-readonly-parameter-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-readonly-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-static-parameter-properties.src 1`] = ` -TSError { - "column": 16, - "index": 28, - "lineNumber": 2, - "message": "'static' modifier cannot appear on a parameter.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-two-methods-computed-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-type-parameter.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-type-parameter-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-type-parameter-underscore.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/const-assertions.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/const-enum.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/declare-class-with-optional-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/declare-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/destructuring-assignment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/destructuring-assignment-nested.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/destructuring-assignment-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/destructuring-assignment-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/directive-in-module.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/directive-in-namespace.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/dynamic-import-with-import-assertions.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-all-with-import-assertions.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-as-namespace.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-assignment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-declare-const-named-enum.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-declare-named-enum.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-default-class-with-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-default-class-with-multiple-generics.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-default-interface.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-class-with-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-class-with-multiple-generics.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-enum.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-enum-computed-number.src 1`] = ` -TSError { - "column": 4, - "index": 22, - "lineNumber": 2, - "message": "An enum member cannot have a numeric name.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-enum-computed-string.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-enum-computed-var-ref.src 1`] = ` -TSError { - "column": 4, - "index": 22, - "lineNumber": 2, - "message": "Computed property names are not allowed in enums.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-star-as-ns-from.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-type-as.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-type-from.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-type-from-as.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-type-star-from.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-with-import-assertions.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-anonymus-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-anynomus-with-return-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-overloads.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-await.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-object-type-with-optional-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-object-type-without-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-type-parameters-with-constraint.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-types.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-types-assignation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/global-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-equal-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-equal-type-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-export-equal-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-export-equal-type-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-type-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-type-empty.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-type-error.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-type-named.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-type-named-as.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-type-star-as-ns.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/import-with-import-assertions.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-extends.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-extends-multiple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-all-property-types.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src 1`] = ` -TSError { - "column": 9, - "index": 26, - "lineNumber": 2, - "message": "A parameter property is only allowed in a constructor implementation.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-extends-member-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-extends-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-jsdoc.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-optional-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-without-type-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/intrinsic-keyword.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/keyof-operator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/keyword-variables.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/nested-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/never-type-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/new-target-in-arrow-function-body.src 1`] = ` -TSError { - "column": 16, - "index": 16, - "lineNumber": 1, - "message": "Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/non-null-assertion-operator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/null-and-undefined-type-annotations.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/nullish-coalescing.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/object-with-escaped-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/object-with-typed-methods.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-call.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-call-with-non-null-assertion.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-call-with-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-element-access.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-element-access-with-non-null-assertion.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-element-access-with-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-with-non-null-assertion.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-with-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/parenthesized-use-strict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/private-fields-in-in.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/readonly-arrays.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/readonly-tuples.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/short-circuiting-assignment-and-and.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/short-circuiting-assignment-or-or.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/short-circuiting-assignment-question-question.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/symbol-type-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-alias-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-alias-declaration-export.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-alias-declaration-export-function-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-alias-declaration-export-object-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-alias-object-without-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-in-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-in-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-in-interface.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-in-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-with-guard-in-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-with-guard-in-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-with-guard-in-interface.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-with-guard-in-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-guard-in-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-guard-in-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-guard-in-interface.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-guard-in-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-import-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-import-type-with-type-parameters-in-type-reference.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-only-export-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-only-import-specifiers.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-parameters-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-parameters-comments-heritage.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-reference-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-bigint.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-boolean.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-false.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-never.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-null.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-number.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-string.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-symbol.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-true.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-undefined.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-unknown.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-keyword-void.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-method-signature.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/typed-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/union-intersection.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/unique-symbol.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/unknown-type-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/var-with-definite-assignment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/var-with-dotted-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/var-with-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/declare/abstract-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/declare/class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/declare/enum.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/declare/function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/declare/interface.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/declare/module.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/declare/namespace.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/declare/type-alias.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/declare/variable.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/class-decorators/class-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/class-decorators/class-decorator-factory.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/class-decorators/class-parameter-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/class-decorators/export-default-class-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/class-decorators/export-named-class-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/class-empty-extends.src 1`] = ` -TSError { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "'extends' list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/class-empty-extends-implements.src 1`] = ` -TSError { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "'extends' list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/class-extends-empty-implements.src 1`] = ` -TSError { - "column": 32, - "index": 32, - "lineNumber": 1, - "message": "'implements' list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/class-multiple-implements.src 1`] = ` -TSError { - "column": 21, - "index": 21, - "lineNumber": 1, - "message": "'implements' clause already seen.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Decorators are not valid here.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-function.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Decorators are not valid here.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Decorators are not valid here.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-variable.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Decorators are not valid here.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments.src 1`] = ` -TSError { - "column": 14, - "index": 14, - "lineNumber": 1, - "message": "Type argument list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = ` -TSError { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "Type argument list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = ` -TSError { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "Type argument list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters.src 1`] = ` -TSError { - "column": 11, - "index": 11, - "lineNumber": 1, - "message": "Type parameter list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = ` -TSError { - "column": 11, - "index": 11, - "lineNumber": 1, - "message": "Type parameter list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src 1`] = ` -TSError { - "column": 13, - "index": 25, - "lineNumber": 2, - "message": "Type parameter list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = ` -TSError { - "column": 20, - "index": 20, - "lineNumber": 1, - "message": "Type parameter list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src 1`] = ` -TSError { - "column": 6, - "index": 18, - "lineNumber": 2, - "message": "Type parameter list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = ` -TSError { - "column": 6, - "index": 22, - "lineNumber": 2, - "message": "Type parameter list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/enum-with-keywords.src 1`] = ` -TSError { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "'private' modifier cannot appear on a module or namespace element.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/index-signature-parameters.src 1`] = ` -TSError { - "column": 3, - "index": 16, - "lineNumber": 2, - "message": "An index signature must have exactly one parameter.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-empty-extends.src 1`] = ` -TSError { - "column": 21, - "index": 21, - "lineNumber": 1, - "message": "'extends' list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-implements.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "Interface declaration cannot have 'implements' clause.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-export.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'export' modifier cannot appear on an index signature.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-private.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'private' modifier cannot appear on an index signature.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-protected.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'protected' modifier cannot appear on an index signature.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-public.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'public' modifier cannot appear on an index signature.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-static.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'static' modifier cannot appear on an index signature.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-export.src 1`] = ` -TSError { - "column": 4, - "index": 20, - "lineNumber": 2, - "message": "'export' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-private.src 1`] = ` -TSError { - "column": 4, - "index": 20, - "lineNumber": 2, - "message": "'private' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-protected.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'protected' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-public.src 1`] = ` -TSError { - "column": 4, - "index": 20, - "lineNumber": 2, - "message": "'public' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-readonly.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-static.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'static' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-multiple-extends.src 1`] = ` -TSError { - "column": 26, - "index": 26, - "lineNumber": 1, - "message": "'extends' clause already seen.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-export.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'export' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-private.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'private' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-protected.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'protected' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-public.src 1`] = ` -TSError { - "column": 4, - "index": 20, - "lineNumber": 2, - "message": "'public' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-static.src 1`] = ` -TSError { - "column": 2, - "index": 18, - "lineNumber": 2, - "message": "'static' modifier cannot appear on a type member.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-with-default-value.src 1`] = ` -TSError { - "column": 16, - "index": 32, - "lineNumber": 2, - "message": "An interface property cannot have an initializer.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-with-no-body.src 1`] = ` -TSError { - "column": 0, - "index": 14, - "lineNumber": 2, - "message": "'{' expected.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-with-optional-index-signature.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/object-assertion-not-allowed.src 1`] = ` -TSError { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "A definite assignment assertion '!' is not permitted in this context.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/object-optional-not-allowed.src 1`] = ` -TSError { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "An object member cannot be declared optional.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/solo-const.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "Variable declaration list cannot be empty.", -} -`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/expressions/call-expression-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/expressions/instantiation-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/expressions/new-expression-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/expressions/optional-call-expression-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/expressions/tagged-template-expression-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/namespaces-and-modules/global-module-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/namespaces-and-modules/module-with-default-exports.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/namespaces-and-modules/nested-internal-module.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/array-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/conditional.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/conditional-infer.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/conditional-infer-nested.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/conditional-infer-simple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/conditional-infer-with-constraint.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/conditional-with-null.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor-abstract.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor-empty.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor-in-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor-with-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-in-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-array-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-object-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/index-signature.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/index-signature-readonly.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/index-signature-without-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/indexed.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/interface-with-accessors.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/intersection-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/literal-number.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/literal-number-negative.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/literal-string.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/mapped.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/mapped-named-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/mapped-readonly.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/mapped-readonly-minus.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/mapped-readonly-plus.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/mapped-untypped.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/nested-types.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/object-literal-type-with-accessors.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/optional-variance-in.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/optional-variance-in-and-out.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/optional-variance-in-out.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/optional-variance-out.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/parenthesized-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/reference.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/reference-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/reference-generic-nested.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/template-literal-type-1.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/template-literal-type-2.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/template-literal-type-3.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/template-literal-type-4.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/this-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/this-type-expanded.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/tuple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/tuple-empty.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/tuple-named.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/tuple-named-optional.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/tuple-named-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/tuple-named-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/tuple-optional.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/tuple-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/tuple-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/type-literal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/type-operator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/typeof.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/typeof-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/typeof-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/union-intersection.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; - -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/union-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/parse.test.ts b/packages/typescript-estree/tests/lib/parse.test.ts index afa44a8c5f8..bc4d539d8f0 100644 --- a/packages/typescript-estree/tests/lib/parse.test.ts +++ b/packages/typescript-estree/tests/lib/parse.test.ts @@ -6,6 +6,7 @@ import * as astConverterModule from '../../src/ast-converter'; import * as sharedParserUtilsModule from '../../src/create-program/shared'; import type { TSESTreeOptions } from '../../src/parser-options'; import { createSnapshotTestBlock } from '../../tools/test-utils'; +import { expectToHaveParserServices } from './test-utils/expectToHaveParserServices'; const FIXTURES_DIR = join(__dirname, '../fixtures/simpleProject'); @@ -196,39 +197,6 @@ describe('parseWithNodeMaps()', () => { }); describe('parseAndGenerateServices', () => { - describe('errorOnTypeScriptSyntacticAndSemanticIssues', () => { - const code = '@test const foo = 2'; - const options: TSESTreeOptions = { - comment: true, - tokens: true, - range: true, - loc: true, - errorOnTypeScriptSyntacticAndSemanticIssues: true, - }; - - it('should throw on invalid option when used in parseWithNodeMaps', () => { - expect(() => { - parser.parseWithNodeMaps(code, options); - }).toThrow( - `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()`, - ); - }); - - it('should not throw when used in parseAndGenerateServices', () => { - expect(() => { - parser.parseAndGenerateServices(code, options); - }).not.toThrow( - `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()`, - ); - }); - - it('should error on invalid code', () => { - expect(() => { - parser.parseAndGenerateServices(code, options); - }).toThrow('Decorators are not valid here.'); - }); - }); - describe('preserveNodeMaps', () => { const code = 'var a = true'; const baseConfig: TSESTreeOptions = { @@ -321,18 +289,11 @@ describe('parseAndGenerateServices', () => { preserveNodeMaps: setting, }); - expect(parseResult.services.esTreeNodeToTSNodeMap).toBeDefined(); - expect(parseResult.services.tsNodeToESTreeNodeMap).toBeDefined(); expect( - parseResult.services.esTreeNodeToTSNodeMap.has( + parseResult.services.esTreeNodeToTSNodeMap?.has( parseResult.ast.body[0], ), ).toBe(setting); - expect( - parseResult.services.tsNodeToESTreeNodeMap.has( - parseResult.services.program.getSourceFile('estree.ts'), - ), - ).toBe(setting); }); it('with project', () => { @@ -341,20 +302,11 @@ describe('parseAndGenerateServices', () => { preserveNodeMaps: setting, }); - expect(parseResult.services.esTreeNodeToTSNodeMap).toBeDefined(); - expect(parseResult.services.tsNodeToESTreeNodeMap).toBeDefined(); expect( parseResult.services.esTreeNodeToTSNodeMap.has( parseResult.ast.body[0], ), ).toBe(setting); - expect( - parseResult.services.tsNodeToESTreeNodeMap.has( - parseResult.services.program.getSourceFile( - join(FIXTURES_DIR, 'file.ts'), - ), - ), - ).toBe(setting); }); } @@ -411,14 +363,16 @@ describe('parseAndGenerateServices', () => { } if (!shouldThrow) { - expect(result?.services.program).toBeDefined(); expect(result?.ast).toBeDefined(); expect({ ...result, services: { ...result?.services, - // Reduce noise in snapshot - program: {}, + // Reduce noise in snapshot by not printing the TS program + program: + result?.services.program == null + ? 'No Program' + : 'With Program', }, }).toMatchSnapshot(); } @@ -700,9 +654,14 @@ describe('parseAndGenerateServices', () => { }); it('should turn on typescript debugger', () => { - parser.parseAndGenerateServices('const x = 1;', { - debugLevel: ['typescript'], - }); + expect(() => + parser.parseAndGenerateServices('const x = 1;', { + debugLevel: ['typescript'], + filePath: './path-that-doesnt-exist.ts', + project: ['./tsconfig-that-doesnt-exist.json'], + }), + ) // should throw because the file and tsconfig don't exist + .toThrow(); expect(createDefaultCompilerOptionsFromExtra).toHaveBeenCalled(); expect(createDefaultCompilerOptionsFromExtra).toHaveReturnedWith( expect.objectContaining({ @@ -781,12 +740,11 @@ describe('parseAndGenerateServices', () => { describe('when file is in the project', () => { it('returns error if __PLACEHOLDER__ can not be resolved', () => { - expect( - parser - .parseAndGenerateServices(code, config) - .services.program.getSemanticDiagnostics(), - ).toHaveProperty( - [0, 'messageText'], + const services = parser.parseAndGenerateServices(code, config).services; + expectToHaveParserServices(services); + const diagnositcs = services.program.getSemanticDiagnostics(); + expect(diagnositcs.length).toBeGreaterThan(0); + expect(diagnositcs[0].messageText).toBe( "Cannot find module '__PLACEHOLDER__' or its corresponding type declarations.", ); }); @@ -801,44 +759,42 @@ describe('parseAndGenerateServices', () => { ), }), ).toThrowErrorMatchingInlineSnapshot(` - "Could not find the provided parserOptions.moduleResolver. - Hint: use an absolute path if you are not in control over where the ESLint instance runs." - `); + "Could not find the provided parserOptions.moduleResolver. + Hint: use an absolute path if you are not in control over where the ESLint instance runs." + `); }); it('resolves __PLACEHOLDER__ correctly', () => { - expect( - parser - .parseAndGenerateServices(code, { - ...config, - moduleResolver: resolve(PROJECT_DIR, './moduleResolver.js'), - }) - .services.program.getSemanticDiagnostics(), - ).toHaveLength(0); + const services = parser.parseAndGenerateServices(code, { + ...config, + moduleResolver: resolve(PROJECT_DIR, './moduleResolver.js'), + }).services; + expectToHaveParserServices(services); + expect(services.program.getSemanticDiagnostics()).toHaveLength(0); }); }); describe('when file is not in the project and DEPRECATED__createDefaultProgram=true', () => { it('returns error because __PLACEHOLDER__ can not be resolved', () => { - expect( - parser - .parseAndGenerateServices(code, withDeprecatedDefaultProgramConfig) - .services.program.getSemanticDiagnostics(), - ).toHaveProperty( - [0, 'messageText'], + const services = parser.parseAndGenerateServices( + code, + withDeprecatedDefaultProgramConfig, + ).services; + expectToHaveParserServices(services); + const diagnositcs = services.program.getSemanticDiagnostics(); + expect(diagnositcs.length).toBeGreaterThan(0); + expect(diagnositcs[0].messageText).toBe( "Cannot find module '__PLACEHOLDER__' or its corresponding type declarations.", ); }); it('resolves __PLACEHOLDER__ correctly', () => { - expect( - parser - .parseAndGenerateServices(code, { - ...withDeprecatedDefaultProgramConfig, - moduleResolver: resolve(PROJECT_DIR, './moduleResolver.js'), - }) - .services.program.getSemanticDiagnostics(), - ).toHaveLength(0); + const services = parser.parseAndGenerateServices(code, { + ...withDeprecatedDefaultProgramConfig, + moduleResolver: resolve(PROJECT_DIR, './moduleResolver.js'), + }).services; + expectToHaveParserServices(services); + expect(services.program.getSemanticDiagnostics()).toHaveLength(0); }); }); }); diff --git a/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.test.ts b/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.test.ts deleted file mode 100644 index a512e56f93c..00000000000 --- a/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { readFileSync } from 'fs'; -import glob from 'glob'; -import path from 'path'; - -import * as parser from '../../src'; -import { formatSnapshotName, isJSXFileType } from '../../tools/test-utils'; -import { serializer } from '../../tools/tserror-serializer'; - -/** - * Process all fixtures, we will only snapshot the ones that have semantic errors - * which are ignored by default parsing logic. - */ -const FIXTURES_DIR = path.join(__dirname, '../../../shared-fixtures/fixtures'); - -const testFiles = glob.sync('**/*.src.*', { - cwd: FIXTURES_DIR, -}); - -expect.addSnapshotSerializer(serializer); - -describe('Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled', () => { - testFiles.forEach(filename => { - const code = readFileSync(path.join(FIXTURES_DIR, filename), 'utf8'); - const fileExtension = path.extname(filename); - const config: parser.TSESTreeOptions = { - loc: true, - range: true, - tokens: true, - errorOnUnknownASTType: true, - errorOnTypeScriptSyntacticAndSemanticIssues: true, - jsx: isJSXFileType(fileExtension), - }; - it(formatSnapshotName(filename, FIXTURES_DIR, fileExtension), () => { - expect.assertions(1); - try { - parser.parseAndGenerateServices(code, config); - expect( - 'TEST OUTPUT: No semantic or syntactic issues found', - ).toMatchSnapshot(); - } catch (err) { - expect(err).toMatchSnapshot(); - } - }); - }); -}); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.test.ts b/packages/typescript-estree/tests/lib/semanticInfo.test.ts index 04b0b7e6052..1b86d26edae 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.test.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.test.ts @@ -14,6 +14,7 @@ import { formatSnapshotName, parseCodeAndGenerateServices, } from '../../tools/test-utils'; +import { expectToHaveParserServices } from './test-utils/expectToHaveParserServices'; const FIXTURES_DIR = './tests/fixtures/semanticInfo'; const testFiles = glob.sync(`**/*.src.ts`, { @@ -104,9 +105,9 @@ describe('semanticInfo', () => { code, optionsRelativePath, ); - if (absolutePathResult.services.program === undefined) { + if (absolutePathResult.services.program == null) { throw new Error('Unable to create ts.program for absolute tsconfig'); - } else if (relativePathResult.services.program === undefined) { + } else if (relativePathResult.services.program == null) { throw new Error('Unable to create ts.program for relative tsconfig'); } expect( @@ -150,12 +151,13 @@ describe('semanticInfo', () => { createOptions(fileName), ); - expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); + expectToHaveParserServices(parseResult.services); const binaryExpression = ( parseResult.ast.body[0] as TSESTree.VariableDeclaration ).declarations[0].init!; const tsBinaryExpression = parseResult.services.esTreeNodeToTSNodeMap.get(binaryExpression); + expectToBeDefined(tsBinaryExpression); expect(tsBinaryExpression.kind).toEqual(ts.SyntaxKind.BinaryExpression); const computedPropertyString = ( @@ -164,6 +166,7 @@ describe('semanticInfo', () => { ).key; const tsComputedPropertyString = parseResult.services.esTreeNodeToTSNodeMap.get(computedPropertyString); + expectToBeDefined(tsComputedPropertyString); expect(tsComputedPropertyString.kind).toEqual(ts.SyntaxKind.StringLiteral); }); @@ -176,7 +179,8 @@ describe('semanticInfo', () => { // get type checker expect(parseResult).toHaveProperty('services.program.getTypeChecker'); - const checker = parseResult.services.program.getTypeChecker(); + const checker = parseResult.services.program?.getTypeChecker(); + expectToBeDefined(checker); // get array node (ast shape validated by snapshot) // node is defined in other file than the parsed one @@ -188,10 +192,10 @@ describe('semanticInfo', () => { ).object as TSESTree.Identifier; expect(arrayBoundName.name).toBe('arr'); - expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); + expectToHaveParserServices(parseResult.services); const tsArrayBoundName = parseResult.services.esTreeNodeToTSNodeMap.get(arrayBoundName); - expect(tsArrayBoundName).toBeDefined(); + expectToBeDefined(tsArrayBoundName); checkNumberArrayType(checker, tsArrayBoundName); expect( @@ -209,18 +213,17 @@ describe('semanticInfo', () => { }, ); - expect(parseResult.services.program).toBeDefined(); - // get bound name const boundName = (parseResult.ast.body[0] as TSESTree.VariableDeclaration) .declarations[0].id as TSESTree.Identifier; expect(boundName.name).toBe('x'); const tsBoundName = - parseResult.services.esTreeNodeToTSNodeMap.get(boundName); + parseResult.services.esTreeNodeToTSNodeMap?.get(boundName); + expectToBeDefined(tsBoundName); expect(tsBoundName).toBeDefined(); - expect(parseResult.services.tsNodeToESTreeNodeMap.get(tsBoundName)).toBe( + expect(parseResult.services.tsNodeToESTreeNodeMap?.get(tsBoundName)).toBe( boundName, ); }); @@ -290,7 +293,7 @@ describe('semanticInfo', () => { DEPRECATED__createDefaultProgram: true, }); - expect(parseResult.services.program).toBeDefined(); + expectToHaveParserServices(parseResult.services); }); it('empty programs array should throw', () => { @@ -358,20 +361,20 @@ function testIsolatedFile( parseResult: ParseAndGenerateServicesResult, ): void { // get type checker - expect(parseResult).toHaveProperty('services.program.getTypeChecker'); + expectToHaveParserServices(parseResult.services); const checker = parseResult.services.program.getTypeChecker(); + expectToBeDefined(checker); // get number node (ast shape validated by snapshot) const declaration = (parseResult.ast.body[0] as TSESTree.VariableDeclaration) .declarations[0]; const arrayMember = (declaration.init! as TSESTree.ArrayExpression) .elements[0]; - expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); // get corresponding TS node const tsArrayMember = parseResult.services.esTreeNodeToTSNodeMap.get(arrayMember); - expect(tsArrayMember).toBeDefined(); + expectToBeDefined(tsArrayMember); expect(tsArrayMember.kind).toBe(ts.SyntaxKind.NumericLiteral); expect((tsArrayMember as ts.NumericLiteral).text).toBe('3'); @@ -383,7 +386,6 @@ function testIsolatedFile( expect((arrayMemberType as any).value).toBe(3); // make sure it maps back to original ESTree node - expect(parseResult).toHaveProperty('services.tsNodeToESTreeNodeMap'); expect(parseResult.services.tsNodeToESTreeNodeMap.get(tsArrayMember)).toBe( arrayMember, ); @@ -392,7 +394,7 @@ function testIsolatedFile( const boundName = declaration.id as TSESTree.Identifier; expect(boundName.name).toBe('x'); const tsBoundName = parseResult.services.esTreeNodeToTSNodeMap.get(boundName); - expect(tsBoundName).toBeDefined(); + expectToBeDefined(tsBoundName); checkNumberArrayType(checker, tsBoundName); expect(parseResult.services.tsNodeToESTreeNodeMap.get(tsBoundName)).toBe( boundName, @@ -414,3 +416,7 @@ function checkNumberArrayType(checker: ts.TypeChecker, tsNode: ts.Node): void { expect(typeArguments).toHaveLength(1); expect(typeArguments[0].flags).toBe(ts.TypeFlags.Number); } + +function expectToBeDefined(thing: unknown): asserts thing { + expect(thing).toBeDefined(); +} diff --git a/packages/typescript-estree/tests/lib/test-utils/expectToHaveParserServices.ts b/packages/typescript-estree/tests/lib/test-utils/expectToHaveParserServices.ts new file mode 100644 index 00000000000..d087dd3c54b --- /dev/null +++ b/packages/typescript-estree/tests/lib/test-utils/expectToHaveParserServices.ts @@ -0,0 +1,12 @@ +import type { + ParserServices, + ParserServicesWithTypeInformation, +} from '../../../src'; + +export function expectToHaveParserServices( + services: ParserServices | null | undefined, +): asserts services is ParserServicesWithTypeInformation { + expect(services?.program).toBeDefined(); + expect(services?.esTreeNodeToTSNodeMap).toBeDefined(); + expect(services?.tsNodeToESTreeNodeMap).toBeDefined(); +} diff --git a/packages/utils/src/eslint-utils/getParserServices.ts b/packages/utils/src/eslint-utils/getParserServices.ts index cb04d6cc93d..a16d81b77de 100644 --- a/packages/utils/src/eslint-utils/getParserServices.ts +++ b/packages/utils/src/eslint-utils/getParserServices.ts @@ -1,39 +1,47 @@ import type * as TSESLint from '../ts-eslint'; -import type { ParserServices } from '../ts-estree'; +import type { + ParserServices, + ParserServicesWithTypeInformation, +} from '../ts-estree'; const ERROR_MESSAGE = 'You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.'; +type GetParserServicesResult = T extends true + ? ParserServices + : ParserServicesWithTypeInformation; + /** * Try to retrieve typescript parser service from context */ function getParserServices< TMessageIds extends string, TOptions extends readonly unknown[], + TAllowWithoutFullTypeInformation extends boolean = false, >( context: Readonly>, - allowWithoutFullTypeInformation = false, -): ParserServices { + allowWithoutFullTypeInformation: TAllowWithoutFullTypeInformation = false as TAllowWithoutFullTypeInformation, +): GetParserServicesResult { // backwards compatibility check // old versions of the parser would not return any parserServices unless parserOptions.project was set if ( - !context.parserServices?.program || - !context.parserServices.esTreeNodeToTSNodeMap || - !context.parserServices.tsNodeToESTreeNodeMap + context.parserServices == null || + context.parserServices.esTreeNodeToTSNodeMap == null || + context.parserServices.tsNodeToESTreeNodeMap == null ) { throw new Error(ERROR_MESSAGE); } - const hasFullTypeInformation = - context.parserServices.hasFullTypeInformation ?? - /* backwards compatible */ true; - // if a rule requires full type information, then hard fail if it doesn't exist // this forces the user to supply parserOptions.project - if (!hasFullTypeInformation && !allowWithoutFullTypeInformation) { + if ( + context.parserServices.program == null && + !allowWithoutFullTypeInformation + ) { throw new Error(ERROR_MESSAGE); } + // @ts-expect-error - this is safe and correct, TS just doesn't like the assignment to the conditional type return context.parserServices; } diff --git a/packages/utils/src/ts-estree.ts b/packages/utils/src/ts-estree.ts index 1138deddceb..212d339c4ba 100644 --- a/packages/utils/src/ts-estree.ts +++ b/packages/utils/src/ts-estree.ts @@ -7,7 +7,8 @@ export { TSESTree, } from '@typescript-eslint/types'; -// NOTE - this uses hard links inside ts-estree to avoid initialization of entire package -// via its main file (which imports typescript at runtime). -// Not every eslint-plugin written in typescript requires typescript at runtime. -export { ParserServices } from '@typescript-eslint/typescript-estree/dist/parser-options'; +export type { + ParserServices, + ParserServicesWithTypeInformation, + ParserServicesWithoutTypeInformation, +} from '@typescript-eslint/typescript-estree'; diff --git a/packages/website/src/components/linter/WebLinter.ts b/packages/website/src/components/linter/WebLinter.ts index acd3c569ff3..50c1daa2f7e 100644 --- a/packages/website/src/components/linter/WebLinter.ts +++ b/packages/website/src/components/linter/WebLinter.ts @@ -122,7 +122,6 @@ export class WebLinter { return { ast, services: { - hasFullTypeInformation: true, program, esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, From 3182b1c69d7ade914a0a02c55edcf91f1508f173 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 2 Dec 2022 12:44:25 +1030 Subject: [PATCH 2/7] fix docs test to handle naming-convention weirdness --- packages/eslint-plugin/tests/docs.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/eslint-plugin/tests/docs.test.ts b/packages/eslint-plugin/tests/docs.test.ts index e7872a962c9..6eb12fc3d54 100644 --- a/packages/eslint-plugin/tests/docs.test.ts +++ b/packages/eslint-plugin/tests/docs.test.ts @@ -119,6 +119,10 @@ describe('Validating rule docs', () => { }); describe('Validating rule metadata', () => { + const rulesThatRequireTypeInformationInAWayThatsHardToDetect = new Set([ + // the core rule file doesn't use type information, instead it's used in `src/rules/naming-convention-utils/validator.ts` + 'naming-convention', + ]); function requiresFullTypeInformation(content: string): boolean { return /getParserServices(\(\s*[^,\s)]+)\s*(,\s*false\s*)?\)/.test(content); } @@ -134,6 +138,13 @@ describe('Validating rule metadata', () => { }); it('`requiresTypeChecking` should be set if the rule uses type information', () => { + if ( + rulesThatRequireTypeInformationInAWayThatsHardToDetect.has(ruleName) + ) { + expect(true).toEqual(rule.meta.docs?.requiresTypeChecking ?? false); + return; + } + // quick-and-dirty check to see if it uses parserServices // not perfect but should be good enough const ruleFileContents = fs.readFileSync( From a9846589431b0acd7ca3ddf4301a59a33bfab832 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 15 Dec 2022 10:41:25 +1030 Subject: [PATCH 3/7] review comments --- .husky/pre-commit | 2 +- .../src/rules/consistent-type-exports.ts | 6 +---- packages/typescript-estree/src/parser.ts | 23 +++++++------------ .../src/eslint-utils/getParserServices.ts | 15 ++++++++---- 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index a3c91c55c26..025779ed2ba 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh . "$(dirname "$0")/_/husky.sh" yarn pre-commit diff --git a/packages/eslint-plugin/src/rules/consistent-type-exports.ts b/packages/eslint-plugin/src/rules/consistent-type-exports.ts index 3836525d9fa..bb9e0c36e4a 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-exports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -1,8 +1,4 @@ -import type { - ParserServices, - TSESLint, - TSESTree, -} from '@typescript-eslint/utils'; +import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import { SymbolFlags } from 'typescript'; diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 43cbb649319..415f8b2605c 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -270,21 +270,14 @@ function parseAndGenerateServices( */ return { ast: estree as AST, - services: - shouldProvideParserServices && program != null - ? { - program, - esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, - tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, - } - : { - program: null, - // we still return the node maps because - // (a) they don't require type info and - // (b) they can be useful when using some of TS's internal non-type-aware AST utils - esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, - tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, - }, + services: { + program: null, + // we still return the node maps because + // (a) they don't require type info and + // (b) they can be useful when using some of TS's internal non-type-aware AST utils + esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, + tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, + }, }; } diff --git a/packages/utils/src/eslint-utils/getParserServices.ts b/packages/utils/src/eslint-utils/getParserServices.ts index a16d81b77de..d0e6a9eb394 100644 --- a/packages/utils/src/eslint-utils/getParserServices.ts +++ b/packages/utils/src/eslint-utils/getParserServices.ts @@ -22,8 +22,16 @@ function getParserServices< context: Readonly>, allowWithoutFullTypeInformation: TAllowWithoutFullTypeInformation = false as TAllowWithoutFullTypeInformation, ): GetParserServicesResult { - // backwards compatibility check - // old versions of the parser would not return any parserServices unless parserOptions.project was set + // This check is unnecessary if the user is using the latest version of our parser. + // + // However the world isn't perfect: + // - Users often use old parser versions. + // Old versions of the parser would not return any parserServices unless parserOptions.project was set. + // - Users sometimes use parsers that aren't @typescript-eslint/parser + // Other parsers won't return the parser services we expect (if they return any at all). + // + // This check allows us to handle bad user setups whilst providing a nice user-facing + // error message explaining the problem. if ( context.parserServices == null || context.parserServices.esTreeNodeToTSNodeMap == null || @@ -41,8 +49,7 @@ function getParserServices< throw new Error(ERROR_MESSAGE); } - // @ts-expect-error - this is safe and correct, TS just doesn't like the assignment to the conditional type - return context.parserServices; + return context.parserServices as GetParserServicesResult; } export { getParserServices }; From 932fbc3da47164d2702cd8db3a54ef2a04c01fc2 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 15 Dec 2022 12:07:22 +1030 Subject: [PATCH 4/7] fuck --- packages/typescript-estree/src/parser.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 415f8b2605c..084e156fe47 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -271,8 +271,8 @@ function parseAndGenerateServices( return { ast: estree as AST, services: { - program: null, - // we still return the node maps because + program, + // we always return the node maps because // (a) they don't require type info and // (b) they can be useful when using some of TS's internal non-type-aware AST utils esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, From 2a804427b6cd9f7ccb4c18e49d0a8bcef628b99b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 15 Dec 2022 12:07:59 +1030 Subject: [PATCH 5/7] silence useless lint logs --- patches/eslint-plugin-deprecation+1.3.2.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 patches/eslint-plugin-deprecation+1.3.2.patch diff --git a/patches/eslint-plugin-deprecation+1.3.2.patch b/patches/eslint-plugin-deprecation+1.3.2.patch new file mode 100644 index 00000000000..03f09fece5f --- /dev/null +++ b/patches/eslint-plugin-deprecation+1.3.2.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/eslint-plugin-deprecation/dist/rules/deprecation.js b/node_modules/eslint-plugin-deprecation/dist/rules/deprecation.js +index cbb334d..dcbfa5d 100644 +--- a/node_modules/eslint-plugin-deprecation/dist/rules/deprecation.js ++++ b/node_modules/eslint-plugin-deprecation/dist/rules/deprecation.js +@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +-const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); ++const experimental_utils_1 = require("@typescript-eslint/utils"); + const tsutils_1 = require("tsutils"); + const ts = require("typescript"); + const stringifyJSDocTagInfoText_1 = require("../utils/stringifyJSDocTagInfoText"); From 54b0d80dbdc6a3ba7d8bbfefae7a812e9cb1fdd9 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 17 Dec 2022 20:24:48 -0500 Subject: [PATCH 6/7] feat(typescript-estree): add type checker wrapper APIs to ParserServicesWithTypeInformation --- docs/{Custom_Rules.md => Custom_Rules.mdx} | 35 +++++++++------ .../src/rules/no-poorly-typed-ts-props.ts | 10 ++--- .../src/rules/plugin-test-formatting.ts | 7 ++- .../eslint-plugin-tslint/src/rules/config.ts | 4 +- .../eslint-plugin/src/rules/await-thenable.ts | 18 ++++---- .../src/rules/consistent-type-exports.ts | 7 ++- .../eslint-plugin/src/rules/dot-notation.ts | 14 ++---- .../naming-convention-utils/validator.ts | 9 ++-- .../src/rules/no-base-to-string.ts | 27 +++++------- .../src/rules/no-confusing-void-expression.ts | 6 +-- .../src/rules/no-floating-promises.ts | 8 ++-- .../src/rules/no-for-in-array.ts | 10 ++--- .../src/rules/no-implied-eval.ts | 15 +++---- .../src/rules/no-meaningless-void-operator.ts | 9 ++-- .../src/rules/no-misused-promises.ts | 26 +++++------ .../rules/no-redundant-type-constituents.ts | 6 +-- .../src/rules/no-throw-literal.ts | 10 ++--- .../no-unnecessary-boolean-literal-compare.ts | 7 +-- .../src/rules/no-unnecessary-condition.ts | 43 ++++++++++--------- .../src/rules/no-unnecessary-qualifier.ts | 16 +++---- .../rules/no-unnecessary-type-arguments.ts | 9 ++-- .../rules/no-unnecessary-type-assertion.ts | 27 ++++++------ .../src/rules/no-unsafe-argument.ts | 20 +++------ .../src/rules/no-unsafe-assignment.ts | 32 ++++++-------- .../eslint-plugin/src/rules/no-unsafe-call.ts | 13 ++---- .../src/rules/no-unsafe-member-access.ts | 16 +++---- .../src/rules/no-unsafe-return.ts | 23 +++++----- .../non-nullable-type-assertion-style.ts | 7 +-- .../src/rules/prefer-includes.ts | 12 +++--- .../src/rules/prefer-nullish-coalescing.ts | 11 ++--- .../src/rules/prefer-optional-chain.ts | 6 +-- .../rules/prefer-readonly-parameter-types.ts | 7 ++- .../src/rules/prefer-readonly.ts | 22 +++++----- .../src/rules/prefer-reduce-type-parameter.ts | 9 ++-- .../src/rules/prefer-regexp-exec.ts | 20 +++------ .../src/rules/prefer-return-this-type.ts | 10 ++--- .../rules/prefer-string-starts-ends-with.ts | 10 ++--- .../src/rules/promise-function-async.ts | 9 ++-- .../src/rules/require-array-sort-compare.ts | 13 +++--- .../eslint-plugin/src/rules/require-await.ts | 13 +++--- .../src/rules/restrict-plus-operands.ts | 9 ++-- .../rules/restrict-template-expressions.ts | 15 +++---- .../eslint-plugin/src/rules/return-await.ts | 8 ++-- .../src/rules/strict-boolean-expressions.ts | 24 +++++------ .../src/rules/switch-exhaustiveness-check.ts | 20 ++++----- .../eslint-plugin/src/rules/unbound-method.ts | 19 +++----- .../src/getConstrainedTypeAtLocation.ts | 14 ++++-- packages/type-utils/src/getDeclaration.ts | 10 +++-- .../tests/isUnsafeAssignment.test.ts | 9 +--- .../src/createParserServices.ts | 27 ++++++++++++ .../typescript-estree/src/parser-options.ts | 2 + packages/typescript-estree/src/parser.ts | 22 ++++------ .../tests/lib/semanticInfo.test.ts | 18 ++++++-- 53 files changed, 354 insertions(+), 419 deletions(-) rename docs/{Custom_Rules.md => Custom_Rules.mdx} (88%) create mode 100644 packages/typescript-estree/src/createParserServices.ts diff --git a/docs/Custom_Rules.md b/docs/Custom_Rules.mdx similarity index 88% rename from docs/Custom_Rules.md rename to docs/Custom_Rules.mdx index 0590398b818..a635d93c989 100644 --- a/docs/Custom_Rules.md +++ b/docs/Custom_Rules.mdx @@ -210,17 +210,23 @@ Read TypeScript's [Compiler APIs > Using the Type Checker](https://github.com/mi The biggest addition typescript-eslint brings to ESLint rules is the ability to use TypeScript's type checker APIs. -`@typescript-eslint/utils` exports an `ESLintUtils` namespace containing a `getParserServices` function that takes in an ESLint context and returns a `parserServices` object. +`@typescript-eslint/utils` exports an `ESLintUtils` namespace containing a `getParserServices` function that takes in an ESLint context and returns a `services` object. -That `parserServices` object contains: +That `services` object contains: -- `program`: A full TypeScript `ts.Program` object +- `program`: A full TypeScript `ts.Program` object if type checking is enabled, or `null` otherwise - `esTreeNodeToTSNodeMap`: Map of `@typescript-eslint/estree` `TSESTree.Node` nodes to their TypeScript `ts.Node` equivalents - `tsNodeToESTreeNodeMap`: Map of TypeScript `ts.Node` nodes to their `@typescript-eslint/estree` `TSESTree.Node` equivalents -By mapping from ESTree nodes to TypeScript nodes and retrieving the TypeScript program from the parser services, rules are able to ask TypeScript for full type information on those nodes. +If type checking is enabled, that `services` object additionally contains: -This rule bans for-of looping over an enum by using the type-checker via typescript-eslint and TypeScript APIs: +- `getTypeAtLocation`: Wraps the type checker function, with a `TSESTree.Node` parameter instead of a `ts.Node` +- `getSymbolAtLocation`: Wraps the type checker function, with a `TSESTree.Node` parameter instead of a `ts.Node` + +Those additional objects internally map from ESTree nodes to their TypeScript equivalents, then call to the TypeScript program. +By using the TypeScript program from the parser services, rules are able to ask TypeScript for full type information on those nodes. + +This rule bans for-of looping over an enum by using the TypeScript type checker via typescript-eslint's services: ```ts import { ESLintUtils } from '@typescript-eslint/utils'; @@ -231,17 +237,13 @@ export const rule = createRule({ create(context) { return { ForOfStatement(node) { - // 1. Grab the TypeScript program from parser services - const parserServices = ESLintUtils.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + // 1. Grab the parser services for the rule + const services = ESLintUtils.getParserServices(context); - // 2. Find the backing TS node for the ES node, then that TS type - const originalNode = parserServices.esTreeNodeToTSNodeMap.get( - node.right, - ); - const nodeType = checker.getTypeAtLocation(originalNode); + // 2. Find the TS type for the ES node + const type = services.getTypeAtLocation(node); - // 3. Check the TS node type using the TypeScript APIs + // 3. Check the TS type using the TypeScript APIs if (tsutils.isTypeFlagSet(nodeType, ts.TypeFlags.EnumLike)) { context.report({ messageId: 'loopOverEnum', @@ -267,6 +269,11 @@ export const rule = createRule({ }); ``` +:::note +Rules can retrieve their full backing TypeScript type checker with `services.program.getTypeChecker()`. +This can be necessary for TypeScript APIs not wrapped by the parser services. +::: + ## Testing `@typescript-eslint/utils` exports a `RuleTester` with a similar API to the built-in [ESLint `RuleTester`](https://eslint.org/docs/developer-guide/nodejs-api#ruletester). diff --git a/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts b/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts index 0c671d8432f..a3b4a416021 100644 --- a/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts +++ b/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts @@ -51,9 +51,7 @@ export default createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); - const checker = program.getTypeChecker(); + const services = ESLintUtils.getParserServices(context); return { 'MemberExpression[computed = false]'( @@ -65,15 +63,13 @@ export default createRule({ } // make sure the type name matches - const tsObjectNode = esTreeNodeToTSNodeMap.get(node.object); - const objectType = checker.getTypeAtLocation(tsObjectNode); + const objectType = services.getTypeAtLocation(node.object); const objectSymbol = objectType.getSymbol(); if (objectSymbol?.getName() !== banned.type) { continue; } - const tsNode = esTreeNodeToTSNodeMap.get(node.property); - const symbol = checker.getSymbolAtLocation(tsNode); + const symbol = services.getSymbolAtLocation(node.property); const decls = symbol?.getDeclarations(); const isFromTs = decls?.some(decl => decl.getSourceFile().fileName.includes('/node_modules/typescript/'), diff --git a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index f86d4946836..4ab6909155b 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -148,9 +148,8 @@ export default createRule({ ], create(context, [{ formatWithPrettier }]) { const sourceCode = context.getSourceCode(); - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); - const checker = program.getTypeChecker(); + const services = ESLintUtils.getParserServices(context); + const checker = services.program.getTypeChecker(); const checkedObjects = new Set(); @@ -519,7 +518,7 @@ export default createRule({ const type = getContextualType( checker, - esTreeNodeToTSNodeMap.get(node), + services.esTreeNodeToTSNodeMap.get(node), ); if (!type) { return; diff --git a/packages/eslint-plugin-tslint/src/rules/config.ts b/packages/eslint-plugin-tslint/src/rules/config.ts index 97b77e7d080..77844d87932 100644 --- a/packages/eslint-plugin-tslint/src/rules/config.ts +++ b/packages/eslint-plugin-tslint/src/rules/config.ts @@ -104,8 +104,8 @@ export default createRule({ ) { const fileName = context.getFilename(); const sourceCode = context.getSourceCode().text; - const parserServices = ESLintUtils.getParserServices(context); - const program = parserServices.program; + const services = ESLintUtils.getParserServices(context); + const program = services.program; /** * Create an instance of TSLint diff --git a/packages/eslint-plugin/src/rules/await-thenable.ts b/packages/eslint-plugin/src/rules/await-thenable.ts index ab9f97da7c2..2e41aab2ea1 100644 --- a/packages/eslint-plugin/src/rules/await-thenable.ts +++ b/packages/eslint-plugin/src/rules/await-thenable.ts @@ -19,19 +19,19 @@ export default util.createRule({ defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); return { AwaitExpression(node): void { - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = checker.getTypeAtLocation(originalNode.expression); + const type = services.getTypeAtLocation(node.argument); + if (util.isTypeAnyType(type) || util.isTypeUnknownType(type)) { + return; + } + + const originalNode = services.esTreeNodeToTSNodeMap.get(node); - if ( - !util.isTypeAnyType(type) && - !util.isTypeUnknownType(type) && - !tsutils.isThenableType(checker, originalNode.expression, type) - ) { + if (!tsutils.isThenableType(checker, originalNode.expression, type)) { context.report({ messageId: 'await', node, diff --git a/packages/eslint-plugin/src/rules/consistent-type-exports.ts b/packages/eslint-plugin/src/rules/consistent-type-exports.ts index bb9e0c36e4a..576b59eac5d 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-exports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -69,7 +69,7 @@ export default util.createRule({ create(context, [{ fixMixedExportsWithInlineTypeSpecifier }]) { const sourceCode = context.getSourceCode(); const sourceExportsMap: { [key: string]: SourceExports } = {}; - const parserServices = util.getParserServices(context); + const services = util.getParserServices(context); /** * Helper for identifying if an export specifier resolves to a @@ -81,9 +81,8 @@ export default util.createRule({ function isSpecifierTypeBased( specifier: TSESTree.ExportSpecifier, ): boolean | undefined { - const checker = parserServices.program.getTypeChecker(); - const node = parserServices.esTreeNodeToTSNodeMap.get(specifier.exported); - const symbol = checker.getSymbolAtLocation(node); + const checker = services.program.getTypeChecker(); + const symbol = services.getSymbolAtLocation(specifier.exported); const aliasedSymbol = checker.getAliasedSymbol(symbol!); if (!aliasedSymbol || aliasedSymbol.escapedName === 'unknown') { diff --git a/packages/eslint-plugin/src/rules/dot-notation.ts b/packages/eslint-plugin/src/rules/dot-notation.ts index 9f0b0d1304b..b94f6bc68e6 100644 --- a/packages/eslint-plugin/src/rules/dot-notation.ts +++ b/packages/eslint-plugin/src/rules/dot-notation.ts @@ -67,9 +67,7 @@ export default createRule({ ], create(context, [options]) { const rules = baseRule.create(context); - - const { program, esTreeNodeToTSNodeMap } = getParserServices(context); - const typeChecker = program.getTypeChecker(); + const services = getParserServices(context); const allowPrivateClassPropertyAccess = options.allowPrivateClassPropertyAccess; @@ -78,7 +76,7 @@ export default createRule({ const allowIndexSignaturePropertyAccess = (options.allowIndexSignaturePropertyAccess ?? false) || tsutils.isCompilerOptionEnabled( - program.getCompilerOptions(), + services.program.getCompilerOptions(), // @ts-expect-error - TS is refining the type to never for some reason 'noPropertyAccessFromIndexSignature', ); @@ -92,9 +90,7 @@ export default createRule({ node.computed ) { // for perf reasons - only fetch symbols if we have to - const propertySymbol = typeChecker.getSymbolAtLocation( - esTreeNodeToTSNodeMap.get(node.property), - ); + const propertySymbol = services.getSymbolAtLocation(node.property); const modifierKind = getModifiers( propertySymbol?.getDeclarations()?.[0], )?.[0].kind; @@ -110,9 +106,7 @@ export default createRule({ propertySymbol === undefined && allowIndexSignaturePropertyAccess ) { - const objectType = typeChecker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(node.object), - ); + const objectType = services.getTypeAtLocation(node.object); const indexType = objectType .getNonNullableType() .getStringIndexType(); diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts index e96ff19e374..98ded63845d 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts @@ -435,11 +435,10 @@ function isCorrectType( return true; } - const { esTreeNodeToTSNodeMap, program } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const tsNode = esTreeNodeToTSNodeMap.get(node); - const type = checker - .getTypeAtLocation(tsNode) + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const type = services + .getTypeAtLocation(node) // remove null and undefined from the type, as we don't care about it here .getNonNullableType(); diff --git a/packages/eslint-plugin/src/rules/no-base-to-string.ts b/packages/eslint-plugin/src/rules/no-base-to-string.ts index e2eb948b271..eedb18b516e 100644 --- a/packages/eslint-plugin/src/rules/no-base-to-string.ts +++ b/packages/eslint-plugin/src/rules/no-base-to-string.ts @@ -52,8 +52,8 @@ export default util.createRule({ }, ], create(context, [option]) { - const parserServices = util.getParserServices(context); - const typeChecker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const ignoredTypeNames = option.ignoredTypeNames ?? []; function checkExpression(node: TSESTree.Expression, type?: ts.Type): void { @@ -62,10 +62,7 @@ export default util.createRule({ } const certainty = collectToStringCertainty( - type ?? - typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node), - ), + type ?? services.getTypeAtLocation(node), ); if (certainty === Usefulness.Always) { return; @@ -82,7 +79,7 @@ export default util.createRule({ } function collectToStringCertainty(type: ts.Type): Usefulness { - const toString = typeChecker.getPropertyOfType(type, 'toString'); + const toString = checker.getPropertyOfType(type, 'toString'); const declarations = toString?.getDeclarations(); if (!toString || !declarations || declarations.length === 0) { return Usefulness.Always; @@ -96,7 +93,7 @@ export default util.createRule({ return Usefulness.Always; } - if (ignoredTypeNames.includes(util.getTypeName(typeChecker, type))) { + if (ignoredTypeNames.includes(util.getTypeName(checker, type))) { return Usefulness.Always; } @@ -155,17 +152,13 @@ export default util.createRule({ 'AssignmentExpression[operator = "+="], BinaryExpression[operator = "+"]'( node: TSESTree.AssignmentExpression | TSESTree.BinaryExpression, ): void { - const leftType = typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node.left), - ); - const rightType = typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node.right), - ); - - if (util.getTypeName(typeChecker, leftType) === 'string') { + const leftType = services.getTypeAtLocation(node.left); + const rightType = services.getTypeAtLocation(node.right); + + if (util.getTypeName(checker, leftType) === 'string') { checkExpression(node.right, rightType); } else if ( - util.getTypeName(typeChecker, rightType) === 'string' && + util.getTypeName(checker, rightType) === 'string' && node.left.type !== AST_NODE_TYPES.PrivateIdentifier ) { checkExpression(node.left, leftType); diff --git a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts index 32cc048d6a5..a54bd46a80a 100644 --- a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts +++ b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts @@ -80,10 +80,8 @@ export default util.createRule({ | TSESTree.CallExpression | TSESTree.TaggedTemplateExpression, ): void { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = util.getConstrainedTypeAtLocation(checker, tsNode); + const services = util.getParserServices(context); + const type = util.getConstrainedTypeAtLocation(services, node); if (!tsutils.isTypeFlagSet(type, ts.TypeFlags.VoidLike)) { // not a void expression return; diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index 05f0954e305..2b0ff941cee 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -59,8 +59,8 @@ export default util.createRule({ ], create(context, [options]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); return { @@ -137,9 +137,7 @@ export default util.createRule({ } // Check the type. At this point it can't be unhandled if it isn't a promise - if ( - !isPromiseLike(checker, parserServices.esTreeNodeToTSNodeMap.get(node)) - ) { + if (!isPromiseLike(checker, services.esTreeNodeToTSNodeMap.get(node))) { return false; } diff --git a/packages/eslint-plugin/src/rules/no-for-in-array.ts b/packages/eslint-plugin/src/rules/no-for-in-array.ts index 34590d4e569..927939b8598 100644 --- a/packages/eslint-plugin/src/rules/no-for-in-array.ts +++ b/packages/eslint-plugin/src/rules/no-for-in-array.ts @@ -21,14 +21,10 @@ export default util.createRule({ create(context) { return { ForInStatement(node): void { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); - const type = util.getConstrainedTypeAtLocation( - checker, - originalNode.expression, - ); + const type = util.getConstrainedTypeAtLocation(services, node.right); if ( util.isTypeArrayTypeOrUnionOfArrayTypes(type, checker) || diff --git a/packages/eslint-plugin/src/rules/no-implied-eval.ts b/packages/eslint-plugin/src/rules/no-implied-eval.ts index 0ae6698c533..7ddac4ea7da 100644 --- a/packages/eslint-plugin/src/rules/no-implied-eval.ts +++ b/packages/eslint-plugin/src/rules/no-implied-eval.ts @@ -33,9 +33,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const program = parserServices.program; - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); function getCalleeName( node: TSESTree.LeftHandSideExpression, @@ -65,8 +64,7 @@ export default util.createRule({ } function isFunctionType(node: TSESTree.Node): boolean { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node); const symbol = type.getSymbol(); if ( @@ -83,7 +81,7 @@ export default util.createRule({ const declarations = symbol.getDeclarations() ?? []; for (const declaration of declarations) { const sourceFile = declaration.getSourceFile(); - if (program.isSourceFileDefaultLibrary(sourceFile)) { + if (services.program.isSourceFileDefaultLibrary(sourceFile)) { return true; } } @@ -140,14 +138,13 @@ export default util.createRule({ } if (calleeName === FUNCTION_CONSTRUCTOR) { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node.callee); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node.callee); const symbol = type.getSymbol(); if (symbol) { const declarations = symbol.getDeclarations() ?? []; for (const declaration of declarations) { const sourceFile = declaration.getSourceFile(); - if (program.isSourceFileDefaultLibrary(sourceFile)) { + if (services.program.isSourceFileDefaultLibrary(sourceFile)) { context.report({ node, messageId: 'noFunctionConstructor' }); return; } diff --git a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts index 79d0611e5d0..c585b13f785 100644 --- a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts +++ b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts @@ -47,8 +47,8 @@ export default util.createRule< defaultOptions: [{ checkNever: false }], create(context, [{ checkNever }]) { - const parserServices = ESLintUtils.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = ESLintUtils.getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); return { @@ -60,10 +60,7 @@ export default util.createRule< ]); }; - const argTsNode = parserServices.esTreeNodeToTSNodeMap.get( - node.argument, - ); - const argType = checker.getTypeAtLocation(argTsNode); + const argType = services.getTypeAtLocation(node.argument); const unionParts = tsutils.unionTypeParts(argType); if ( unionParts.every( diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index b6914ae2c39..9702bd814c7 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -120,8 +120,8 @@ export default util.createRule({ ], create(context, [{ checksConditionals, checksVoidReturn, checksSpreads }]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const checkedNodes = new Set(); @@ -200,7 +200,7 @@ export default util.createRule({ } return; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (isAlwaysThenable(checker, tsNode)) { context.report({ messageId: 'conditional', @@ -212,7 +212,7 @@ export default util.createRule({ function checkArguments( node: TSESTree.CallExpression | TSESTree.NewExpression, ): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); const voidArgs = voidFunctionArguments(checker, tsNode); if (voidArgs.size === 0) { return; @@ -223,7 +223,7 @@ export default util.createRule({ continue; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(argument); + const tsNode = services.esTreeNodeToTSNodeMap.get(argument); if (returnsThenable(checker, tsNode as ts.Expression)) { context.report({ messageId: 'voidReturnArgument', @@ -234,8 +234,8 @@ export default util.createRule({ } function checkAssignment(node: TSESTree.AssignmentExpression): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const varType = checker.getTypeAtLocation(tsNode.left); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); + const varType = services.getTypeAtLocation(node.left); if (!isVoidReturningFunctionType(checker, tsNode.left, varType)) { return; } @@ -249,11 +249,11 @@ export default util.createRule({ } function checkVariableDeclaration(node: TSESTree.VariableDeclarator): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (tsNode.initializer === undefined || node.init === null) { return; } - const varType = checker.getTypeAtLocation(tsNode.name); + const varType = services.getTypeAtLocation(node.id); if (!isVoidReturningFunctionType(checker, tsNode.initializer, varType)) { return; } @@ -267,7 +267,7 @@ export default util.createRule({ } function checkProperty(node: TSESTree.Property): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (ts.isPropertyAssignment(tsNode)) { const contextualType = checker.getContextualType(tsNode.initializer); if ( @@ -343,7 +343,7 @@ export default util.createRule({ } function checkReturnStatement(node: TSESTree.ReturnStatement): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (tsNode.expression === undefined || node.argument === null) { return; } @@ -365,7 +365,7 @@ export default util.createRule({ } function checkJSXAttribute(node: TSESTree.JSXAttribute): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); const value = tsNode.initializer; if ( node.value === null || @@ -389,7 +389,7 @@ export default util.createRule({ } function checkSpread(node: TSESTree.SpreadElement): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (isSometimesThenable(checker, tsNode.expression)) { context.report({ diff --git a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts index 0055c5fe3f6..db015edc839 100644 --- a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts +++ b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts @@ -192,7 +192,7 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); + const services = util.getParserServices(context); const typesCache = new Map(); function getTypeNodeTypePartFlags( @@ -228,9 +228,7 @@ export default util.createRule({ return typeNode.types.flatMap(getTypeNodeTypePartFlags); } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(typeNode); - const checker = parserServices.program.getTypeChecker(); - const nodeType = checker.getTypeAtLocation(tsNode); + const nodeType = services.getTypeAtLocation(typeNode); const typeParts = unionTypePartsUnlessBoolean(nodeType); return typeParts.map(typePart => ({ diff --git a/packages/eslint-plugin/src/rules/no-throw-literal.ts b/packages/eslint-plugin/src/rules/no-throw-literal.ts index 9f79ea0ff47..55145507d65 100644 --- a/packages/eslint-plugin/src/rules/no-throw-literal.ts +++ b/packages/eslint-plugin/src/rules/no-throw-literal.ts @@ -49,9 +49,8 @@ export default util.createRule({ }, ], create(context, [options]) { - const parserServices = util.getParserServices(context); - const program = parserServices.program; - const checker = program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); function isErrorLike(type: ts.Type): boolean { if (type.isIntersection()) { @@ -70,7 +69,7 @@ export default util.createRule({ const declarations = symbol.getDeclarations() ?? []; for (const declaration of declarations) { const sourceFile = declaration.getSourceFile(); - if (program.isSourceFileDefaultLibrary(sourceFile)) { + if (services.program.isSourceFileDefaultLibrary(sourceFile)) { return true; } } @@ -95,8 +94,7 @@ export default util.createRule({ return; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node); if (type.flags & ts.TypeFlags.Undefined) { context.report({ node, messageId: 'undef' }); diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts b/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts index f874905b738..97b05a210ac 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts @@ -80,8 +80,7 @@ export default util.createRule({ }, ], create(context, [options]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); function getBooleanComparison( node: TSESTree.BinaryExpression, @@ -91,9 +90,7 @@ export default util.createRule({ return undefined; } - const expressionType = checker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(comparison.expression), - ); + const expressionType = services.getTypeAtLocation(comparison.expression); if (isBooleanType(expressionType)) { return { diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index 030ed4fe188..625d606a917 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -146,10 +146,10 @@ export default createRule({ }, ], ) { - const service = getParserServices(context); - const checker = service.program.getTypeChecker(); + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); - const compilerOptions = service.program.getCompilerOptions(); + const compilerOptions = services.program.getCompilerOptions(); const isStrictNullChecks = isStrictCompilerOptionEnabled( compilerOptions, 'strictNullChecks', @@ -168,17 +168,12 @@ export default createRule({ }); } - function getNodeType(node: TSESTree.Node): ts.Type { - const tsNode = service.esTreeNodeToTSNodeMap.get(node); - return getConstrainedTypeAtLocation(checker, tsNode); - } - function nodeIsArrayType(node: TSESTree.Expression): boolean { - const nodeType = getNodeType(node); + const nodeType = getConstrainedTypeAtLocation(services, node); return checker.isArrayType(nodeType); } function nodeIsTupleType(node: TSESTree.Expression): boolean { - const nodeType = getNodeType(node); + const nodeType = getConstrainedTypeAtLocation(services, node); return checker.isTupleType(nodeType); } @@ -232,7 +227,7 @@ export default createRule({ return checkNode(node.right); } - const type = getNodeType(node); + const type = getConstrainedTypeAtLocation(services, node); // Conditional is always necessary if it involves: // `any` or `unknown` or a naked type parameter @@ -262,7 +257,7 @@ export default createRule({ } function checkNodeForNullish(node: TSESTree.Expression): void { - const type = getNodeType(node); + const type = getConstrainedTypeAtLocation(services, node); // Conditional is always necessary if it involves `any` or `unknown` if (isTypeAnyType(type) || isTypeUnknownType(type)) { return; @@ -320,8 +315,8 @@ export default createRule({ if (!BOOL_OPERATORS.has(node.operator)) { return; } - const leftType = getNodeType(node.left); - const rightType = getNodeType(node.right); + const leftType = getConstrainedTypeAtLocation(services, node.left); + const rightType = getConstrainedTypeAtLocation(services, node.right); if (isLiteral(leftType) && isLiteral(rightType)) { context.report({ node, messageId: 'literalBooleanExpression' }); return; @@ -397,7 +392,10 @@ export default createRule({ */ if ( allowConstantLoopConditions && - isBooleanLiteralType(getNodeType(node.test), true) + isBooleanLiteralType( + getConstrainedTypeAtLocation(services, node.test), + true, + ) ) { return; } @@ -451,9 +449,9 @@ export default createRule({ // (Value to complexity ratio is dubious however) } // Otherwise just do type analysis on the function as a whole. - const returnTypes = getCallSignaturesOfType(getNodeType(callback)).map( - sig => sig.getReturnType(), - ); + const returnTypes = getCallSignaturesOfType( + getConstrainedTypeAtLocation(services, callback), + ).map(sig => sig.getReturnType()); /* istanbul ignore if */ if (returnTypes.length === 0) { // Not a callable function return; @@ -541,12 +539,15 @@ export default createRule({ function isNullableOriginFromPrev( node: TSESTree.MemberExpression, ): boolean { - const prevType = getNodeType(node.object); + const prevType = getConstrainedTypeAtLocation(services, node.object); const property = node.property; if (prevType.isUnion() && isIdentifier(property)) { const isOwnNullable = prevType.types.some(type => { if (node.computed) { - const propertyType = getNodeType(node.property); + const propertyType = getConstrainedTypeAtLocation( + services, + node.property, + ); return isNullablePropertyType(type, propertyType); } const propType = getTypeOfPropertyOfName( @@ -571,7 +572,7 @@ export default createRule({ function isOptionableExpression( node: TSESTree.LeftHandSideExpression, ): boolean { - const type = getNodeType(node); + const type = getConstrainedTypeAtLocation(services, node); const isOwnNullable = node.type === AST_NODE_TYPES.MemberExpression ? !isNullableOriginFromPrev(node) diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index fbf3b41e966..d7958aa2c33 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -25,10 +25,9 @@ export default util.createRule({ create(context) { const namespacesInScope: ts.Node[] = []; let currentFailedNamespaceExpression: TSESTree.Node | null = null; - const parserServices = util.getParserServices(context); - const esTreeNodeToTSNodeMap = parserServices.esTreeNodeToTSNodeMap; - const program = parserServices.program; - const checker = program.getTypeChecker(); + const services = util.getParserServices(context); + const esTreeNodeToTSNodeMap = services.esTreeNodeToTSNodeMap; + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); function tryGetAliasedSymbol( @@ -61,7 +60,6 @@ export default util.createRule({ flags: ts.SymbolFlags, name: string, ): ts.Symbol | undefined { - // TODO:PERF `getSymbolsInScope` gets a long list. Is there a better way? const scope = checker.getSymbolsInScope(node, flags); return scope.find(scopeSymbol => scopeSymbol.name === name); @@ -75,10 +73,7 @@ export default util.createRule({ qualifier: TSESTree.EntityName | TSESTree.MemberExpression, name: TSESTree.Identifier, ): boolean { - const tsQualifier = esTreeNodeToTSNodeMap.get(qualifier); - const tsName = esTreeNodeToTSNodeMap.get(name); - - const namespaceSymbol = checker.getSymbolAtLocation(tsQualifier); + const namespaceSymbol = services.getSymbolAtLocation(qualifier); if ( typeof namespaceSymbol === 'undefined' || @@ -87,13 +82,14 @@ export default util.createRule({ return false; } - const accessedSymbol = checker.getSymbolAtLocation(tsName); + const accessedSymbol = services.getSymbolAtLocation(name); if (typeof accessedSymbol === 'undefined') { return false; } // If the symbol in scope is different, the qualifier is necessary. + const tsQualifier = esTreeNodeToTSNodeMap.get(qualifier); const fromScope = getSymbolInScope( tsQualifier, accessedSymbol.flags, diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index 6d300b36fe1..1860e26a8bd 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -36,8 +36,8 @@ export default util.createRule<[], MessageIds>({ }, defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); function getTypeForComparison(type: ts.Type): { type: ts.Type; @@ -69,8 +69,7 @@ export default util.createRule<[], MessageIds>({ // TODO: would like checker.areTypesEquivalent. https://github.com/Microsoft/TypeScript/issues/13502 const defaultType = checker.getTypeAtLocation(param.default); - const argTsNode = parserServices.esTreeNodeToTSNodeMap.get(arg); - const argType = checker.getTypeAtLocation(argTsNode); + const argType = services.getTypeAtLocation(arg); // this check should handle some of the most simple cases of like strings, numbers, etc if (defaultType !== argType) { // For more complex types (like aliases to generic object types) - TS won't always create a @@ -106,7 +105,7 @@ export default util.createRule<[], MessageIds>({ return { TSTypeParameterInstantiation(node): void { - const expression = parserServices.esTreeNodeToTSNodeMap.get(node); + const expression = services.esTreeNodeToTSNodeMap.get(node); const typeParameters = getTypeParametersFromNode(expression, checker); if (typeParameters) { diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts index 38248f31123..87ef3b9ba42 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts @@ -53,9 +53,9 @@ export default util.createRule({ defaultOptions: [{}], create(context, [options]) { const sourceCode = context.getSourceCode(); - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); - const compilerOptions = parserServices.program.getCompilerOptions(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); /** * Sometimes tuple types don't have ObjectFlags.Tuple set, like when they're being matched against an inferred type. @@ -91,8 +91,8 @@ export default util.createRule({ /** * Returns true if there's a chance the variable has been used before a value has been assigned to it */ - function isPossiblyUsedBeforeAssigned(node: ts.Expression): boolean { - const declaration = util.getDeclaration(checker, node); + function isPossiblyUsedBeforeAssigned(node: TSESTree.Expression): boolean { + const declaration = util.getDeclaration(services, node); if (!declaration) { // don't know what the declaration is for some reason, so just assume the worst return true; @@ -111,7 +111,7 @@ export default util.createRule({ ) { // check if the defined variable type has changed since assignment const declarationType = checker.getTypeFromTypeNode(declaration.type); - const type = util.getConstrainedTypeAtLocation(checker, node); + const type = util.getConstrainedTypeAtLocation(services, node); if (declarationType === type) { // possibly used before assigned, so just skip it // better to false negative and skip it, than false positive and fix to compile erroring code @@ -157,15 +157,15 @@ export default util.createRule({ return; } - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const originalNode = services.esTreeNodeToTSNodeMap.get(node); const type = util.getConstrainedTypeAtLocation( - checker, - originalNode.expression, + services, + node.expression, ); if (!util.isNullableType(type)) { - if (isPossiblyUsedBeforeAssigned(originalNode.expression)) { + if (isPossiblyUsedBeforeAssigned(node.expression)) { return; } @@ -241,8 +241,7 @@ export default util.createRule({ return; } - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const castType = checker.getTypeAtLocation(originalNode); + const castType = services.getTypeAtLocation(node); if ( isTypeFlagSet(castType, ts.TypeFlags.Literal) || @@ -255,14 +254,14 @@ export default util.createRule({ return; } - const uncastType = checker.getTypeAtLocation(originalNode.expression); + const uncastType = services.getTypeAtLocation(node.expression); if (uncastType === castType) { context.report({ node, messageId: 'unnecessaryAssertion', fix(fixer) { - if (originalNode.kind === ts.SyntaxKind.TypeAssertionExpression) { + if (node.type === AST_NODE_TYPES.TSTypeAssertion) { const closingAngleBracket = sourceCode.getTokenAfter( node.typeAnnotation, ); diff --git a/packages/eslint-plugin/src/rules/no-unsafe-argument.ts b/packages/eslint-plugin/src/rules/no-unsafe-argument.ts index b5aced4d68c..76fe8652966 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-argument.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-argument.ts @@ -152,8 +152,8 @@ export default util.createRule<[], MessageIds>({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); return { 'CallExpression, NewExpression'( @@ -164,15 +164,11 @@ export default util.createRule<[], MessageIds>({ } // ignore any-typed calls as these are caught by no-unsafe-call - if ( - util.isTypeAnyType( - checker.getTypeAtLocation(esTreeNodeToTSNodeMap.get(node.callee)), - ) - ) { + if (util.isTypeAnyType(services.getTypeAtLocation(node.callee))) { return; } - const tsNode = esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); const signature = FunctionSignature.create(checker, tsNode); if (!signature) { return; @@ -182,8 +178,8 @@ export default util.createRule<[], MessageIds>({ switch (argument.type) { // spreads consume case AST_NODE_TYPES.SpreadElement: { - const spreadArgType = checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(argument.argument), + const spreadArgType = services.getTypeAtLocation( + argument.argument, ); if (util.isTypeAnyType(spreadArgType)) { @@ -247,9 +243,7 @@ export default util.createRule<[], MessageIds>({ continue; } - const argumentType = checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(argument), - ); + const argumentType = services.getTypeAtLocation(argument); const result = util.isUnsafeAssignment( argumentType, parameterType, diff --git a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts index 4833d84a84c..01cd90b20b8 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts @@ -42,9 +42,9 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const compilerOptions = program.getCompilerOptions(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'noImplicitThis', @@ -59,8 +59,8 @@ export default util.createRule({ return false; } - const senderTsNode = esTreeNodeToTSNodeMap.get(senderNode); - const senderType = checker.getTypeAtLocation(senderTsNode); + const senderTsNode = services.esTreeNodeToTSNodeMap.get(senderNode); + const senderType = services.getTypeAtLocation(senderNode); return checkArrayDestructure(receiverNode, senderType, senderTsNode); } @@ -145,8 +145,8 @@ export default util.createRule({ return false; } - const senderTsNode = esTreeNodeToTSNodeMap.get(senderNode); - const senderType = checker.getTypeAtLocation(senderTsNode); + const senderTsNode = services.esTreeNodeToTSNodeMap.get(senderNode); + const senderType = services.getTypeAtLocation(senderNode); return checkObjectDestructure(receiverNode, senderType, senderTsNode); } @@ -232,15 +232,13 @@ export default util.createRule({ reportingNode: TSESTree.Node, comparisonType: ComparisonType, ): boolean { - const receiverTsNode = esTreeNodeToTSNodeMap.get(receiverNode); + const receiverTsNode = services.esTreeNodeToTSNodeMap.get(receiverNode); const receiverType = comparisonType === ComparisonType.Contextual ? util.getContextualType(checker, receiverTsNode as ts.Expression) ?? - checker.getTypeAtLocation(receiverTsNode) - : checker.getTypeAtLocation(receiverTsNode); - const senderType = checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(senderNode), - ); + services.getTypeAtLocation(receiverNode) + : services.getTypeAtLocation(receiverNode); + const senderType = services.getTypeAtLocation(senderNode); if (util.isTypeAnyType(senderType)) { // handle cases when we assign any ==> unknown. @@ -256,10 +254,7 @@ export default util.createRule({ if ( thisExpression && util.isTypeAnyType( - util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(thisExpression), - ), + util.getConstrainedTypeAtLocation(services, thisExpression), ) ) { messageId = 'anyAssignmentThis'; @@ -372,8 +367,7 @@ export default util.createRule({ checkAssignment(node.key, node.value, node, ComparisonType.Contextual); }, 'ArrayExpression > SpreadElement'(node: TSESTree.SpreadElement): void { - const resetNode = esTreeNodeToTSNodeMap.get(node.argument); - const restType = checker.getTypeAtLocation(resetNode); + const restType = services.getTypeAtLocation(node.argument); if ( util.isTypeAnyType(restType) || util.isTypeAnyArrayType(restType, checker) diff --git a/packages/eslint-plugin/src/rules/no-unsafe-call.ts b/packages/eslint-plugin/src/rules/no-unsafe-call.ts index dfa6fa2fb4c..216339d26b0 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-call.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-call.ts @@ -32,9 +32,8 @@ export default util.createRule<[], MessageIds>({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const compilerOptions = program.getCompilerOptions(); + const services = util.getParserServices(context); + const compilerOptions = services.program.getCompilerOptions(); const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'noImplicitThis', @@ -45,8 +44,7 @@ export default util.createRule<[], MessageIds>({ reportingNode: TSESTree.Node, messageId: MessageIds, ): void { - const tsNode = esTreeNodeToTSNodeMap.get(node); - const type = util.getConstrainedTypeAtLocation(checker, tsNode); + const type = util.getConstrainedTypeAtLocation(services, node); if (util.isTypeAnyType(type)) { if (!isNoImplicitThis) { @@ -55,10 +53,7 @@ export default util.createRule<[], MessageIds>({ if ( thisExpression && util.isTypeAnyType( - util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(thisExpression), - ), + util.getConstrainedTypeAtLocation(services, thisExpression), ) ) { messageId = 'unsafeCallThis'; diff --git a/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts b/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts index 410ff78f545..a0858af39e4 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts @@ -33,9 +33,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const compilerOptions = program.getCompilerOptions(); + const services = util.getParserServices(context); + const compilerOptions = services.program.getCompilerOptions(); const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'noImplicitThis', @@ -60,8 +59,7 @@ export default util.createRule({ } } - const tsNode = esTreeNodeToTSNodeMap.get(node.object); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node.object); const state = util.isTypeAnyType(type) ? State.Unsafe : State.Safe; stateCache.set(node, state); @@ -78,10 +76,7 @@ export default util.createRule({ if ( thisExpression && util.isTypeAnyType( - util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(thisExpression), - ), + util.getConstrainedTypeAtLocation(services, thisExpression), ) ) { messageId = 'unsafeThisMemberExpression'; @@ -119,8 +114,7 @@ export default util.createRule({ return; } - const tsNode = esTreeNodeToTSNodeMap.get(node); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node); if (util.isTypeAnyType(type)) { const propertyName = sourceCode.getText(node); diff --git a/packages/eslint-plugin/src/rules/no-unsafe-return.ts b/packages/eslint-plugin/src/rules/no-unsafe-return.ts index 63d60ff81f8..7843f25ffa1 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-return.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-return.ts @@ -27,9 +27,9 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const compilerOptions = program.getCompilerOptions(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'noImplicitThis', @@ -64,7 +64,7 @@ export default util.createRule({ returnNode: TSESTree.Node, reportingNode: TSESTree.Node = returnNode, ): void { - const tsNode = esTreeNodeToTSNodeMap.get(returnNode); + const tsNode = services.esTreeNodeToTSNodeMap.get(returnNode); const anyType = util.isAnyOrAnyArrayTypeDiscriminated(tsNode, checker); const functionNode = getParentFunctionNode(returnNode); /* istanbul ignore if */ if (!functionNode) { @@ -73,10 +73,10 @@ export default util.createRule({ // function has an explicit return type, so ensure it's a safe return const returnNodeType = util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(returnNode), + services, + returnNode, ); - const functionTSNode = esTreeNodeToTSNodeMap.get(functionNode); + const functionTSNode = services.esTreeNodeToTSNodeMap.get(functionNode); // function expressions will not have their return type modified based on receiver typing // so we have to use the contextual typing in these cases, i.e. @@ -84,9 +84,9 @@ export default util.createRule({ // the return type of the arrow function is Set even though the variable is typed as Set let functionType = tsutils.isExpression(functionTSNode) ? util.getContextualType(checker, functionTSNode) - : checker.getTypeAtLocation(functionTSNode); + : services.getTypeAtLocation(functionNode); if (!functionType) { - functionType = checker.getTypeAtLocation(functionTSNode); + functionType = services.getTypeAtLocation(functionNode); } // If there is an explicit type annotation *and* that type matches the actual @@ -126,10 +126,7 @@ export default util.createRule({ if ( thisExpression && util.isTypeAnyType( - util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(thisExpression), - ), + util.getConstrainedTypeAtLocation(services, thisExpression), ) ) { messageId = 'unsafeReturnThis'; diff --git a/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts b/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts index 4953cf8041e..b42a1c06d40 100644 --- a/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts +++ b/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts @@ -24,14 +24,11 @@ export default util.createRule({ defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); const sourceCode = context.getSourceCode(); const getTypesIfNotLoose = (node: TSESTree.Node): ts.Type[] | undefined => { - const type = checker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node), - ); + const type = services.getTypeAtLocation(node); if ( tsutils.isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.Unknown) diff --git a/packages/eslint-plugin/src/rules/prefer-includes.ts b/packages/eslint-plugin/src/rules/prefer-includes.ts index 9c50ce118f8..47b008b7fc4 100644 --- a/packages/eslint-plugin/src/rules/prefer-includes.ts +++ b/packages/eslint-plugin/src/rules/prefer-includes.ts @@ -34,7 +34,7 @@ export default createRule({ create(context) { const globalScope = context.getScope(); const services = getParserServices(context); - const types = services.program.getTypeChecker(); + const checker = services.program.getTypeChecker(); function isNumber(node: TSESTree.Node, value: number): boolean { const evaluated = getStaticValue(node, globalScope); @@ -141,9 +141,8 @@ export default createRule({ } // Get the symbol of `indexOf` method. - const tsNode = services.esTreeNodeToTSNodeMap.get(node.property); - const indexofMethodDeclarations = types - .getSymbolAtLocation(tsNode) + const indexofMethodDeclarations = services + .getSymbolAtLocation(node.property) ?.getDeclarations(); if ( indexofMethodDeclarations == null || @@ -156,7 +155,7 @@ export default createRule({ // and the two methods have the same parameters. for (const instanceofMethodDecl of indexofMethodDeclarations) { const typeDecl = instanceofMethodDecl.parent; - const type = types.getTypeAtLocation(typeDecl); + const type = checker.getTypeAtLocation(typeDecl); const includesMethodDecl = type .getProperty('includes') ?.getDeclarations(); @@ -214,8 +213,7 @@ export default createRule({ //check the argument type of test methods const argument = callNode.arguments[0]; - const tsNode = services.esTreeNodeToTSNodeMap.get(argument); - const type = getConstrainedTypeAtLocation(types, tsNode); + const type = getConstrainedTypeAtLocation(services, argument); const includesMethodDecl = type .getProperty('includes') diff --git a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts index 2becee5ea02..28ec95e5a73 100644 --- a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts +++ b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts @@ -80,10 +80,9 @@ export default util.createRule({ }, ], ) { - const parserServices = util.getParserServices(context); - const compilerOptions = parserServices.program.getCompilerOptions(); + const services = util.getParserServices(context); + const compilerOptions = services.program.getCompilerOptions(); const sourceCode = context.getSourceCode(); - const checker = parserServices.program.getTypeChecker(); const isStrictNullChecks = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'strictNullChecks', @@ -107,8 +106,7 @@ export default util.createRule({ description: string, equals: string, ): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = checker.getTypeAtLocation(tsNode.left); + const type = services.getTypeAtLocation(node.left); const isNullish = util.isNullableType(type, { allowUndefined: true }); if (!isNullish) { return; @@ -278,8 +276,7 @@ export default util.createRule({ return true; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(identifier); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(identifier); const flags = util.getTypeFlags(type); if (flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) { diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index 95295fc4d1b..cc5d2b01067 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -50,7 +50,7 @@ export default util.createRule({ defaultOptions: [], create(context) { const sourceCode = context.getSourceCode(); - const parserServices = util.getParserServices(context, true); + const services = util.getParserServices(context, true); return { 'LogicalExpression[operator="||"], LogicalExpression[operator="??"]'( @@ -72,9 +72,9 @@ export default util.createRule({ } function isLeftSideLowerPrecedence(): boolean { - const logicalTsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const logicalTsNode = services.esTreeNodeToTSNodeMap.get(node); - const leftTsNode = parserServices.esTreeNodeToTSNodeMap.get(leftNode); + const leftTsNode = services.esTreeNodeToTSNodeMap.get(leftNode); const operator = isBinaryExpression(logicalTsNode) ? logicalTsNode.operatorToken.kind : ts.SyntaxKind.Unknown; diff --git a/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts b/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts index 4ba01de52b2..02e249a5f7b 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts @@ -51,8 +51,8 @@ export default util.createRule({ context, [{ checkParameterProperties, ignoreInferredTypes, treatMethodsAsReadonly }], ) { - const { esTreeNodeToTSNodeMap, program } = util.getParserServices(context); - const checker = program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); return { [[ @@ -94,8 +94,7 @@ export default util.createRule({ continue; } - const tsNode = esTreeNodeToTSNodeMap.get(actualParam); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(actualParam); const isReadOnly = util.isTypeReadonly(checker, type, { treatMethodsAsReadonly: treatMethodsAsReadonly!, }); diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 3a9e6cdca66..64d6adb5e89 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -49,8 +49,8 @@ export default util.createRule({ }, defaultOptions: [{ onlyInlineLambdas: false }], create(context, [{ onlyInlineLambdas }]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const classScopeStack: ClassScope[] = []; function handlePropertyAccessExpression( @@ -146,7 +146,7 @@ export default util.createRule({ return false; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (ts.isConstructorDeclaration(tsNode)) { return false; } @@ -161,16 +161,14 @@ export default util.createRule({ ts.isParameterPropertyDeclaration(violatingNode, violatingNode.parent) ) { return { - esNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode.name), - nameNode: parserServices.tsNodeToESTreeNodeMap.get( - violatingNode.name, - ), + esNode: services.tsNodeToESTreeNodeMap.get(violatingNode.name), + nameNode: services.tsNodeToESTreeNodeMap.get(violatingNode.name), }; } return { - esNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode), - nameNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode.name), + esNode: services.tsNodeToESTreeNodeMap.get(violatingNode), + nameNode: services.tsNodeToESTreeNodeMap.get(violatingNode.name), }; } @@ -181,7 +179,7 @@ export default util.createRule({ classScopeStack.push( new ClassScope( checker, - parserServices.esTreeNodeToTSNodeMap.get(node), + services.esTreeNodeToTSNodeMap.get(node), onlyInlineLambdas, ), ); @@ -205,7 +203,7 @@ export default util.createRule({ }, MemberExpression(node): void { if (classScopeStack.length !== 0 && !node.computed) { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get( + const tsNode = services.esTreeNodeToTSNodeMap.get( node, ) as ts.PropertyAccessExpression; handlePropertyAccessExpression( @@ -224,7 +222,7 @@ export default util.createRule({ ): void { if (ASTUtils.isConstructor(node)) { classScopeStack[classScopeStack.length - 1].enterConstructor( - parserServices.esTreeNodeToTSNodeMap.get(node), + services.esTreeNodeToTSNodeMap.get(node), ); } else if (isFunctionScopeBoundaryInStack(node)) { classScopeStack[classScopeStack.length - 1].enterNonConstructor(); diff --git a/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts b/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts index 7d27a014653..874455d5d9e 100644 --- a/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts +++ b/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts @@ -43,8 +43,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const service = util.getParserServices(context); - const checker = service.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); return { 'CallExpression > MemberExpression.callee'( @@ -64,10 +64,9 @@ export default util.createRule({ } // Get the symbol of the `reduce` method. - const tsNode = service.esTreeNodeToTSNodeMap.get(callee.object); const calleeObjType = util.getConstrainedTypeAtLocation( - checker, - tsNode, + services, + callee.object, ); // Check the owner type of the `reduce` method. diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index 13452d48f86..148975a1bc0 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -39,8 +39,8 @@ export default createRule({ create(context) { const globalScope = context.getScope(); - const parserServices = getParserServices(context); - const typeChecker = parserServices.program.getTypeChecker(); + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); /** @@ -48,7 +48,7 @@ export default createRule({ * @param node The node type to check. */ function isStringType(type: ts.Type): boolean { - return getTypeName(typeChecker, type) === 'string'; + return getTypeName(checker, type) === 'string'; } /** @@ -56,7 +56,7 @@ export default createRule({ * @param node The node type to check. */ function isRegExpType(type: ts.Type): boolean { - return getTypeName(typeChecker, type) === 'RegExp'; + return getTypeName(checker, type) === 'RegExp'; } function collectArgumentTypes(types: ts.Type[]): ArgumentType { @@ -101,13 +101,7 @@ export default createRule({ const [argumentNode] = callNode.arguments; const argumentValue = getStaticValue(argumentNode, globalScope); - if ( - !isStringType( - typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(objectNode), - ), - ) - ) { + if (!isStringType(services.getTypeAtLocation(objectNode))) { return; } @@ -138,9 +132,7 @@ export default createRule({ }); } - const argumentType = typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(argumentNode), - ); + const argumentType = services.getTypeAtLocation(argumentNode); const argumentTypes = collectArgumentTypes( tsutils.unionTypeParts(argumentType), ); diff --git a/packages/eslint-plugin/src/rules/prefer-return-this-type.ts b/packages/eslint-plugin/src/rules/prefer-return-this-type.ts index b6ea9d465bd..b0ae1acd8ff 100644 --- a/packages/eslint-plugin/src/rules/prefer-return-this-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-return-this-type.ts @@ -32,8 +32,8 @@ export default createRule({ }, create(context) { - const parserServices = getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); function tryGetNameInType( name: string, @@ -76,14 +76,14 @@ export default createRule({ return false; } - const func = parserServices.esTreeNodeToTSNodeMap.get(originalFunc); + const func = services.esTreeNodeToTSNodeMap.get(originalFunc); if (!func.body) { return false; } - const classType = checker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(originalClass), + const classType = services.getTypeAtLocation( + originalClass, ) as ts.InterfaceType; if (func.body.kind !== ts.SyntaxKind.Block) { diff --git a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts index f0949acd16c..480a99b57e9 100644 --- a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts +++ b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts @@ -40,18 +40,16 @@ export default createRule({ create(context) { const globalScope = context.getScope(); const sourceCode = context.getSourceCode(); - const service = getParserServices(context); - const typeChecker = service.program.getTypeChecker(); + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); /** * Check if a given node is a string. * @param node The node to check. */ function isStringType(node: TSESTree.LeftHandSideExpression): boolean { - const objectType = typeChecker.getTypeAtLocation( - service.esTreeNodeToTSNodeMap.get(node), - ); - return getTypeName(typeChecker, objectType) === 'string'; + const objectType = services.getTypeAtLocation(node); + return getTypeName(checker, objectType) === 'string'; } /** diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 81765bc18b8..4d708f1f2cd 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -91,8 +91,8 @@ export default util.createRule({ 'Promise', ...allowedPromiseNames!, ]); - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); function validateNode( @@ -101,10 +101,7 @@ export default util.createRule({ | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, ): void { - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const signatures = checker - .getTypeAtLocation(originalNode) - .getCallSignatures(); + const signatures = services.getTypeAtLocation(node).getCallSignatures(); if (!signatures.length) { return; } diff --git a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts index b7b57e46705..3889b5d59dd 100644 --- a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts +++ b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts @@ -43,17 +43,15 @@ export default util.createRule({ }, create(context, [options]) { - const service = util.getParserServices(context); - const checker = service.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); /** * Check if a given node is an array which all elements are string. * @param node */ function isStringArrayNode(node: TSESTree.LeftHandSideExpression): boolean { - const type = checker.getTypeAtLocation( - service.esTreeNodeToTSNodeMap.get(node), - ); + const type = services.getTypeAtLocation(node); if (checker.isArrayType(type) || checker.isTupleType(type)) { const typeArgs = checker.getTypeArguments(type); return typeArgs.every( @@ -67,10 +65,9 @@ export default util.createRule({ "CallExpression[arguments.length=0] > MemberExpression[property.name='sort'][computed=false]"( callee: TSESTree.MemberExpression, ): void { - const tsNode = service.esTreeNodeToTSNodeMap.get(callee.object); const calleeObjType = util.getConstrainedTypeAtLocation( - checker, - tsNode, + services, + callee.object, ); if (options.ignoreStringArrays && isStringArrayNode(callee.object)) { diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 076cd6077a0..c9437b4dc7c 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -34,8 +34,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); let scopeInfo: ScopeInfo | null = null; @@ -110,14 +110,13 @@ export default util.createRule({ return; } - if (node?.argument?.type === AST_NODE_TYPES.Literal) { + if (node.argument.type === AST_NODE_TYPES.Literal) { // making this `false` as for literals we don't need to check the definition // eg : async function* run() { yield* 1 } scopeInfo.isAsyncYield ||= false; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node?.argument); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node.argument); const typesToCheck = expandUnionOrIntersectionType(type); for (const type of typesToCheck) { const asyncIterator = tsutils.getWellKnownSymbolPropertyOfType( @@ -152,7 +151,7 @@ export default util.createRule({ TSESTree.BlockStatement | TSESTree.AwaitExpression >, ): void { - const expression = parserServices.esTreeNodeToTSNodeMap.get(node); + const expression = services.esTreeNodeToTSNodeMap.get(node); if (expression && isThenableType(expression)) { markAsHasAwait(); } @@ -163,7 +162,7 @@ export default util.createRule({ return; } - const { expression } = parserServices.esTreeNodeToTSNodeMap.get(node); + const { expression } = services.esTreeNodeToTSNodeMap.get(node); if (expression && isThenableType(expression)) { markAsHasAwait(); } diff --git a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts index ad5d0a832b7..b1dccf3a7c9 100644 --- a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts +++ b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts @@ -61,8 +61,8 @@ export default util.createRule({ }, ], create(context, [{ checkCompoundAssignments, allowAny }]) { - const service = util.getParserServices(context); - const typeChecker = service.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); type BaseLiteral = 'string' | 'number' | 'bigint' | 'invalid' | 'any'; @@ -107,7 +107,7 @@ export default util.createRule({ return 'invalid'; } - const stringType = typeChecker.typeToString(type); + const stringType = checker.typeToString(type); if ( stringType === 'number' || @@ -127,8 +127,7 @@ export default util.createRule({ function getNodeType( node: TSESTree.Expression | TSESTree.PrivateIdentifier, ): BaseLiteral { - const tsNode = service.esTreeNodeToTSNodeMap.get(node); - const type = util.getConstrainedTypeAtLocation(typeChecker, tsNode); + const type = util.getConstrainedTypeAtLocation(services, node); return getBaseTypeOfLiteralType(type); } diff --git a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts index 83ee29d7ea5..7a5b1ba286a 100644 --- a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts +++ b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts @@ -68,8 +68,8 @@ export default util.createRule({ }, ], create(context, [options]) { - const service = util.getParserServices(context); - const typeChecker = service.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); function isUnderlyingTypePrimitive(type: ts.Type): boolean { if (util.isTypeFlagSet(type, ts.TypeFlags.StringLike)) { @@ -97,10 +97,7 @@ export default util.createRule({ return true; } - if ( - options.allowRegExp && - util.getTypeName(typeChecker, type) === 'RegExp' - ) { + if (options.allowRegExp && util.getTypeName(checker, type) === 'RegExp') { return true; } @@ -123,8 +120,8 @@ export default util.createRule({ for (const expression of node.expressions) { const expressionType = util.getConstrainedTypeAtLocation( - typeChecker, - service.esTreeNodeToTSNodeMap.get(expression), + services, + expression, ); if ( @@ -136,7 +133,7 @@ export default util.createRule({ context.report({ node: expression, messageId: 'invalidType', - data: { type: typeChecker.typeToString(expressionType) }, + data: { type: checker.typeToString(expressionType) }, }); } } diff --git a/packages/eslint-plugin/src/rules/return-await.ts b/packages/eslint-plugin/src/rules/return-await.ts index 1797e47e127..cddfc4ba8c7 100644 --- a/packages/eslint-plugin/src/rules/return-await.ts +++ b/packages/eslint-plugin/src/rules/return-await.ts @@ -46,8 +46,8 @@ export default util.createRule({ defaultOptions: ['in-try-catch'], create(context, [option]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); const scopeInfoStack: ScopeInfo[] = []; @@ -301,7 +301,7 @@ export default util.createRule({ ): void { if (node.body.type !== AST_NODE_TYPES.BlockStatement) { findPossiblyReturnedNodes(node.body).forEach(node => { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); test(node, tsNode); }); } @@ -312,7 +312,7 @@ export default util.createRule({ return; } findPossiblyReturnedNodes(node.argument).forEach(node => { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); test(node, tsNode); }); }, diff --git a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts index 74e6521eb66..b7a18b87cd5 100644 --- a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts +++ b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts @@ -1,4 +1,7 @@ -import type { ParserServices, TSESTree } from '@typescript-eslint/utils'; +import type { + ParserServicesWithTypeInformation, + TSESTree, +} from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as tsutils from 'tsutils'; import * as ts from 'typescript'; @@ -142,9 +145,9 @@ export default util.createRule({ }, ], create(context, [options]) { - const parserServices = util.getParserServices(context); - const typeChecker = parserServices.program.getTypeChecker(); - const compilerOptions = parserServices.program.getCompilerOptions(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); const sourceCode = context.getSourceCode(); const isStrictNullChecks = tsutils.isStrictCompilerOptionEnabled( compilerOptions, @@ -258,8 +261,7 @@ export default util.createRule({ * It analyzes the type of a node and checks if it is allowed in a boolean context. */ function checkNode(node: TSESTree.Node): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = util.getConstrainedTypeAtLocation(typeChecker, tsNode); + const type = util.getConstrainedTypeAtLocation(services, node); const types = inspectVariantTypes(tsutils.unionTypeParts(type)); const is = (...wantedTypes: readonly VariantType[]): boolean => @@ -507,7 +509,7 @@ export default util.createRule({ // number if (is('number') || is('truthy number')) { if (!options.allowNumber) { - if (isArrayLengthExpression(node, typeChecker, parserServices)) { + if (isArrayLengthExpression(node, checker, services)) { if (isLogicalNegationExpression(node.parent)) { // if (!array.length) context.report({ @@ -867,7 +869,7 @@ function isLogicalNegationExpression( function isArrayLengthExpression( node: TSESTree.Node, typeChecker: ts.TypeChecker, - parserServices: ParserServices, + services: ParserServicesWithTypeInformation, ): node is TSESTree.MemberExpressionNonComputedName { if (node.type !== AST_NODE_TYPES.MemberExpression) { return false; @@ -878,10 +880,6 @@ function isArrayLengthExpression( if (node.property.name !== 'length') { return false; } - const objectTsNode = parserServices.esTreeNodeToTSNodeMap.get(node.object); - const objectType = util.getConstrainedTypeAtLocation( - typeChecker, - objectTsNode, - ); + const objectType = util.getConstrainedTypeAtLocation(services, node.object); return util.isTypeArrayTypeOrUnionOfArrayTypes(objectType, typeChecker); } diff --git a/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts b/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts index cff8960dac8..3aa764aaf3b 100644 --- a/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts +++ b/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts @@ -32,14 +32,9 @@ export default createRule({ defaultOptions: [], create(context) { const sourceCode = context.getSourceCode(); - const service = getParserServices(context); - const checker = service.program.getTypeChecker(); - const compilerOptions = service.program.getCompilerOptions(); - - function getNodeType(node: TSESTree.Node): ts.Type { - const tsNode = service.esTreeNodeToTSNodeMap.get(node); - return getConstrainedTypeAtLocation(checker, tsNode); - } + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); function fixSwitch( fixer: TSESLint.RuleFixer, @@ -114,7 +109,10 @@ export default createRule({ } function checkSwitchExhaustive(node: TSESTree.SwitchStatement): void { - const discriminantType = getNodeType(node.discriminant); + const discriminantType = getConstrainedTypeAtLocation( + services, + node.discriminant, + ); const symbolName = discriminantType.getSymbol()?.escapedName; if (discriminantType.isUnion()) { @@ -126,7 +124,9 @@ export default createRule({ return; } - caseTypes.add(getNodeType(switchCase.test)); + caseTypes.add( + getConstrainedTypeAtLocation(services, switchCase.test), + ); } const missingBranchTypes = unionTypes.filter( diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index c95a7fd35e1..a4d42d86ed6 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -161,9 +161,9 @@ export default util.createRule({ }, ], create(context, [{ ignoreStatic }]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); - const currentSourceFile = parserServices.program.getSourceFile( + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const currentSourceFile = services.program.getSourceFile( context.getFilename(), ); @@ -193,9 +193,7 @@ export default util.createRule({ return; } - const objectSymbol = checker.getSymbolAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node.object), - ); + const objectSymbol = services.getSymbolAtLocation(node.object); if ( objectSymbol && @@ -205,9 +203,7 @@ export default util.createRule({ return; } - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); - - checkMethodAndReport(node, checker.getSymbolAtLocation(originalNode)); + checkMethodAndReport(node, services.getSymbolAtLocation(node)); }, 'VariableDeclarator, AssignmentExpression'( node: TSESTree.VariableDeclarator | TSESTree.AssignmentExpression, @@ -218,9 +214,8 @@ export default util.createRule({ : [node.left, node.right]; if (initNode && idNode.type === AST_NODE_TYPES.ObjectPattern) { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(initNode); - const rightSymbol = checker.getSymbolAtLocation(tsNode); - const initTypes = checker.getTypeAtLocation(tsNode); + const rightSymbol = services.getSymbolAtLocation(initNode); + const initTypes = services.getTypeAtLocation(initNode); const notImported = rightSymbol && isNotImported(rightSymbol, currentSourceFile); diff --git a/packages/type-utils/src/getConstrainedTypeAtLocation.ts b/packages/type-utils/src/getConstrainedTypeAtLocation.ts index 50317b00e56..cbd332f98da 100644 --- a/packages/type-utils/src/getConstrainedTypeAtLocation.ts +++ b/packages/type-utils/src/getConstrainedTypeAtLocation.ts @@ -1,14 +1,20 @@ +import type { + ParserServicesWithTypeInformation, + TSESTree, +} from '@typescript-eslint/typescript-estree'; import type * as ts from 'typescript'; /** * Resolves the given node's type. Will resolve to the type's generic constraint, if it has one. */ export function getConstrainedTypeAtLocation( - checker: ts.TypeChecker, - node: ts.Node, + services: ParserServicesWithTypeInformation, + node: TSESTree.Node, ): ts.Type { - const nodeType = checker.getTypeAtLocation(node); - const constrained = checker.getBaseConstraintOfType(nodeType); + const nodeType = services.getTypeAtLocation(node); + const constrained = services.program + .getTypeChecker() + .getBaseConstraintOfType(nodeType); return constrained ?? nodeType; } diff --git a/packages/type-utils/src/getDeclaration.ts b/packages/type-utils/src/getDeclaration.ts index d0c6c998d33..9e8d8b77024 100644 --- a/packages/type-utils/src/getDeclaration.ts +++ b/packages/type-utils/src/getDeclaration.ts @@ -1,13 +1,17 @@ +import type { + ParserServicesWithTypeInformation, + TSESTree, +} from '@typescript-eslint/typescript-estree'; import type * as ts from 'typescript'; /** * Gets the declaration for the given variable */ export function getDeclaration( - checker: ts.TypeChecker, - node: ts.Expression, + services: ParserServicesWithTypeInformation, + node: TSESTree.Node, ): ts.Declaration | null { - const symbol = checker.getSymbolAtLocation(node); + const symbol = services.getSymbolAtLocation(node); if (!symbol) { return null; } diff --git a/packages/type-utils/tests/isUnsafeAssignment.test.ts b/packages/type-utils/tests/isUnsafeAssignment.test.ts index e7ba11fda28..55e2195f93a 100644 --- a/packages/type-utils/tests/isUnsafeAssignment.test.ts +++ b/packages/type-utils/tests/isUnsafeAssignment.test.ts @@ -22,17 +22,12 @@ describe('isUnsafeAssignment', () => { }); expectToHaveParserServices(services); const checker = services.program.getTypeChecker(); - const esTreeNodeToTSNodeMap = services.esTreeNodeToTSNodeMap; const declaration = ast.body[0] as TSESTree.VariableDeclaration; const declarator = declaration.declarations[0]; return { - receiver: checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(declarator.id), - ), - sender: checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(declarator.init!), - ), + receiver: services.getTypeAtLocation(declarator.id), + sender: services.getTypeAtLocation(declarator.init!), senderNode: declarator.init!, checker, }; diff --git a/packages/typescript-estree/src/createParserServices.ts b/packages/typescript-estree/src/createParserServices.ts new file mode 100644 index 00000000000..1e62bdbe351 --- /dev/null +++ b/packages/typescript-estree/src/createParserServices.ts @@ -0,0 +1,27 @@ +import type * as ts from 'typescript'; + +import type { ASTMaps } from './convert'; +import type { ParserServices } from './parser-options'; + +export function createParserServices( + astMaps: ASTMaps, + program: ts.Program | null, +): ParserServices { + if (!program) { + // we always return the node maps because + // (a) they don't require type info and + // (b) they can be useful when using some of TS's internal non-type-aware AST utils + return { program, ...astMaps }; + } + + const checker = program.getTypeChecker(); + + return { + program, + ...astMaps, + getSymbolAtLocation: node => + checker.getSymbolAtLocation(astMaps.esTreeNodeToTSNodeMap.get(node)), + getTypeAtLocation: node => + checker.getTypeAtLocation(astMaps.esTreeNodeToTSNodeMap.get(node)), + }; +} diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index 7258a1626a6..ff23aa5863b 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -189,6 +189,8 @@ export interface ParserServicesNodeMaps { export interface ParserServicesWithTypeInformation extends ParserServicesNodeMaps { program: ts.Program; + getTypeAtLocation: (node: TSESTree.Node) => ts.Type; + getSymbolAtLocation: (node: TSESTree.Node) => ts.Symbol | undefined; } export interface ParserServicesWithoutTypeInformation extends ParserServicesNodeMaps { diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 084e156fe47..4c08717fbca 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -15,6 +15,7 @@ import { createProgramFromConfigFile, useProvidedPrograms, } from './create-program/useProvidedPrograms'; +import { createParserServices } from './createParserServices'; import type { ParserServices, ParserServicesNodeMaps, @@ -39,12 +40,12 @@ function clearProgramCache(): void { /** * @param parseSettings Internal settings for parsing the file - * @param shouldProvideParserServices True if the program should be attempted to be calculated from provided tsconfig files + * @param hasFullTypeInformation True if the program should be attempted to be calculated from provided tsconfig files * @returns Returns a source file and program corresponding to the linted code */ function getProgramAndAST( parseSettings: ParseSettings, - shouldProvideParserServices: boolean, + hasFullTypeInformation: boolean, ): ASTAndProgram { if (parseSettings.programs) { const fromProvidedPrograms = useProvidedPrograms( @@ -56,7 +57,7 @@ function getProgramAndAST( } } - if (shouldProvideParserServices) { + if (hasFullTypeInformation) { const fromProjectProgram = createProjectProgram(parseSettings); if (fromProjectProgram) { return fromProjectProgram; @@ -197,7 +198,7 @@ function parseAndGenerateServices( /** * Generate a full ts.Program or offer provided instances in order to be able to provide parser services, such as type-checking */ - const shouldProvideParserServices = + const hasFullTypeInformation = parseSettings.programs != null || parseSettings.projects?.length > 0; if (typeof options !== 'undefined') { @@ -211,7 +212,7 @@ function parseAndGenerateServices( if ( parseSettings.errorOnTypeScriptSyntacticAndSemanticIssues && - !shouldProvideParserServices + !hasFullTypeInformation ) { throw new Error( 'Cannot calculate TypeScript semantic issues without a valid project.', @@ -237,7 +238,7 @@ function parseAndGenerateServices( options.filePath && parseAndGenerateServicesCalls[options.filePath] > 1 ? createIsolatedProgram(parseSettings) - : getProgramAndAST(parseSettings, shouldProvideParserServices)!; + : getProgramAndAST(parseSettings, hasFullTypeInformation)!; /** * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve @@ -270,14 +271,7 @@ function parseAndGenerateServices( */ return { ast: estree as AST, - services: { - program, - // we always return the node maps because - // (a) they don't require type info and - // (b) they can be useful when using some of TS's internal non-type-aware AST utils - esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, - tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, - }, + services: createParserServices(astMaps, program), }; } diff --git a/packages/typescript-estree/tests/lib/semanticInfo.test.ts b/packages/typescript-estree/tests/lib/semanticInfo.test.ts index e25a85d01e0..1cb57c7e5de 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.test.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.test.ts @@ -7,7 +7,10 @@ import { clearWatchCaches } from '../../src/create-program/getWatchProgramsForPr import { createProgramFromConfigFile as createProgram } from '../../src/create-program/useProvidedPrograms'; import type { ParseAndGenerateServicesResult } from '../../src/parser'; import { parseAndGenerateServices } from '../../src/parser'; -import type { TSESTreeOptions } from '../../src/parser-options'; +import type { + ParserServicesWithTypeInformation, + TSESTreeOptions, +} from '../../src/parser-options'; import type { TSESTree } from '../../src/ts-estree'; import { createSnapshotTestBlock, @@ -80,8 +83,17 @@ describe('semanticInfo', () => { ...options, project: ['./tsconfig.json'], }; - expect(parseAndGenerateServices(code, optionsProjectString)).toEqual( - parseAndGenerateServices(code, optionsProjectArray), + const fromString = parseAndGenerateServices(code, optionsProjectString); + const fromArray = parseAndGenerateServices(code, optionsProjectArray); + + expect(fromString.services.program).toBe(fromArray.services.program); + + expect(fromString.ast).toEqual(fromArray.ast); + expect(fromString.services.esTreeNodeToTSNodeMap).toEqual( + fromArray.services.esTreeNodeToTSNodeMap, + ); + expect(fromString.services.tsNodeToESTreeNodeMap).toEqual( + fromArray.services.tsNodeToESTreeNodeMap, ); }); From 348eecfbefe28ac5757ce89dcdc7a0ff95029e92 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 17 Dec 2022 21:22:13 -0500 Subject: [PATCH 7/7] Add missing APIs to WebLinter --- packages/website/src/components/linter/WebLinter.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/website/src/components/linter/WebLinter.ts b/packages/website/src/components/linter/WebLinter.ts index 50c1daa2f7e..3ffd4da2c09 100644 --- a/packages/website/src/components/linter/WebLinter.ts +++ b/packages/website/src/components/linter/WebLinter.ts @@ -103,6 +103,7 @@ export class WebLinter { host: this.host, }); const tsAst = program.getSourceFile(fileName)!; + const checker = program.getTypeChecker(); const { estree: ast, astMaps } = this.lintUtils.astConverter( tsAst, @@ -125,6 +126,10 @@ export class WebLinter { program, esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, + getSymbolAtLocation: node => + checker.getSymbolAtLocation(astMaps.esTreeNodeToTSNodeMap.get(node)), + getTypeAtLocation: node => + checker.getTypeAtLocation(astMaps.esTreeNodeToTSNodeMap.get(node)), }, scopeManager, visitorKeys: this.lintUtils.visitorKeys,