@@ -2,19 +2,20 @@ import type {
22 AnalyzeOptions ,
33 ScopeManager ,
44} from '@typescript-eslint/scope-manager' ;
5- import { analyze } from '@typescript-eslint/scope-manager' ;
65import type { Lib , TSESTree } from '@typescript-eslint/types' ;
7- import { ParserOptions } from '@typescript-eslint/types' ;
86import type {
97 AST ,
108 ParserServices ,
119 TSESTreeOptions ,
1210} from '@typescript-eslint/typescript-estree' ;
13- import { parseAndGenerateServices } from '@typescript-eslint/typescript-estree' ;
1411import type { VisitorKeys } from '@typescript-eslint/visitor-keys' ;
12+ import type * as ts from 'typescript' ;
13+
14+ import { analyze } from '@typescript-eslint/scope-manager' ;
15+ import { ParserOptions } from '@typescript-eslint/types' ;
16+ import { parseAndGenerateServices } from '@typescript-eslint/typescript-estree' ;
1517import { visitorKeys } from '@typescript-eslint/visitor-keys' ;
1618import debug from 'debug' ;
17- import type * as ts from 'typescript' ;
1819import { ScriptTarget } from 'typescript' ;
1920
2021const log = debug ( 'typescript-eslint:parser:parser' ) ;
@@ -27,9 +28,9 @@ interface ESLintProgram extends AST<{ comment: true; tokens: true }> {
2728
2829interface ParseForESLintResult {
2930 ast : ESLintProgram ;
31+ scopeManager : ScopeManager ;
3032 services : ParserServices ;
3133 visitorKeys : VisitorKeys ;
32- scopeManager : ScopeManager ;
3334}
3435
3536function validateBoolean (
@@ -58,24 +59,24 @@ function getLib(compilerOptions: ts.CompilerOptions): Lib[] {
5859 const target = compilerOptions . target ?? ScriptTarget . ES5 ;
5960 // https://github.com/microsoft/TypeScript/blob/ae582a22ee1bb052e19b7c1bc4cac60509b574e0/src/compiler/utilitiesPublic.ts#L13-L36
6061 switch ( target ) {
61- case ScriptTarget . ESNext :
62- return [ 'esnext.full' ] ;
63- case ScriptTarget . ES2022 :
64- return [ 'es2022.full' ] ;
65- case ScriptTarget . ES2021 :
66- return [ 'es2021.full' ] ;
67- case ScriptTarget . ES2020 :
68- return [ 'es2020.full' ] ;
69- case ScriptTarget . ES2019 :
70- return [ 'es2019.full' ] ;
71- case ScriptTarget . ES2018 :
72- return [ 'es2018.full' ] ;
73- case ScriptTarget . ES2017 :
74- return [ 'es2017.full' ] ;
75- case ScriptTarget . ES2016 :
76- return [ 'es2016.full' ] ;
7762 case ScriptTarget . ES2015 :
7863 return [ 'es6' ] ;
64+ case ScriptTarget . ES2016 :
65+ return [ 'es2016.full' ] ;
66+ case ScriptTarget . ES2017 :
67+ return [ 'es2017.full' ] ;
68+ case ScriptTarget . ES2018 :
69+ return [ 'es2018.full' ] ;
70+ case ScriptTarget . ES2019 :
71+ return [ 'es2019.full' ] ;
72+ case ScriptTarget . ES2020 :
73+ return [ 'es2020.full' ] ;
74+ case ScriptTarget . ES2021 :
75+ return [ 'es2021.full' ] ;
76+ case ScriptTarget . ES2022 :
77+ return [ 'es2022.full' ] ;
78+ case ScriptTarget . ESNext :
79+ return [ 'esnext.full' ] ;
7980 default :
8081 return [ 'lib' ] ;
8182 }
@@ -135,8 +136,8 @@ function parseForESLint(
135136
136137 const analyzeOptions : AnalyzeOptions = {
137138 globalReturn : parserOptions . ecmaFeatures . globalReturn ,
138- jsxPragma : parserOptions . jsxPragma ,
139139 jsxFragmentName : parserOptions . jsxFragmentName ,
140+ jsxPragma : parserOptions . jsxPragma ,
140141 lib : parserOptions . lib ,
141142 sourceType : parserOptions . sourceType ,
142143 } ;
@@ -184,7 +185,7 @@ function parseForESLint(
184185 services . experimentalDecorators ??=
185186 parserOptions . experimentalDecorators === true ;
186187
187- return { ast, services , scopeManager , visitorKeys } ;
188+ return { ast, scopeManager , services , visitorKeys } ;
188189}
189190
190191export { parse , parseForESLint , ParserOptions } ;
0 commit comments