@typescript-eslint/typescript-estree 8.32.2-alpha.9 → 8.33.0

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.
@@ -10,10 +10,6 @@ export interface ASTAndDefiniteProgram {
10
10
  program: ts.Program;
11
11
  }
12
12
  export type ASTAndProgram = ASTAndDefiniteProgram | ASTAndNoProgram;
13
- /**
14
- * Compiler options required to avoid critical functionality issues
15
- */
16
- export declare const CORE_COMPILER_OPTIONS: ts.CompilerOptions;
17
13
  export declare const DEFAULT_EXTRA_FILE_EXTENSIONS: Set<string>;
18
14
  export declare function createDefaultCompilerOptionsFromExtra(parseSettings: ParseSettings): ts.CompilerOptions;
19
15
  export type CanonicalPath = {
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/create-program/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC;IACnB,OAAO,EAAE,IAAI,CAAC;CACf;AACD,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC;IACnB,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;CACrB;AACD,MAAM,MAAM,aAAa,GAAG,qBAAqB,GAAG,eAAe,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,eAQtC,CAAC;AAYF,eAAO,MAAM,6BAA6B,aASxC,CAAC;AAEH,wBAAgB,qCAAqC,CACnD,aAAa,EAAE,aAAa,GAC3B,EAAE,CAAC,eAAe,CASpB;AAGD,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,G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,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAI7E;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAEhE;AAmBD,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,OAAO,EACvB,QAAQ,EAAE,MAAM,GACf,qBAAqB,GAAG,SAAS,CAWnC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOlD"}
@@ -36,31 +36,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.DEFAULT_EXTRA_FILE_EXTENSIONS = exports.CORE_COMPILER_OPTIONS = void 0;
39
+ exports.DEFAULT_EXTRA_FILE_EXTENSIONS = void 0;
40
40
  exports.createDefaultCompilerOptionsFromExtra = createDefaultCompilerOptionsFromExtra;
41
41
  exports.getCanonicalFileName = getCanonicalFileName;
42
42
  exports.ensureAbsolutePath = ensureAbsolutePath;
43
43
  exports.canonicalDirname = canonicalDirname;
44
44
  exports.getAstFromProgram = getAstFromProgram;
45
45
  exports.createHash = createHash;
46
+ const tsconfig_utils_1 = require("@typescript-eslint/tsconfig-utils");
46
47
  const node_path_1 = __importDefault(require("node:path"));
47
48
  const ts = __importStar(require("typescript"));
48
- /**
49
- * Compiler options required to avoid critical functionality issues
50
- */
51
- exports.CORE_COMPILER_OPTIONS = {
52
- noEmit: true, // required to avoid parse from causing emit to occur
53
- /**
54
- * Flags required to make no-unused-vars work
55
- */
56
- noUnusedLocals: true,
57
- noUnusedParameters: true,
58
- };
59
49
  /**
60
50
  * Default compiler options for program generation
61
51
  */
62
52
  const DEFAULT_COMPILER_OPTIONS = {
63
- ...exports.CORE_COMPILER_OPTIONS,
53
+ ...tsconfig_utils_1.CORE_COMPILER_OPTIONS,
64
54
  allowJs: true,
65
55
  allowNonTsExtensions: true,
66
56
  checkJs: true,
@@ -1 +1 @@
1
- {"version":3,"file":"useProvidedPrograms.d.ts","sourceRoot":"","sources":["../../src/create-program/useProvidedPrograms.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAStD,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,EACtC,aAAa,EAAE,aAAa,GAC3B,qBAAqB,GAAG,SAAS,CAoCnC;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,MAAM,GACxB,EAAE,CAAC,OAAO,CAIZ"}
1
+ {"version":3,"file":"useProvidedPrograms.d.ts","sourceRoot":"","sources":["../../src/create-program/useProvidedPrograms.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAQtD,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,EACtC,aAAa,EAAE,aAAa,GAC3B,qBAAqB,GAAG,SAAS,CAoCnC;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,MAAM,GACxB,EAAE,CAAC,OAAO,CAIZ"}
@@ -38,10 +38,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.useProvidedPrograms = useProvidedPrograms;
40
40
  exports.createProgramFromConfigFile = createProgramFromConfigFile;
41
+ const tsconfig_utils_1 = require("@typescript-eslint/tsconfig-utils");
41
42
  const debug_1 = __importDefault(require("debug"));
42
43
  const path = __importStar(require("node:path"));
43
44
  const ts = __importStar(require("typescript"));
44
- const getParsedConfigFile_1 = require("./getParsedConfigFile");
45
45
  const shared_1 = require("./shared");
46
46
  const log = (0, debug_1.default)('typescript-eslint:typescript-estree:create-program:useProvidedPrograms');
47
47
  function useProvidedPrograms(programInstances, parseSettings) {
@@ -75,7 +75,7 @@ function useProvidedPrograms(programInstances, parseSettings) {
75
75
  * @param projectDirectory the project directory to use as the CWD, defaults to `process.cwd()`
76
76
  */
77
77
  function createProgramFromConfigFile(configFile, projectDirectory) {
78
- const parsed = (0, getParsedConfigFile_1.getParsedConfigFile)(ts, configFile, projectDirectory);
78
+ const parsed = (0, tsconfig_utils_1.getParsedConfigFile)(ts, configFile, projectDirectory);
79
79
  const host = ts.createCompilerHost(parsed.options, true);
80
80
  return ts.createProgram(parsed.fileNames, parsed.options, host);
81
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createParseSettings.d.ts","sourceRoot":"","sources":["../../src/parseSettings/createParseSettings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAiCpD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,EAC5B,eAAe,GAAE,OAAO,CAAC,eAAe,CAAM,GAC7C,oBAAoB,CAyJtB;AAED,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAElD"}
1
+ {"version":3,"file":"createParseSettings.d.ts","sourceRoot":"","sources":["../../src/parseSettings/createParseSettings.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAiCpD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,EAC5B,eAAe,GAAE,OAAO,CAAC,eAAe,CAAM,GAC7C,oBAAoB,CAwJtB;AAED,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAElD"}
@@ -39,11 +39,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.createParseSettings = createParseSettings;
40
40
  exports.clearTSConfigMatchCache = clearTSConfigMatchCache;
41
41
  exports.clearTSServerProjectService = clearTSServerProjectService;
42
+ const project_service_1 = require("@typescript-eslint/project-service");
42
43
  const debug_1 = __importDefault(require("debug"));
43
44
  const node_path_1 = __importDefault(require("node:path"));
44
45
  const ts = __importStar(require("typescript"));
45
- const createProjectService_1 = require("../create-program/createProjectService");
46
46
  const shared_1 = require("../create-program/shared");
47
+ const validateDefaultProjectForFilesGlob_1 = require("../create-program/validateDefaultProjectForFilesGlob");
47
48
  const source_files_1 = require("../source-files");
48
49
  const ExpiringCache_1 = require("./ExpiringCache");
49
50
  const getProjectConfigFiles_1 = require("./getProjectConfigFiles");
@@ -124,7 +125,10 @@ function createParseSettings(code, tsestreeOptions = {}) {
124
125
  (tsestreeOptions.project &&
125
126
  tsestreeOptions.projectService !== false &&
126
127
  process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE === 'true')
127
- ? (TSSERVER_PROJECT_SERVICE ??= (0, createProjectService_1.createProjectService)(tsestreeOptions.projectService, jsDocParsingMode, tsconfigRootDir))
128
+ ? populateProjectService(tsestreeOptions.projectService, {
129
+ jsDocParsingMode,
130
+ tsconfigRootDir,
131
+ })
128
132
  : undefined,
129
133
  setExternalModuleIndicator: tsestreeOptions.sourceType === 'module' ||
130
134
  (tsestreeOptions.sourceType == null && extension === ts.Extension.Mjs) ||
@@ -209,3 +213,12 @@ function enforceCodeString(code) {
209
213
  function getFileName(jsx) {
210
214
  return jsx ? 'estree.tsx' : 'estree.ts';
211
215
  }
216
+ function populateProjectService(optionsRaw, settings) {
217
+ const options = typeof optionsRaw === 'object' ? optionsRaw : {};
218
+ (0, validateDefaultProjectForFilesGlob_1.validateDefaultProjectForFilesGlob)(options.allowDefaultProject);
219
+ TSSERVER_PROJECT_SERVICE ??= (0, project_service_1.createProjectService)({
220
+ options,
221
+ ...settings,
222
+ });
223
+ return TSSERVER_PROJECT_SERVICE;
224
+ }
@@ -1,5 +1,5 @@
1
+ import type { ProjectServiceAndMetadata } from '@typescript-eslint/project-service';
1
2
  import type * as ts from 'typescript';
2
- import type { ProjectServiceSettings } from '../create-program/createProjectService';
3
3
  import type { CanonicalPath } from '../create-program/shared';
4
4
  import type { TSESTree } from '../ts-estree';
5
5
  import type { CacheLike } from './ExpiringCache';
@@ -96,7 +96,7 @@ export interface MutableParseSettings {
96
96
  /**
97
97
  * TypeScript server to power program creation.
98
98
  */
99
- projectService: ProjectServiceSettings | undefined;
99
+ projectService: ProjectServiceAndMetadata | undefined;
100
100
  /**
101
101
  * Whether to add the `range` property to AST nodes.
102
102
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parseSettings/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,KAAK,WAAW,GAAG,QAAQ,GAAG,YAAY,GAAG,mBAAmB,CAAC;AAGjE,OAAO,QAAQ,YAAY,CAAC;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AC,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import type { CacheDurationSeconds, DebugLevel, JSDocParsingMode, ProjectServiceOptions, SourceType } from '@typescript-eslint/types';
2
2
  import type * as ts from 'typescript';
3
3
  import type { TSESTree, TSESTreeToTSNode, TSNode, TSToken } from './ts-estree';
4
- export type { ProjectServiceOptions } from '@typescript-eslint/types';
5
4
  interface ParseOptions {
6
5
  /**
7
6
  * Specify the `sourceType`.
@@ -204,4 +203,5 @@ export interface ParserServicesWithoutTypeInformation extends ParserServicesNode
204
203
  program: null;
205
204
  }
206
205
  export type ParserServices = ParserServicesWithoutTypeInformation | ParserServicesWithTypeInformation;
206
+ export {};
207
207
  //# sourceMappingURL=parser-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parser-options.d.ts","sourceRoot":"","sources":["../src/parser-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACX,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE/E,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMtE,UAAU,YAAY;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC;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W,sBAAsB;IACrC,qBAAqB,EAAE,2BAA2B,CAAC;IACnD,qBAAqB,EAAE,aAAa,CAAC,MAAM,GAAG,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CACvE;AACD,MAAM,WAAW,iCACf,SAAQ,sBAAsB,EAC5B,kBAAkB;IACpB,mBAAmB,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC;IACpE,iBAAiB,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC;IACpD,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;CACrB;AACD,MAAM,WAAW,oCACf,SAAQ,sBAAsB,EAC5B,kBAAkB;IACpB,OAAO,EAAE,IAAI,CAAC;CACf;AACD,MAAM,MAAM,cAAc,GACtB,oCAAoC,GACpC,iCAAiC,CAAC"}
@@ -1,7 +1,7 @@
1
- import type { ProjectServiceSettings } from './create-program/createProjectService';
1
+ import type { ProjectServiceAndMetadata as ProjectServiceAndMetadata } from '@typescript-eslint/project-service';
2
2
  import type { ASTAndDefiniteProgram, ASTAndNoProgram, ASTAndProgram } from './create-program/shared';
3
3
  import type { MutableParseSettings } from './parseSettings';
4
- export declare function useProgramFromProjectService(settings: ProjectServiceSettings, parseSettings: Readonly<MutableParseSettings>, hasFullTypeInformation: boolean, defaultProjectMatchedFiles: Set<string>): ASTAndProgram | undefined;
5
- export declare function useProgramFromProjectService(settings: ProjectServiceSettings, parseSettings: Readonly<MutableParseSettings>, hasFullTypeInformation: true, defaultProjectMatchedFiles: Set<string>): ASTAndDefiniteProgram | undefined;
6
- export declare function useProgramFromProjectService(settings: ProjectServiceSettings, parseSettings: Readonly<MutableParseSettings>, hasFullTypeInformation: false, defaultProjectMatchedFiles: Set<string>): ASTAndNoProgram | undefined;
4
+ export declare function useProgramFromProjectService(serviceAndSettings: ProjectServiceAndMetadata, parseSettings: Readonly<MutableParseSettings>, hasFullTypeInformation: boolean, defaultProjectMatchedFiles: Set<string>): ASTAndProgram | undefined;
5
+ export declare function useProgramFromProjectService(serviceAndSettings: ProjectServiceAndMetadata, parseSettings: Readonly<MutableParseSettings>, hasFullTypeInformation: true, defaultProjectMatchedFiles: Set<string>): ASTAndDefiniteProgram | undefined;
6
+ export declare function useProgramFromProjectService(serviceAndSettings: ProjectServiceAndMetadata, parseSettings: Readonly<MutableParseSettings>, hasFullTypeInformation: false, defaultProjectMatchedFiles: Set<string>): ASTAndNoProgram | undefined;
7
7
  //# sourceMappingURL=useProgramFromProjectService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProgramFromProjectService.d.ts","sourceRoot":"","sources":["../src/useProgramFromProjectService.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AA4M5D,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,sBAAsB,EAChC,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAC7C,sBAAsB,EAAE,OAAO,EAC/B,0BAA0B,EAAE,GAAG,CAAC,MAAM,CAAC,GACtC,aAAa,GAAG,SAAS,CAAC;AAC7B,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,sBAAsB,EAChC,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAC7C,sBAAsB,EAAE,IAAI,EAC5B,0BAA0B,EAAE,GAAG,CAAC,MAAM,CAAC,GACtC,qBAAqB,GAAG,SAAS,CAAC;AACrC,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,sBAAsB,EAChC,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAC7C,sBAAsB,EAAE,KAAK,EAC7B,0BAA0B,EAAE,GAAG,CAAC,MAAM,CAAC,GACtC,eAAe,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"useProgramFromProjectService.d.ts","sourceRoot":"","sources":["../src/useProgramFromProjectService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,IAAI,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAQjH,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AA4M5D,wBAAgB,4BAA4B,CAC1C,kBAAkB,EAAE,yBAAyB,EAC7C,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAC7C,sBAAsB,EAAE,OAAO,EAC/B,0BAA0B,EAAE,GAAG,CAAC,MAAM,CAAC,GACtC,aAAa,GAAG,SAAS,CAAC;AAC7B,wBAAgB,4BAA4B,CAC1C,kBAAkB,EAAE,yBAAyB,EAC7C,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAC7C,sBAAsB,EAAE,IAAI,EAC5B,0BAA0B,EAAE,GAAG,CAAC,MAAM,CAAC,GACtC,qBAAqB,GAAG,SAAS,CAAC;AACrC,wBAAgB,4BAA4B,CAC1C,kBAAkB,EAAE,yBAAyB,EAC7C,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAC7C,sBAAsB,EAAE,KAAK,EAC7B,0BAA0B,EAAE,GAAG,CAAC,MAAM,CAAC,GACtC,eAAe,GAAG,SAAS,CAAC"}
@@ -64,7 +64,7 @@ const updateExtraFileExtensions = (service, extraFileExtensions) => {
64
64
  log('Extra file extensions updated: %o', extraFileExtensions);
65
65
  }
66
66
  };
67
- function openClientFileFromProjectService(defaultProjectMatchedFiles, isDefaultProjectAllowed, filePathAbsolute, parseSettings, serviceSettings) {
67
+ function openClientFileFromProjectService(defaultProjectMatchedFiles, isDefaultProjectAllowed, filePathAbsolute, parseSettings, serviceAndSettings) {
68
68
  const opened = openClientFileAndMaybeReload();
69
69
  log('Result from attempting to open client file: %o', opened);
70
70
  log('Default project allowed path: %s, based on config file: %s', isDefaultProjectAllowed, opened.configFileName);
@@ -96,11 +96,11 @@ function openClientFileFromProjectService(defaultProjectMatchedFiles, isDefaultP
96
96
  if (!opened.configFileName) {
97
97
  defaultProjectMatchedFiles.add(filePathAbsolute);
98
98
  if (defaultProjectMatchedFiles.size >
99
- serviceSettings.maximumDefaultProjectFileMatchCount) {
99
+ serviceAndSettings.maximumDefaultProjectFileMatchCount) {
100
100
  const filePrintLimit = 20;
101
101
  const filesToPrint = [...defaultProjectMatchedFiles].slice(0, filePrintLimit);
102
102
  const truncatedFileCount = defaultProjectMatchedFiles.size - filesToPrint.length;
103
- throw new Error(`Too many files (>${serviceSettings.maximumDefaultProjectFileMatchCount}) have matched the default project.${validateDefaultProjectForFilesGlob_1.DEFAULT_PROJECT_FILES_ERROR_EXPLANATION}
103
+ throw new Error(`Too many files (>${serviceAndSettings.maximumDefaultProjectFileMatchCount}) have matched the default project.${validateDefaultProjectForFilesGlob_1.DEFAULT_PROJECT_FILES_ERROR_EXPLANATION}
104
104
  Matching files:
105
105
  ${filesToPrint.map(file => `- ${file}`).join('\n')}
106
106
  ${truncatedFileCount ? `...and ${truncatedFileCount} more files\n` : ''}
@@ -110,7 +110,7 @@ If you absolutely need more files included, set parserOptions.projectService.max
110
110
  }
111
111
  return opened;
112
112
  function openClientFile() {
113
- return serviceSettings.service.openClientFile(filePathAbsolute, parseSettings.codeFullText,
113
+ return serviceAndSettings.service.openClientFile(filePathAbsolute, parseSettings.codeFullText,
114
114
  /* scriptKind */ undefined, parseSettings.tsconfigRootDir);
115
115
  }
116
116
  function openClientFileAndMaybeReload() {
@@ -123,12 +123,12 @@ If you absolutely need more files included, set parserOptions.projectService.max
123
123
  !opened.configFileName &&
124
124
  !parseSettings.singleRun &&
125
125
  !isDefaultProjectAllowed &&
126
- performance.now() - serviceSettings.lastReloadTimestamp >
126
+ performance.now() - serviceAndSettings.lastReloadTimestamp >
127
127
  RELOAD_THROTTLE_MS) {
128
128
  log('No config file found; reloading project service and retrying.');
129
- serviceSettings.service.reloadProjects();
129
+ serviceAndSettings.service.reloadProjects();
130
130
  opened = openClientFile();
131
- serviceSettings.lastReloadTimestamp = performance.now();
131
+ serviceAndSettings.lastReloadTimestamp = performance.now();
132
132
  }
133
133
  return opened;
134
134
  }
@@ -146,11 +146,11 @@ function createNoProgramWithProjectService(filePathAbsolute, parseSettings, serv
146
146
  }
147
147
  return (0, createSourceFile_1.createNoProgram)(parseSettings);
148
148
  }
149
- function retrieveASTAndProgramFor(filePathAbsolute, parseSettings, serviceSettings) {
149
+ function retrieveASTAndProgramFor(filePathAbsolute, parseSettings, serviceAndSettings) {
150
150
  log('Retrieving script info and then program for: %s', filePathAbsolute);
151
- const scriptInfo = serviceSettings.service.getScriptInfo(filePathAbsolute);
151
+ const scriptInfo = serviceAndSettings.service.getScriptInfo(filePathAbsolute);
152
152
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
153
- const program = serviceSettings.service
153
+ const program = serviceAndSettings.service
154
154
  .getDefaultProjectForFile(scriptInfo.fileName, true)
155
155
  .getLanguageService(/*ensureSynchronized*/ true)
156
156
  .getProgram();
@@ -162,19 +162,19 @@ function retrieveASTAndProgramFor(filePathAbsolute, parseSettings, serviceSettin
162
162
  log('Found project service program for: %s', filePathAbsolute);
163
163
  return (0, createProjectProgram_1.createProjectProgram)(parseSettings, [program]);
164
164
  }
165
- function useProgramFromProjectService(serviceSettings, parseSettings, hasFullTypeInformation, defaultProjectMatchedFiles) {
165
+ function useProgramFromProjectService(serviceAndSettings, parseSettings, hasFullTypeInformation, defaultProjectMatchedFiles) {
166
166
  // NOTE: triggers a full project reload when changes are detected
167
- updateExtraFileExtensions(serviceSettings.service, parseSettings.extraFileExtensions);
167
+ updateExtraFileExtensions(serviceAndSettings.service, parseSettings.extraFileExtensions);
168
168
  // We don't canonicalize the filename because it caused a performance regression.
169
169
  // See https://github.com/typescript-eslint/typescript-eslint/issues/8519
170
- const filePathAbsolute = absolutify(parseSettings.filePath, serviceSettings);
170
+ const filePathAbsolute = absolutify(parseSettings.filePath, serviceAndSettings);
171
171
  log('Opening project service file for: %s at absolute path %s', parseSettings.filePath, filePathAbsolute);
172
172
  const filePathRelative = node_path_1.default.relative(parseSettings.tsconfigRootDir, filePathAbsolute);
173
- const isDefaultProjectAllowed = filePathMatchedBy(filePathRelative, serviceSettings.allowDefaultProject);
173
+ const isDefaultProjectAllowed = filePathMatchedBy(filePathRelative, serviceAndSettings.allowDefaultProject);
174
174
  // Type-aware linting is disabled for this file.
175
175
  // However, type-aware lint rules might still rely on its contents.
176
176
  if (!hasFullTypeInformation && !isDefaultProjectAllowed) {
177
- return createNoProgramWithProjectService(filePathAbsolute, parseSettings, serviceSettings.service);
177
+ return createNoProgramWithProjectService(filePathAbsolute, parseSettings, serviceAndSettings.service);
178
178
  }
179
179
  // If type info was requested, we attempt to open it in the project service.
180
180
  // By now, the file is known to be one of:
@@ -182,14 +182,14 @@ function useProgramFromProjectService(serviceSettings, parseSettings, hasFullTyp
182
182
  // - allowlisted in the default project (valid configuration)
183
183
  // - neither, which openClientFileFromProjectService will throw an error for
184
184
  const opened = hasFullTypeInformation &&
185
- openClientFileFromProjectService(defaultProjectMatchedFiles, isDefaultProjectAllowed, filePathAbsolute, parseSettings, serviceSettings);
185
+ openClientFileFromProjectService(defaultProjectMatchedFiles, isDefaultProjectAllowed, filePathAbsolute, parseSettings, serviceAndSettings);
186
186
  log('Opened project service file: %o', opened);
187
- return retrieveASTAndProgramFor(filePathAbsolute, parseSettings, serviceSettings);
187
+ return retrieveASTAndProgramFor(filePathAbsolute, parseSettings, serviceAndSettings);
188
188
  }
189
- function absolutify(filePath, serviceSettings) {
189
+ function absolutify(filePath, serviceAndSettings) {
190
190
  return node_path_1.default.isAbsolute(filePath)
191
191
  ? filePath
192
- : node_path_1.default.join(serviceSettings.service.host.getCurrentDirectory(), filePath);
192
+ : node_path_1.default.join(serviceAndSettings.service.host.getCurrentDirectory(), filePath);
193
193
  }
194
194
  function filePathMatchedBy(filePath, allowDefaultProject) {
195
195
  return !!allowDefaultProject?.some(pattern => (0, minimatch_1.minimatch)(filePath, pattern));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/typescript-estree",
3
- "version": "8.32.2-alpha.9",
3
+ "version": "8.33.0",
4
4
  "description": "A parser that converts TypeScript source code into an ESTree compatible form",
5
5
  "files": [
6
6
  "dist",
@@ -53,8 +53,10 @@
53
53
  "typecheck": "yarn run -BT nx typecheck"
54
54
  },
55
55
  "dependencies": {
56
- "@typescript-eslint/types": "8.32.2-alpha.9",
57
- "@typescript-eslint/visitor-keys": "8.32.2-alpha.9",
56
+ "@typescript-eslint/project-service": "8.33.0",
57
+ "@typescript-eslint/tsconfig-utils": "8.33.0",
58
+ "@typescript-eslint/types": "8.33.0",
59
+ "@typescript-eslint/visitor-keys": "8.33.0",
58
60
  "debug": "^4.3.4",
59
61
  "fast-glob": "^3.3.2",
60
62
  "is-glob": "^4.0.3",
@@ -1,11 +0,0 @@
1
- import type * as ts from 'typescript/lib/tsserverlibrary';
2
- import type { ProjectServiceOptions } from '../parser-options';
3
- export type TypeScriptProjectService = ts.server.ProjectService;
4
- export interface ProjectServiceSettings {
5
- allowDefaultProject: string[] | undefined;
6
- lastReloadTimestamp: number;
7
- maximumDefaultProjectFileMatchCount: number;
8
- service: TypeScriptProjectService;
9
- }
10
- export declare function createProjectService(optionsRaw: boolean | ProjectServiceOptions | undefined, jsDocParsingMode: ts.JSDocParsingMode | undefined, tsconfigRootDir: string | undefined): ProjectServiceSettings;
11
- //# sourceMappingURL=createProjectService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createProjectService.d.ts","sourceRoot":"","sources":["../../src/create-program/createProjectService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAI1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AA6B/D,MAAM,MAAM,wBAAwB,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;AAEhE,MAAM,WAAW,sBAAsB;IACrC,mBAAmB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC1C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mCAAmC,EAAE,MAAM,CAAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC;CACnC;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,OAAO,GAAG,qBAAqB,GAAG,SAAS,EACvD,gBAAgB,EAAE,EAAE,CAAC,gBAAgB,GAAG,SAAS,EACjD,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,sBAAsB,CAoIxB"}
@@ -1,133 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createProjectService = createProjectService;
7
- const debug_1 = __importDefault(require("debug"));
8
- const getParsedConfigFile_1 = require("./getParsedConfigFile");
9
- const validateDefaultProjectForFilesGlob_1 = require("./validateDefaultProjectForFilesGlob");
10
- const DEFAULT_PROJECT_MATCHED_FILES_THRESHOLD = 8;
11
- const log = (0, debug_1.default)('typescript-eslint:typescript-estree:create-program:createProjectService');
12
- const logTsserverErr = (0, debug_1.default)('typescript-eslint:typescript-estree:tsserver:err');
13
- const logTsserverInfo = (0, debug_1.default)('typescript-eslint:typescript-estree:tsserver:info');
14
- const logTsserverPerf = (0, debug_1.default)('typescript-eslint:typescript-estree:tsserver:perf');
15
- const logTsserverEvent = (0, debug_1.default)('typescript-eslint:typescript-estree:tsserver:event');
16
- const doNothing = () => { };
17
- const createStubFileWatcher = () => ({
18
- close: doNothing,
19
- });
20
- function createProjectService(optionsRaw, jsDocParsingMode, tsconfigRootDir) {
21
- const optionsRawObject = typeof optionsRaw === 'object' ? optionsRaw : {};
22
- const options = {
23
- defaultProject: 'tsconfig.json',
24
- ...optionsRawObject,
25
- };
26
- (0, validateDefaultProjectForFilesGlob_1.validateDefaultProjectForFilesGlob)(options.allowDefaultProject);
27
- // We import this lazily to avoid its cost for users who don't use the service
28
- // TODO: Once we drop support for TS<5.3 we can import from "typescript" directly
29
- // eslint-disable-next-line @typescript-eslint/no-require-imports
30
- const tsserver = require('typescript/lib/tsserverlibrary');
31
- // TODO: see getWatchProgramsForProjects
32
- // We don't watch the disk, we just refer to these when ESLint calls us
33
- // there's a whole separate update pass in maybeInvalidateProgram at the bottom of getWatchProgramsForProjects
34
- // (this "goes nuclear on TypeScript")
35
- const system = {
36
- ...tsserver.sys,
37
- clearImmediate,
38
- clearTimeout,
39
- setImmediate,
40
- setTimeout,
41
- watchDirectory: createStubFileWatcher,
42
- watchFile: createStubFileWatcher,
43
- // We stop loading any TypeScript plugins by default, to prevent them from attaching disk watchers
44
- // See https://github.com/typescript-eslint/typescript-eslint/issues/9905
45
- ...(!options.loadTypeScriptPlugins && {
46
- require: () => ({
47
- error: {
48
- message: 'TypeScript plugins are not required when using parserOptions.projectService.',
49
- },
50
- module: undefined,
51
- }),
52
- }),
53
- };
54
- const logger = {
55
- close: doNothing,
56
- endGroup: doNothing,
57
- getLogFileName: () => undefined,
58
- // The debug library doesn't use levels without creating a namespace for each.
59
- // Log levels are not passed to the writer so we wouldn't be able to forward
60
- // to a respective namespace. Supporting would require an additional flag for
61
- // granular control. Defaulting to all levels for now.
62
- hasLevel: () => true,
63
- info(s) {
64
- this.msg(s, tsserver.server.Msg.Info);
65
- },
66
- loggingEnabled: () =>
67
- // if none of the debug namespaces are enabled, then don't enable logging in tsserver
68
- logTsserverInfo.enabled ||
69
- logTsserverErr.enabled ||
70
- logTsserverPerf.enabled,
71
- msg: (s, type) => {
72
- switch (type) {
73
- case tsserver.server.Msg.Err:
74
- logTsserverErr(s);
75
- break;
76
- case tsserver.server.Msg.Perf:
77
- logTsserverPerf(s);
78
- break;
79
- default:
80
- logTsserverInfo(s);
81
- }
82
- },
83
- perftrc(s) {
84
- this.msg(s, tsserver.server.Msg.Perf);
85
- },
86
- startGroup: doNothing,
87
- };
88
- log('Creating project service with: %o', options);
89
- const service = new tsserver.server.ProjectService({
90
- cancellationToken: { isCancellationRequested: () => false },
91
- eventHandler: logTsserverEvent.enabled
92
- ? (e) => {
93
- logTsserverEvent(e);
94
- }
95
- : undefined,
96
- host: system,
97
- jsDocParsingMode,
98
- logger,
99
- session: undefined,
100
- useInferredProjectPerProjectRoot: false,
101
- useSingleInferredProject: false,
102
- });
103
- service.setHostConfiguration({
104
- preferences: {
105
- includePackageJsonAutoImports: 'off',
106
- },
107
- });
108
- log('Enabling default project: %s', options.defaultProject);
109
- let configFile;
110
- try {
111
- configFile = (0, getParsedConfigFile_1.getParsedConfigFile)(tsserver, options.defaultProject, tsconfigRootDir);
112
- }
113
- catch (error) {
114
- if (optionsRawObject.defaultProject) {
115
- throw new Error(`Could not read project service default project '${options.defaultProject}': ${error.message}`);
116
- }
117
- }
118
- if (configFile) {
119
- service.setCompilerOptionsForInferredProjects(
120
- // NOTE: The inferred projects API is not intended for source files when a tsconfig
121
- // exists. There is no API that generates an InferredProjectCompilerOptions suggesting
122
- // it is meant for hard coded options passed in. Hard asserting as a work around.
123
- // See https://github.com/microsoft/TypeScript/blob/27bcd4cb5a98bce46c9cdd749752703ead021a4b/src/server/protocol.ts#L1904
124
- configFile.options);
125
- }
126
- return {
127
- allowDefaultProject: options.allowDefaultProject,
128
- lastReloadTimestamp: performance.now(),
129
- maximumDefaultProjectFileMatchCount: options.maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING ??
130
- DEFAULT_PROJECT_MATCHED_FILES_THRESHOLD,
131
- service,
132
- };
133
- }
@@ -1,9 +0,0 @@
1
- import type * as ts from 'typescript/lib/tsserverlibrary';
2
- /**
3
- * Utility offered by parser to help consumers parse a config file.
4
- *
5
- * @param configFile the path to the tsconfig.json file, relative to `projectDirectory`
6
- * @param projectDirectory the project directory to use as the CWD, defaults to `process.cwd()`
7
- */
8
- export declare function getParsedConfigFile(tsserver: typeof ts, configFile: string, projectDirectory?: string): ts.ParsedCommandLine;
9
- //# sourceMappingURL=getParsedConfigFile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getParsedConfigFile.d.ts","sourceRoot":"","sources":["../../src/create-program/getParsedConfigFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAO1D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EAAE,EACnB,UAAU,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,MAAM,GACxB,EAAE,CAAC,iBAAiB,CA6CtB"}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getParsedConfigFile = getParsedConfigFile;
37
- const fs = __importStar(require("node:fs"));
38
- const path = __importStar(require("node:path"));
39
- const shared_1 = require("./shared");
40
- /**
41
- * Utility offered by parser to help consumers parse a config file.
42
- *
43
- * @param configFile the path to the tsconfig.json file, relative to `projectDirectory`
44
- * @param projectDirectory the project directory to use as the CWD, defaults to `process.cwd()`
45
- */
46
- function getParsedConfigFile(tsserver, configFile, projectDirectory) {
47
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, @typescript-eslint/internal/eqeq-nullish
48
- if (tsserver.sys === undefined) {
49
- throw new Error('`getParsedConfigFile` is only supported in a Node-like environment.');
50
- }
51
- const parsed = tsserver.getParsedCommandLineOfConfigFile(configFile, shared_1.CORE_COMPILER_OPTIONS, {
52
- fileExists: fs.existsSync,
53
- getCurrentDirectory,
54
- onUnRecoverableConfigFileDiagnostic: diag => {
55
- throw new Error(formatDiagnostics([diag])); // ensures that `parsed` is defined.
56
- },
57
- readDirectory: tsserver.sys.readDirectory,
58
- readFile: file => fs.readFileSync(path.isAbsolute(file) ? file : path.join(getCurrentDirectory(), file), 'utf-8'),
59
- useCaseSensitiveFileNames: tsserver.sys.useCaseSensitiveFileNames,
60
- });
61
- if (parsed?.errors.length) {
62
- throw new Error(formatDiagnostics(parsed.errors));
63
- }
64
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
65
- return parsed;
66
- function getCurrentDirectory() {
67
- return projectDirectory ? path.resolve(projectDirectory) : process.cwd();
68
- }
69
- function formatDiagnostics(diagnostics) {
70
- return tsserver.formatDiagnostics(diagnostics, {
71
- getCanonicalFileName: f => f,
72
- getCurrentDirectory,
73
- getNewLine: () => '\n',
74
- });
75
- }
76
- }