@sprucelabs/spruce-cli 18.1.1 → 18.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build/features/conversation/actions/TestAction.js.map +1 -1
- package/build/features/skill/SkillFeature.js +0 -1
- package/build/features/skill/SkillFeature.js.map +1 -1
- package/build/features/test/TestFeature.js.map +1 -1
- package/node_modules/@typescript-eslint/parser/README.md +2 -0
- package/node_modules/@typescript-eslint/parser/package.json +5 -5
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +1 -1
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +1 -1
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/package.json +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ast-converter.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createDefaultProgram.d.ts +3 -6
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createIsolatedProgram.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createProjectProgram.d.ts +4 -6
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createSourceFile.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createWatchProgram.d.ts +4 -7
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts +5 -4
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/useProvidedPrograms.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/createParseSettings.d.ts +4 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/index.d.ts +102 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/inferSingleRun.d.ts +15 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/warnAboutTSVersion.d.ts +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser-options.d.ts +0 -26
- package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.js +8 -8
- package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.d.ts +3 -6
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.js +13 -15
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.js +7 -7
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.d.ts +4 -6
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js +51 -38
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.js +4 -4
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.d.ts +4 -7
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js +21 -22
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.d.ts +5 -4
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.js +7 -7
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.js +4 -4
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.d.ts +4 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.js +145 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.d.ts +102 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.js +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.d.ts +15 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.js +53 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.d.ts +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js +68 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser-options.d.ts +0 -26
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser-options.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser.js +32 -388
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
- package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
- package/package.json +32 -32
- package/src/features/skill/SkillFeature.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
|
-
import {
|
|
2
|
+
import { ParseSettings } from '../parseSettings';
|
|
3
3
|
/**
|
|
4
4
|
* Clear all of the parser caches.
|
|
5
5
|
* This should only be used in testing to ensure the parser is clean between tests.
|
|
@@ -7,13 +7,10 @@ import { Extra } from '../parser-options';
|
|
|
7
7
|
declare function clearWatchCaches(): void;
|
|
8
8
|
/**
|
|
9
9
|
* Calculate project environments using options provided by consumer and paths from config
|
|
10
|
-
* @param
|
|
11
|
-
* @param filePathIn The path of the file being parsed
|
|
12
|
-
* @param extra.tsconfigRootDir The root directory for relative tsconfig paths
|
|
13
|
-
* @param extra.projects Provided tsconfig paths
|
|
10
|
+
* @param parseSettings Internal settings for parsing the file
|
|
14
11
|
* @returns The programs corresponding to the supplied tsconfig paths
|
|
15
12
|
*/
|
|
16
|
-
declare function getProgramsForProjects(
|
|
17
|
-
declare function createWatchProgram(tsconfigPath: string,
|
|
13
|
+
declare function getProgramsForProjects(parseSettings: ParseSettings): ts.Program[];
|
|
14
|
+
declare function createWatchProgram(tsconfigPath: string, parseSettings: ParseSettings): ts.WatchOfConfigFile<ts.BuilderProgram>;
|
|
18
15
|
export { clearWatchCaches, createWatchProgram, getProgramsForProjects };
|
|
19
16
|
//# sourceMappingURL=createWatchProgram.d.ts.map
|
package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Program } from 'typescript';
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
|
-
import {
|
|
3
|
+
import { ModuleResolver } from '../parser-options';
|
|
4
|
+
import { ParseSettings } from '../parseSettings';
|
|
4
5
|
interface ASTAndProgram {
|
|
5
6
|
ast: ts.SourceFile;
|
|
6
7
|
program: ts.Program;
|
|
@@ -9,14 +10,14 @@ interface ASTAndProgram {
|
|
|
9
10
|
* Compiler options required to avoid critical functionality issues
|
|
10
11
|
*/
|
|
11
12
|
declare const CORE_COMPILER_OPTIONS: ts.CompilerOptions;
|
|
12
|
-
declare function createDefaultCompilerOptionsFromExtra(
|
|
13
|
+
declare function createDefaultCompilerOptionsFromExtra(parseSettings: ParseSettings): ts.CompilerOptions;
|
|
13
14
|
declare type CanonicalPath = string & {
|
|
14
15
|
__brand: unknown;
|
|
15
16
|
};
|
|
16
17
|
declare function getCanonicalFileName(filePath: string): CanonicalPath;
|
|
17
|
-
declare function ensureAbsolutePath(p: string,
|
|
18
|
+
declare function ensureAbsolutePath(p: string, tsconfigRootDir: string): string;
|
|
18
19
|
declare function canonicalDirname(p: CanonicalPath): CanonicalPath;
|
|
19
|
-
declare function getAstFromProgram(currentProgram: Program,
|
|
20
|
+
declare function getAstFromProgram(currentProgram: Program, parseSettings: ParseSettings): ASTAndProgram | undefined;
|
|
20
21
|
declare function getModuleResolver(moduleResolverPath: string): ModuleResolver;
|
|
21
22
|
export { ASTAndProgram, CORE_COMPILER_OPTIONS, canonicalDirname, CanonicalPath, createDefaultCompilerOptionsFromExtra, ensureAbsolutePath, getCanonicalFileName, getAstFromProgram, getModuleResolver, };
|
|
22
23
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
|
-
import {
|
|
2
|
+
import { ParseSettings } from '../parseSettings';
|
|
3
3
|
import { ASTAndProgram } from './shared';
|
|
4
|
-
declare function useProvidedPrograms(programInstances: Iterable<ts.Program>,
|
|
4
|
+
declare function useProvidedPrograms(programInstances: Iterable<ts.Program>, parseSettings: ParseSettings): ASTAndProgram | undefined;
|
|
5
5
|
/**
|
|
6
6
|
* Utility offered by parser to help consumers construct their own program instance.
|
|
7
7
|
*
|
package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/index.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { CanonicalPath } from '../create-program/shared';
|
|
3
|
+
import { TSESTree } from '../ts-estree';
|
|
4
|
+
declare type DebugModule = 'typescript-eslint' | 'eslint' | 'typescript';
|
|
5
|
+
/**
|
|
6
|
+
* Internal settings used by the parser to run on a file.
|
|
7
|
+
*/
|
|
8
|
+
export interface MutableParseSettings {
|
|
9
|
+
/**
|
|
10
|
+
* Code of the file being parsed.
|
|
11
|
+
*/
|
|
12
|
+
code: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the `comment` parse option is enabled.
|
|
15
|
+
*/
|
|
16
|
+
comment: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* If the `comment` parse option is enabled, retrieved comments.
|
|
19
|
+
*/
|
|
20
|
+
comments: TSESTree.Comment[];
|
|
21
|
+
/**
|
|
22
|
+
* Whether to create a TypeScript program if one is not provided.
|
|
23
|
+
*/
|
|
24
|
+
createDefaultProgram: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Which debug areas should be logged.
|
|
27
|
+
*/
|
|
28
|
+
debugLevel: Set<DebugModule>;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to error if TypeScript reports a semantic or syntactic error diagnostic.
|
|
31
|
+
*/
|
|
32
|
+
errorOnTypeScriptSyntacticAndSemanticIssues: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to error if an unknown AST node type is encountered.
|
|
35
|
+
*/
|
|
36
|
+
errorOnUnknownASTType: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether TS should use the source files for referenced projects instead of the compiled .d.ts files.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* This feature is not yet optimized, and is likely to cause OOMs for medium to large projects.
|
|
42
|
+
* This flag REQUIRES at least TS v3.9, otherwise it does nothing.
|
|
43
|
+
*/
|
|
44
|
+
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Any non-standard file extensions which will be parsed.
|
|
47
|
+
*/
|
|
48
|
+
extraFileExtensions: string[];
|
|
49
|
+
/**
|
|
50
|
+
* Path of the file being parsed.
|
|
51
|
+
*/
|
|
52
|
+
filePath: string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether parsing of JSX is enabled.
|
|
55
|
+
*
|
|
56
|
+
* @remarks The applicable file extension is still required.
|
|
57
|
+
*/
|
|
58
|
+
jsx: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether to add `loc` information to each node.
|
|
61
|
+
*/
|
|
62
|
+
loc: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Log function, if not `console.log`.
|
|
65
|
+
*/
|
|
66
|
+
log: (message: string) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Path for a module resolver to use for the compiler host's `resolveModuleNames`.
|
|
69
|
+
*/
|
|
70
|
+
moduleResolver: string;
|
|
71
|
+
/**
|
|
72
|
+
* Whether two-way AST node maps are preserved during the AST conversion process.
|
|
73
|
+
*/
|
|
74
|
+
preserveNodeMaps?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* One or more instances of TypeScript Program objects to be used for type information.
|
|
77
|
+
*/
|
|
78
|
+
programs: null | Iterable<ts.Program>;
|
|
79
|
+
/**
|
|
80
|
+
* Normalized paths to provided project paths.
|
|
81
|
+
*/
|
|
82
|
+
projects: CanonicalPath[];
|
|
83
|
+
/**
|
|
84
|
+
* Whether to add the `range` property to AST nodes.
|
|
85
|
+
*/
|
|
86
|
+
range: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Whether this is part of a single run, rather than a long-running process.
|
|
89
|
+
*/
|
|
90
|
+
singleRun: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* If the `tokens` parse option is enabled, retrieved tokens.
|
|
93
|
+
*/
|
|
94
|
+
tokens: null | TSESTree.Token[];
|
|
95
|
+
/**
|
|
96
|
+
* The absolute path to the root directory for all provided `project`s.
|
|
97
|
+
*/
|
|
98
|
+
tsconfigRootDir: string;
|
|
99
|
+
}
|
|
100
|
+
export declare type ParseSettings = Readonly<MutableParseSettings>;
|
|
101
|
+
export {};
|
|
102
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TSESTreeOptions } from '../parser-options';
|
|
2
|
+
/**
|
|
3
|
+
* ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts,
|
|
4
|
+
* such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback
|
|
5
|
+
* on a file in an IDE).
|
|
6
|
+
*
|
|
7
|
+
* When typescript-eslint handles TypeScript Program management behind the scenes, this distinction
|
|
8
|
+
* is important because there is significant overhead to managing the so called Watch Programs
|
|
9
|
+
* needed for the long-running use-case. We therefore use the following logic to figure out which
|
|
10
|
+
* of these contexts applies to the current execution.
|
|
11
|
+
*
|
|
12
|
+
* @returns Whether this is part of a single run, rather than a long-running process.
|
|
13
|
+
*/
|
|
14
|
+
export declare function inferSingleRun(options: TSESTreeOptions | undefined): boolean;
|
|
15
|
+
//# sourceMappingURL=inferSingleRun.d.ts.map
|
|
@@ -1,32 +1,6 @@
|
|
|
1
1
|
import { DebugLevel } from '@typescript-eslint/types';
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
|
-
import { CanonicalPath } from './create-program/shared';
|
|
4
3
|
import { TSESTree, TSESTreeToTSNode, TSNode, TSToken } from './ts-estree';
|
|
5
|
-
declare type DebugModule = 'typescript-eslint' | 'eslint' | 'typescript';
|
|
6
|
-
export interface Extra {
|
|
7
|
-
code: string;
|
|
8
|
-
comment: boolean;
|
|
9
|
-
comments: TSESTree.Comment[];
|
|
10
|
-
createDefaultProgram: boolean;
|
|
11
|
-
debugLevel: Set<DebugModule>;
|
|
12
|
-
errorOnTypeScriptSyntacticAndSemanticIssues: boolean;
|
|
13
|
-
errorOnUnknownASTType: boolean;
|
|
14
|
-
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: boolean;
|
|
15
|
-
extraFileExtensions: string[];
|
|
16
|
-
filePath: string;
|
|
17
|
-
jsx: boolean;
|
|
18
|
-
loc: boolean;
|
|
19
|
-
singleRun: boolean;
|
|
20
|
-
log: (message: string) => void;
|
|
21
|
-
preserveNodeMaps?: boolean;
|
|
22
|
-
programs: null | Iterable<ts.Program>;
|
|
23
|
-
projects: CanonicalPath[];
|
|
24
|
-
range: boolean;
|
|
25
|
-
strict: boolean;
|
|
26
|
-
tokens: null | TSESTree.Token[];
|
|
27
|
-
tsconfigRootDir: string;
|
|
28
|
-
moduleResolver: string;
|
|
29
|
-
}
|
|
30
4
|
interface ParseOptions {
|
|
31
5
|
/**
|
|
32
6
|
* create a top-level comments array containing all comments
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SourceFile } from 'typescript';
|
|
2
2
|
import type { ASTMaps } from './convert';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ParseSettings } from './parseSettings';
|
|
4
4
|
import type { TSESTree } from './ts-estree';
|
|
5
|
-
export declare function astConverter(ast: SourceFile,
|
|
5
|
+
export declare function astConverter(ast: SourceFile, parseSettings: ParseSettings, shouldPreserveNodeMaps: boolean): {
|
|
6
6
|
estree: TSESTree.Program;
|
|
7
7
|
astMaps: ASTMaps;
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-converter.d.ts","sourceRoot":"","sources":["../src/ast-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ast-converter.d.ts","sourceRoot":"","sources":["../src/ast-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,wBAAgB,YAAY,CAC1B,GAAG,EAAE,UAAU,EACf,aAAa,EAAE,aAAa,EAC5B,sBAAsB,EAAE,OAAO,GAC9B;IAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAyDhD"}
|
|
@@ -5,7 +5,7 @@ const convert_1 = require("./convert");
|
|
|
5
5
|
const convert_comments_1 = require("./convert-comments");
|
|
6
6
|
const node_utils_1 = require("./node-utils");
|
|
7
7
|
const simple_traverse_1 = require("./simple-traverse");
|
|
8
|
-
function astConverter(ast,
|
|
8
|
+
function astConverter(ast, parseSettings, shouldPreserveNodeMaps) {
|
|
9
9
|
/**
|
|
10
10
|
* The TypeScript compiler produced fundamental parse errors when parsing the
|
|
11
11
|
* source.
|
|
@@ -18,22 +18,22 @@ function astConverter(ast, extra, shouldPreserveNodeMaps) {
|
|
|
18
18
|
* Recursively convert the TypeScript AST into an ESTree-compatible AST
|
|
19
19
|
*/
|
|
20
20
|
const instance = new convert_1.Converter(ast, {
|
|
21
|
-
errorOnUnknownASTType:
|
|
21
|
+
errorOnUnknownASTType: parseSettings.errorOnUnknownASTType || false,
|
|
22
22
|
shouldPreserveNodeMaps,
|
|
23
23
|
});
|
|
24
24
|
const estree = instance.convertProgram();
|
|
25
25
|
/**
|
|
26
26
|
* Optionally remove range and loc if specified
|
|
27
27
|
*/
|
|
28
|
-
if (!
|
|
28
|
+
if (!parseSettings.range || !parseSettings.loc) {
|
|
29
29
|
(0, simple_traverse_1.simpleTraverse)(estree, {
|
|
30
30
|
enter: node => {
|
|
31
|
-
if (!
|
|
31
|
+
if (!parseSettings.range) {
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- TS 4.0 made this an error because the types aren't optional
|
|
33
33
|
// @ts-expect-error
|
|
34
34
|
delete node.range;
|
|
35
35
|
}
|
|
36
|
-
if (!
|
|
36
|
+
if (!parseSettings.loc) {
|
|
37
37
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- TS 4.0 made this an error because the types aren't optional
|
|
38
38
|
// @ts-expect-error
|
|
39
39
|
delete node.loc;
|
|
@@ -44,14 +44,14 @@ function astConverter(ast, extra, shouldPreserveNodeMaps) {
|
|
|
44
44
|
/**
|
|
45
45
|
* Optionally convert and include all tokens in the AST
|
|
46
46
|
*/
|
|
47
|
-
if (
|
|
47
|
+
if (parseSettings.tokens) {
|
|
48
48
|
estree.tokens = (0, node_utils_1.convertTokens)(ast);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Optionally convert and include all comments in the AST
|
|
52
52
|
*/
|
|
53
|
-
if (
|
|
54
|
-
estree.comments = (0, convert_comments_1.convertComments)(ast,
|
|
53
|
+
if (parseSettings.comment) {
|
|
54
|
+
estree.comments = (0, convert_comments_1.convertComments)(ast, parseSettings.code);
|
|
55
55
|
}
|
|
56
56
|
const astMaps = instance.getASTMaps();
|
|
57
57
|
return { estree, astMaps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-converter.js","sourceRoot":"","sources":["../src/ast-converter.ts"],"names":[],"mappings":";;;AAGA,uCAAoD;AACpD,yDAAqD;AACrD,6CAA6C;AAE7C,uDAAmD;AAGnD,SAAgB,YAAY,CAC1B,GAAe,EACf,
|
|
1
|
+
{"version":3,"file":"ast-converter.js","sourceRoot":"","sources":["../src/ast-converter.ts"],"names":[],"mappings":";;;AAGA,uCAAoD;AACpD,yDAAqD;AACrD,6CAA6C;AAE7C,uDAAmD;AAGnD,SAAgB,YAAY,CAC1B,GAAe,EACf,aAA4B,EAC5B,sBAA+B;IAE/B;;;OAGG;IACH,MAAM,EAAE,gBAAgB,EAAE,GAAG,GAAG,CAAC;IACjC,IAAI,gBAAgB,CAAC,MAAM,EAAE;QAC3B,MAAM,IAAA,sBAAY,EAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;KACzC;IAED;;OAEG;IACH,MAAM,QAAQ,GAAG,IAAI,mBAAS,CAAC,GAAG,EAAE;QAClC,qBAAqB,EAAE,aAAa,CAAC,qBAAqB,IAAI,KAAK;QACnE,sBAAsB;KACvB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;IAEzC;;OAEG;IACH,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE;QAC9C,IAAA,gCAAc,EAAC,MAAM,EAAE;YACrB,KAAK,EAAE,IAAI,CAAC,EAAE;gBACZ,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;oBACxB,4HAA4H;oBAC5H,mBAAmB;oBACnB,OAAO,IAAI,CAAC,KAAK,CAAC;iBACnB;gBACD,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE;oBACtB,4HAA4H;oBAC5H,mBAAmB;oBACnB,OAAO,IAAI,CAAC,GAAG,CAAC;iBACjB;YACH,CAAC;SACF,CAAC,CAAC;KACJ;IAED;;OAEG;IACH,IAAI,aAAa,CAAC,MAAM,EAAE;QACxB,MAAM,CAAC,MAAM,GAAG,IAAA,0BAAa,EAAC,GAAG,CAAC,CAAC;KACpC;IAED;;OAEG;IACH,IAAI,aAAa,CAAC,OAAO,EAAE;QACzB,MAAM,CAAC,QAAQ,GAAG,IAAA,kCAAe,EAAC,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;KAC5D;IAED,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;IAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AA7DD,oCA6DC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParseSettings } from '../parseSettings';
|
|
2
2
|
import type { ASTAndProgram } from './shared';
|
|
3
3
|
/**
|
|
4
|
-
* @param
|
|
5
|
-
* @param extra The config object
|
|
6
|
-
* @param extra.tsconfigRootDir The root directory for relative tsconfig paths
|
|
7
|
-
* @param extra.projects Provided tsconfig paths
|
|
4
|
+
* @param parseSettings Internal settings for parsing the file
|
|
8
5
|
* @returns If found, returns the source file corresponding to the code and the containing program
|
|
9
6
|
*/
|
|
10
|
-
declare function createDefaultProgram(
|
|
7
|
+
declare function createDefaultProgram(parseSettings: ParseSettings): ASTAndProgram | undefined;
|
|
11
8
|
export { createDefaultProgram };
|
|
12
9
|
//# sourceMappingURL=createDefaultProgram.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDefaultProgram.d.ts","sourceRoot":"","sources":["../../src/create-program/createDefaultProgram.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createDefaultProgram.d.ts","sourceRoot":"","sources":["../../src/create-program/createDefaultProgram.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAQ9C;;;GAGG;AACH,iBAAS,oBAAoB,CAC3B,aAAa,EAAE,aAAa,GAC3B,aAAa,GAAG,SAAS,CA+C3B;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -33,33 +33,31 @@ const ts = __importStar(require("typescript"));
|
|
|
33
33
|
const shared_1 = require("./shared");
|
|
34
34
|
const log = (0, debug_1.default)('typescript-eslint:typescript-estree:createDefaultProgram');
|
|
35
35
|
/**
|
|
36
|
-
* @param
|
|
37
|
-
* @param extra The config object
|
|
38
|
-
* @param extra.tsconfigRootDir The root directory for relative tsconfig paths
|
|
39
|
-
* @param extra.projects Provided tsconfig paths
|
|
36
|
+
* @param parseSettings Internal settings for parsing the file
|
|
40
37
|
* @returns If found, returns the source file corresponding to the code and the containing program
|
|
41
38
|
*/
|
|
42
|
-
function createDefaultProgram(
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
function createDefaultProgram(parseSettings) {
|
|
40
|
+
var _a;
|
|
41
|
+
log('Getting default program for: %s', parseSettings.filePath || 'unnamed file');
|
|
42
|
+
if (((_a = parseSettings.projects) === null || _a === void 0 ? void 0 : _a.length) !== 1) {
|
|
45
43
|
return undefined;
|
|
46
44
|
}
|
|
47
|
-
const tsconfigPath =
|
|
48
|
-
const commandLine = ts.getParsedCommandLineOfConfigFile(tsconfigPath, (0, shared_1.createDefaultCompilerOptionsFromExtra)(
|
|
45
|
+
const tsconfigPath = parseSettings.projects[0];
|
|
46
|
+
const commandLine = ts.getParsedCommandLineOfConfigFile(tsconfigPath, (0, shared_1.createDefaultCompilerOptionsFromExtra)(parseSettings), Object.assign(Object.assign({}, ts.sys), { onUnRecoverableConfigFileDiagnostic: () => { } }));
|
|
49
47
|
if (!commandLine) {
|
|
50
48
|
return undefined;
|
|
51
49
|
}
|
|
52
50
|
const compilerHost = ts.createCompilerHost(commandLine.options,
|
|
53
51
|
/* setParentNodes */ true);
|
|
54
|
-
if (
|
|
55
|
-
compilerHost.resolveModuleNames = (0, shared_1.getModuleResolver)(
|
|
52
|
+
if (parseSettings.moduleResolver) {
|
|
53
|
+
compilerHost.resolveModuleNames = (0, shared_1.getModuleResolver)(parseSettings.moduleResolver).resolveModuleNames;
|
|
56
54
|
}
|
|
57
55
|
const oldReadFile = compilerHost.readFile;
|
|
58
|
-
compilerHost.readFile = (fileName) => path_1.default.normalize(fileName) === path_1.default.normalize(
|
|
59
|
-
? code
|
|
56
|
+
compilerHost.readFile = (fileName) => path_1.default.normalize(fileName) === path_1.default.normalize(parseSettings.filePath)
|
|
57
|
+
? parseSettings.code
|
|
60
58
|
: oldReadFile(fileName);
|
|
61
|
-
const program = ts.createProgram([
|
|
62
|
-
const ast = program.getSourceFile(
|
|
59
|
+
const program = ts.createProgram([parseSettings.filePath], commandLine.options, compilerHost);
|
|
60
|
+
const ast = program.getSourceFile(parseSettings.filePath);
|
|
63
61
|
return ast && { ast, program };
|
|
64
62
|
}
|
|
65
63
|
exports.createDefaultProgram = createDefaultProgram;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDefaultProgram.js","sourceRoot":"","sources":["../../src/create-program/createDefaultProgram.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AACxB,+CAAiC;AAIjC,qCAGkB;AAElB,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,0DAA0D,CAAC,CAAC;AAE9E
|
|
1
|
+
{"version":3,"file":"createDefaultProgram.js","sourceRoot":"","sources":["../../src/create-program/createDefaultProgram.ts"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AQ,CAAC,CAAC;IAE5B,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,CAC9B,CAAC,aAAa,CAAC,QAAQ,CAAC,EACxB,WAAW,CAAC,OAAO,EACnB,YAAY,CACb,CAAC;IACF,MAAM,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAE1D,OAAO,GAAG,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC;AAEQ,oDAAoB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParseSettings } from '../parseSettings';
|
|
2
2
|
import type { ASTAndProgram } from './shared';
|
|
3
3
|
/**
|
|
4
4
|
* @param code The code of the file being linted
|
|
5
5
|
* @returns Returns a new source file and program corresponding to the linted code
|
|
6
6
|
*/
|
|
7
|
-
declare function createIsolatedProgram(
|
|
7
|
+
declare function createIsolatedProgram(parseSettings: ParseSettings): ASTAndProgram;
|
|
8
8
|
export { createIsolatedProgram };
|
|
9
9
|
//# sourceMappingURL=createIsolatedProgram.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIsolatedProgram.d.ts","sourceRoot":"","sources":["../../src/create-program/createIsolatedProgram.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createIsolatedProgram.d.ts","sourceRoot":"","sources":["../../src/create-program/createIsolatedProgram.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAK9C;;;GAGG;AACH,iBAAS,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,CAmE1E;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -36,14 +36,14 @@ const log = (0, debug_1.default)('typescript-eslint:typescript-estree:createIsol
|
|
|
36
36
|
* @param code The code of the file being linted
|
|
37
37
|
* @returns Returns a new source file and program corresponding to the linted code
|
|
38
38
|
*/
|
|
39
|
-
function createIsolatedProgram(
|
|
40
|
-
log('Getting isolated program in %s mode for: %s',
|
|
39
|
+
function createIsolatedProgram(parseSettings) {
|
|
40
|
+
log('Getting isolated program in %s mode for: %s', parseSettings.jsx ? 'TSX' : 'TS', parseSettings.filePath);
|
|
41
41
|
const compilerHost = {
|
|
42
42
|
fileExists() {
|
|
43
43
|
return true;
|
|
44
44
|
},
|
|
45
45
|
getCanonicalFileName() {
|
|
46
|
-
return
|
|
46
|
+
return parseSettings.filePath;
|
|
47
47
|
},
|
|
48
48
|
getCurrentDirectory() {
|
|
49
49
|
return '';
|
|
@@ -59,8 +59,8 @@ function createIsolatedProgram(code, extra) {
|
|
|
59
59
|
return '\n';
|
|
60
60
|
},
|
|
61
61
|
getSourceFile(filename) {
|
|
62
|
-
return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest,
|
|
63
|
-
/* setParentNodes */ true, (0, getScriptKind_1.getScriptKind)(
|
|
62
|
+
return ts.createSourceFile(filename, parseSettings.code, ts.ScriptTarget.Latest,
|
|
63
|
+
/* setParentNodes */ true, (0, getScriptKind_1.getScriptKind)(parseSettings.filePath, parseSettings.jsx));
|
|
64
64
|
},
|
|
65
65
|
readFile() {
|
|
66
66
|
return undefined;
|
|
@@ -72,8 +72,8 @@ function createIsolatedProgram(code, extra) {
|
|
|
72
72
|
return null;
|
|
73
73
|
},
|
|
74
74
|
};
|
|
75
|
-
const program = ts.createProgram([
|
|
76
|
-
const ast = program.getSourceFile(
|
|
75
|
+
const program = ts.createProgram([parseSettings.filePath], Object.assign({ noResolve: true, target: ts.ScriptTarget.Latest, jsx: parseSettings.jsx ? ts.JsxEmit.Preserve : undefined }, (0, shared_1.createDefaultCompilerOptionsFromExtra)(parseSettings)), compilerHost);
|
|
76
|
+
const ast = program.getSourceFile(parseSettings.filePath);
|
|
77
77
|
if (!ast) {
|
|
78
78
|
throw new Error('Expected an ast to be returned for the single-file isolated program.');
|
|
79
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIsolatedProgram.js","sourceRoot":"","sources":["../../src/create-program/createIsolatedProgram.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+CAAiC;AAGjC,mDAAgD;AAEhD,qCAAiE;AAEjE,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,2DAA2D,CAAC,CAAC;AAE/E;;;GAGG;AACH,SAAS,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"createIsolatedProgram.js","sourceRoot":"","sources":["../../src/create-program/createIsolatedProgram.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+CAAiC;AAGjC,mDAAgD;AAEhD,qCAAiE;AAEjE,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,2DAA2D,CAAC,CAAC;AAE/E;;;GAGG;AACH,SAAS,qBAAqB,CAAC,aAA4B;IACzD,GAAG,CACD,6CAA6C,EAC7C,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAChC,aAAa,CAAC,QAAQ,CACvB,CAAC;IAEF,MAAM,YAAY,GAAoB;QACpC,UAAU;YACR,OAAO,IAAI,CAAC;QACd,CAAC;QACD,oBAAoB;YAClB,OAAO,aAAa,CAAC,QAAQ,CAAC;QAChC,CAAC;QACD,mBAAmB;YACjB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,cAAc;YACZ,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,qBAAqB;YACnB,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,6BAA6B;QAC7B,UAAU;YACR,OAAO,IAAI,CAAC;QACd,CAAC;QACD,aAAa,CAAC,QAAgB;YAC5B,OAAO,EAAE,CAAC,gBAAgB,CACxB,QAAQ,EACR,aAAa,CAAC,IAAI,EAClB,EAAE,CAAC,YAAY,CAAC,MAAM;YACtB,oBAAoB,CAAC,IAAI,EACzB,IAAA,6BAAa,EAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,CACzD,CAAC;QACJ,CAAC;QACD,QAAQ;YACN,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,yBAAyB;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,SAAS;YACP,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;IAEF,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,CAC9B,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAEtB,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAC9B,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,IACrD,IAAA,8CAAqC,EAAC,aAAa,CAAC,GAEzD,YAAY,CACb,CAAC;IAEF,MAAM,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC1D,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;KACH;IAED,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAC1B,CAAC;AAEQ,sDAAqB"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParseSettings } from '../parseSettings';
|
|
2
2
|
import type { ASTAndProgram } from './shared';
|
|
3
3
|
/**
|
|
4
|
-
* @param
|
|
5
|
-
* @
|
|
6
|
-
* @param extra The config object
|
|
7
|
-
* @returns If found, returns the source file corresponding to the code and the containing program
|
|
4
|
+
* @param parseSettings Internal settings for parsing the file
|
|
5
|
+
* @returns If found, the source file corresponding to the code and the containing program
|
|
8
6
|
*/
|
|
9
|
-
declare function createProjectProgram(
|
|
7
|
+
declare function createProjectProgram(parseSettings: ParseSettings): ASTAndProgram | undefined;
|
|
10
8
|
export { createProjectProgram };
|
|
11
9
|
//# sourceMappingURL=createProjectProgram.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createProjectProgram.d.ts","sourceRoot":"","sources":["../../src/create-program/createProjectProgram.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createProjectProgram.d.ts","sourceRoot":"","sources":["../../src/create-program/createProjectProgram.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAgB9C;;;GAGG;AACH,iBAAS,oBAAoB,CAC3B,aAAa,EAAE,aAAa,GAC3B,aAAa,GAAG,SAAS,CAmF3B;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -45,50 +45,63 @@ const DEFAULT_EXTRA_FILE_EXTENSIONS = [
|
|
|
45
45
|
ts.Extension.Cts,
|
|
46
46
|
];
|
|
47
47
|
/**
|
|
48
|
-
* @param
|
|
49
|
-
* @
|
|
50
|
-
* @param extra The config object
|
|
51
|
-
* @returns If found, returns the source file corresponding to the code and the containing program
|
|
48
|
+
* @param parseSettings Internal settings for parsing the file
|
|
49
|
+
* @returns If found, the source file corresponding to the code and the containing program
|
|
52
50
|
*/
|
|
53
|
-
function createProjectProgram(
|
|
54
|
-
log('Creating project program for: %s',
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
51
|
+
function createProjectProgram(parseSettings) {
|
|
52
|
+
log('Creating project program for: %s', parseSettings.filePath);
|
|
53
|
+
const programsForProjects = (0, createWatchProgram_1.getProgramsForProjects)(parseSettings);
|
|
54
|
+
const astAndProgram = (0, node_utils_1.firstDefined)(programsForProjects, currentProgram => (0, shared_1.getAstFromProgram)(currentProgram, parseSettings));
|
|
55
|
+
// The file was either matched within the tsconfig, or we allow creating a default program
|
|
56
|
+
if (astAndProgram || parseSettings.createDefaultProgram) {
|
|
57
|
+
return astAndProgram;
|
|
58
|
+
}
|
|
59
|
+
const describeFilePath = (filePath) => {
|
|
60
|
+
const relative = path_1.default.relative(parseSettings.tsconfigRootDir || process.cwd(), filePath);
|
|
61
|
+
if (parseSettings.tsconfigRootDir) {
|
|
62
|
+
return `<tsconfigRootDir>/${relative}`;
|
|
63
|
+
}
|
|
64
|
+
return `<cwd>/${relative}`;
|
|
65
|
+
};
|
|
66
|
+
const describedFilePath = describeFilePath(parseSettings.filePath);
|
|
67
|
+
const relativeProjects = parseSettings.projects.map(describeFilePath);
|
|
68
|
+
const describedPrograms = relativeProjects.length === 1
|
|
69
|
+
? relativeProjects[0]
|
|
70
|
+
: `\n${relativeProjects.map(project => `- ${project}`).join('\n')}`;
|
|
71
|
+
const errorLines = [
|
|
72
|
+
`ESLint was configured to run on \`${describedFilePath}\` using \`parserOptions.project\`: ${describedPrograms}`,
|
|
73
|
+
];
|
|
74
|
+
let hasMatchedAnError = false;
|
|
75
|
+
const extraFileExtensions = parseSettings.extraFileExtensions || [];
|
|
76
|
+
extraFileExtensions.forEach(extraExtension => {
|
|
77
|
+
if (!extraExtension.startsWith('.')) {
|
|
78
|
+
errorLines.push(`Found unexpected extension \`${extraExtension}\` specified with the \`parserOptions.extraFileExtensions\` option. Did you mean \`.${extraExtension}\`?`);
|
|
79
|
+
}
|
|
80
|
+
if (DEFAULT_EXTRA_FILE_EXTENSIONS.includes(extraExtension)) {
|
|
81
|
+
errorLines.push(`You unnecessarily included the extension \`${extraExtension}\` with the \`parserOptions.extraFileExtensions\` option. This extension is already handled by the parser by default.`);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const fileExtension = path_1.default.extname(parseSettings.filePath);
|
|
85
|
+
if (!DEFAULT_EXTRA_FILE_EXTENSIONS.includes(fileExtension)) {
|
|
86
|
+
const nonStandardExt = `The extension for the file (\`${fileExtension}\`) is non-standard`;
|
|
87
|
+
if (extraFileExtensions.length > 0) {
|
|
88
|
+
if (!extraFileExtensions.includes(fileExtension)) {
|
|
89
|
+
errorLines.push(`${nonStandardExt}. It should be added to your existing \`parserOptions.extraFileExtensions\`.`);
|
|
83
90
|
hasMatchedAnError = true;
|
|
84
91
|
}
|
|
85
92
|
}
|
|
86
|
-
|
|
87
|
-
errorLines.push(
|
|
93
|
+
else {
|
|
94
|
+
errorLines.push(`${nonStandardExt}. You should add \`parserOptions.extraFileExtensions\` to your config.`);
|
|
95
|
+
hasMatchedAnError = true;
|
|
88
96
|
}
|
|
89
|
-
throw new Error(errorLines.join('\n'));
|
|
90
97
|
}
|
|
91
|
-
|
|
98
|
+
if (!hasMatchedAnError) {
|
|
99
|
+
const [describedInclusions, describedSpecifiers] = parseSettings.projects.length === 1
|
|
100
|
+
? ['that TSConfig does not', 'that TSConfig']
|
|
101
|
+
: ['none of those TSConfigs', 'one of those TSConfigs'];
|
|
102
|
+
errorLines.push(`However, ${describedInclusions} include this file. Either:`, `- Change ESLint's list of included files to not include this file`, `- Change ${describedSpecifiers} to include this file`, `- Create a new TSConfig that includes this file and include it in your parserOptions.project`, `See the TypeScript ESLint docs for more info: https://typescript-eslint.io/docs/linting/troubleshooting##i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file`);
|
|
103
|
+
}
|
|
104
|
+
throw new Error(errorLines.join('\n'));
|
|
92
105
|
}
|
|
93
106
|
exports.createProjectProgram = createProjectProgram;
|
|
94
107
|
//# sourceMappingURL=createProjectProgram.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createProjectProgram.js","sourceRoot":"","sources":["../../src/create-program/createProjectProgram.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AACxB,+CAAiC;AAEjC,8CAA6C;AAE7C,6DAA8D;AAE9D,qCAA6C;AAE7C,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,0DAA0D,CAAC,CAAC;AAE9E,MAAM,6BAA6B,GAAG;IACpC,EAAE,CAAC,SAAS,CAAC,EAAE;IACf,EAAE,CAAC,SAAS,CAAC,GAAG;IAChB,EAAE,CAAC,SAAS,CAAC,EAAE;IACf,EAAE,CAAC,SAAS,CAAC,GAAG;IAChB,EAAE,CAAC,SAAS,CAAC,GAAG;IAChB,EAAE,CAAC,SAAS,CAAC,GAAG;IAChB,EAAE,CAAC,SAAS,CAAC,GAAG;IAChB,EAAE,CAAC,SAAS,CAAC,GAAG;CACI,CAAC;AAEvB
|
|
1
|
+
{"version":3,"file":"createProjectProgram.js","sourceRoot":"","sources":["../../src/create-program/createProjectProgram.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AACxB,+CAAiC;AAEjC,8CAA6C;AAE7C,6DAA8D;AAE9D,qCAA6C;AAE7C,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,0DAA0D,CAAC,CAAC;AAE9E,MAAM,6BAA6B,GAAG;IACpC,EAAE,CAAC,SAAS,CAAC,EAAE;IACf,EAAE,CAAC,SAAS,CAAC,GAAG;IAChB,EAAE,CAAC,SAAS,CAAC,EAAE;IACf,EAAE,CAAC,SAAS,CAAC,GAAG;IAChB,EAAE,CAAC,SAAS,CAAC,GAAG;IAChB,EAAE,CAAC,SAAS,CAAC,GAAG;IACh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AC,CAAC,yBAAyB,EAAE,wBAAwB,CAAC,CAAC;QAC5D,UAAU,CAAC,IAAI,CACb,YAAY,mBAAmB,6BAA6B,EAC5D,mEAAmE,EACnE,YAAY,mBAAmB,uBAAuB,EACtD,8FAA8F,EAC9F,0OAA0O,CAC3O,CAAC;KACH;IAED,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACzC,CAAC;AAEQ,oDAAoB"}
|
package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
|
-
import type {
|
|
3
|
-
declare function createSourceFile(
|
|
2
|
+
import type { ParseSettings } from '../parseSettings';
|
|
3
|
+
declare function createSourceFile(parseSettings: ParseSettings): ts.SourceFile;
|
|
4
4
|
export { createSourceFile };
|
|
5
5
|
//# sourceMappingURL=createSourceFile.d.ts.map
|