From 0552d193d3a5ac570b6eb6352e5fbb7ebc5ed94e Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 12 Oct 2020 12:48:19 -0700 Subject: [PATCH 1/3] feat(typescript-estree): add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See #2094 This is quick-and-dirty to get this out there for some users to see what sort of perf improvements this squeezes out. With the flag turned on: ``` bradzacher@bradzacher-mbp typescript-eslint % DEBUG=typescript-eslint:* yarn eslint ./packages/types/src/index.ts ./packages/eslint-plugin/src/index.ts yarn run v1.22.4 $ /Users/bradzacher/github/typescript-eslint/node_modules/.bin/eslint ./packages/types/src/index.ts ./packages/eslint-plugin/src/index.ts typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ './tsconfig.eslint.json', './tests/integration/utils/jsconfig.json', './packages/eslint-plugin/tsconfig.json', './packages/eslint-plugin-internal/tsconfig.json', './packages/eslint-plugin-tslint/tsconfig.json', './packages/experimental-utils/tsconfig.json', './packages/parser/tsconfig.json', './packages/scope-manager/tsconfig.json', './packages/shared-fixtures/tsconfig.json', './packages/types/tsconfig.json', './packages/typescript-estree/tsconfig.json', './packages/visitor-keys/tsconfig.json' ] +0ms typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /Users/bradzacher/github/typescript-eslint/packages/types/src/index.ts +0ms typescript-eslint:typescript-estree:createWatchProgram File did not belong to any existing programs, moving to create/update. /users/bradzacher/github/typescript-eslint/packages/types/src/index.ts +0ms typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/tsconfig.eslint.json. +0ms typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/tests/integration/utils/jsconfig.json. +1s typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/packages/eslint-plugin/tsconfig.json. +844ms typescript-eslint:typescript-estree:createWatchProgram Found program for file. /users/bradzacher/github/typescript-eslint/packages/types/src/index.ts +2s typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +0ms typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ './tsconfig.eslint.json', './tests/integration/utils/jsconfig.json', './packages/eslint-plugin/tsconfig.json', './packages/eslint-plugin-internal/tsconfig.json', './packages/eslint-plugin-tslint/tsconfig.json', './packages/experimental-utils/tsconfig.json', './packages/parser/tsconfig.json', './packages/scope-manager/tsconfig.json', './packages/shared-fixtures/tsconfig.json', './packages/types/tsconfig.json', './packages/typescript-estree/tsconfig.json', './packages/visitor-keys/tsconfig.json' ] +5s typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /Users/bradzacher/github/typescript-eslint/packages/eslint-plugin/src/index.ts +5s typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /users/bradzacher/github/typescript-eslint/packages/eslint-plugin/src/index.ts +74ms typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +70ms ✨ Done in 6.50s. ``` With the flag turned off: ``` bradzacher@bradzacher-mbp typescript-eslint % DEBUG=typescript-eslint:* yarn eslint ./packages/types/src/index.ts ./packages/eslint-plugin/src/index.ts yarn run v1.22.4 $ /Users/bradzacher/github/typescript-eslint/node_modules/.bin/eslint ./packages/types/src/index.ts ./packages/eslint-plugin/src/index.ts typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ './tsconfig.eslint.json', './tests/integration/utils/jsconfig.json', './packages/eslint-plugin/tsconfig.json', './packages/eslint-plugin-internal/tsconfig.json', './packages/eslint-plugin-tslint/tsconfig.json', './packages/experimental-utils/tsconfig.json', './packages/parser/tsconfig.json', './packages/scope-manager/tsconfig.json', './packages/shared-fixtures/tsconfig.json', './packages/types/tsconfig.json', './packages/typescript-estree/tsconfig.json', './packages/visitor-keys/tsconfig.json' ] +0ms typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /Users/bradzacher/github/typescript-eslint/packages/types/src/index.ts +0ms typescript-eslint:typescript-estree:createWatchProgram File did not belong to any existing programs, moving to create/update. /users/bradzacher/github/typescript-eslint/packages/types/src/index.ts +0ms typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/tsconfig.eslint.json. +1ms typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/tests/integration/utils/jsconfig.json. +1s typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/packages/eslint-plugin/tsconfig.json. +976ms typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/packages/eslint-plugin-internal/tsconfig.json. +2s typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/packages/eslint-plugin-tslint/tsconfig.json. +1s typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/packages/experimental-utils/tsconfig.json. +1s typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/packages/parser/tsconfig.json. +961ms typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/packages/scope-manager/tsconfig.json. +888ms typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/packages/shared-fixtures/tsconfig.json. +996ms typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /users/bradzacher/github/typescript-eslint/packages/types/tsconfig.json. +561ms typescript-eslint:typescript-estree:createWatchProgram Found program for file. /users/bradzacher/github/typescript-eslint/packages/types/src/index.ts +567ms typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +0ms typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ './tsconfig.eslint.json', './tests/integration/utils/jsconfig.json', './packages/eslint-plugin/tsconfig.json', './packages/eslint-plugin-internal/tsconfig.json', './packages/eslint-plugin-tslint/tsconfig.json', './packages/experimental-utils/tsconfig.json', './packages/parser/tsconfig.json', './packages/scope-manager/tsconfig.json', './packages/shared-fixtures/tsconfig.json', './packages/types/tsconfig.json', './packages/typescript-estree/tsconfig.json', './packages/visitor-keys/tsconfig.json' ] +11s typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /Users/bradzacher/github/typescript-eslint/packages/eslint-plugin/src/index.ts +11s typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /users/bradzacher/github/typescript-eslint/packages/eslint-plugin/src/index.ts +64ms typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +60ms ✨ Done in 12.26s. ``` --- .eslintrc.js | 1 + packages/eslint-plugin-internal/tsconfig.json | 3 +- .../eslint-plugin-tslint/tsconfig.build.json | 6 +- packages/eslint-plugin-tslint/tsconfig.json | 3 +- packages/eslint-plugin/tsconfig.build.json | 3 +- packages/eslint-plugin/tsconfig.json | 7 ++- packages/experimental-utils/tsconfig.json | 7 ++- packages/parser/tsconfig.build.json | 6 +- packages/parser/tsconfig.json | 9 ++- packages/scope-manager/tsconfig.json | 7 ++- packages/types/src/parser-options.ts | 1 + packages/typescript-estree/README.md | 12 ++++ .../src/create-program/createWatchProgram.ts | 59 +++++++++++++++---- .../typescript-estree/src/parser-options.ts | 13 ++++ packages/typescript-estree/src/parser.ts | 7 ++- .../typescript-estree/tsconfig.build.json | 7 ++- 16 files changed, 120 insertions(+), 31 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5fbcecbe0667..c789421b024a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,6 +26,7 @@ module.exports = { ], tsconfigRootDir: __dirname, warnOnUnsupportedTypeScriptVersion: false, + EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true, }, rules: { // diff --git a/packages/eslint-plugin-internal/tsconfig.json b/packages/eslint-plugin-internal/tsconfig.json index 6fddcebe2ae5..597a5eaee954 100644 --- a/packages/eslint-plugin-internal/tsconfig.json +++ b/packages/eslint-plugin-internal/tsconfig.json @@ -4,5 +4,6 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests"] + "include": ["src", "typings", "tests"], + "references": [{ "path": "../experimental-utils/tsconfig.build.json" }] } diff --git a/packages/eslint-plugin-tslint/tsconfig.build.json b/packages/eslint-plugin-tslint/tsconfig.build.json index d6987c27afe7..60cfdc79ee76 100644 --- a/packages/eslint-plugin-tslint/tsconfig.build.json +++ b/packages/eslint-plugin-tslint/tsconfig.build.json @@ -6,9 +6,5 @@ "resolveJsonModule": true }, "include": ["src"], - "references": [ - { "path": "../experimental-utils/tsconfig.build.json" }, - { "path": "../parser/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } - ] + "references": [{ "path": "../experimental-utils/tsconfig.build.json" }] } diff --git a/packages/eslint-plugin-tslint/tsconfig.json b/packages/eslint-plugin-tslint/tsconfig.json index 65fc5ce65848..d4bc6ebe57dd 100644 --- a/packages/eslint-plugin-tslint/tsconfig.json +++ b/packages/eslint-plugin-tslint/tsconfig.json @@ -5,5 +5,6 @@ "rootDir": "." }, "include": ["src", "tests"], - "exclude": ["tests/test-project", "tests/test-tslint-rules-directory"] + "exclude": ["tests/test-project", "tests/test-tslint-rules-directory"], + "references": [{ "path": "../experimental-utils/tsconfig.build.json" }] } diff --git a/packages/eslint-plugin/tsconfig.build.json b/packages/eslint-plugin/tsconfig.build.json index 52fd3f6be6d0..bc597c33129b 100644 --- a/packages/eslint-plugin/tsconfig.build.json +++ b/packages/eslint-plugin/tsconfig.build.json @@ -12,7 +12,6 @@ "references": [ { "path": "../experimental-utils/tsconfig.build.json" }, { "path": "../parser/tsconfig.build.json" }, - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } + { "path": "../scope-manager/tsconfig.build.json" } ] } diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index 9cea515ba6b2..a0cdad048692 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -4,5 +4,10 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools"] + "include": ["src", "typings", "tests", "tools"], + "references": [ + { "path": "../experimental-utils/tsconfig.build.json" }, + { "path": "../parser/tsconfig.build.json" }, + { "path": "../scope-manager/tsconfig.build.json" } + ] } diff --git a/packages/experimental-utils/tsconfig.json b/packages/experimental-utils/tsconfig.json index 9cea515ba6b2..20ea2496c6b0 100644 --- a/packages/experimental-utils/tsconfig.json +++ b/packages/experimental-utils/tsconfig.json @@ -4,5 +4,10 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools"] + "include": ["src", "typings", "tests", "tools"], + "references": [ + { "path": "../scope-manager/tsconfig.build.json" }, + { "path": "../types/tsconfig.build.json" }, + { "path": "../typescript-estree/tsconfig.build.json" } + ] } diff --git a/packages/parser/tsconfig.build.json b/packages/parser/tsconfig.build.json index 065e60867432..1d11694fd082 100644 --- a/packages/parser/tsconfig.build.json +++ b/packages/parser/tsconfig.build.json @@ -9,9 +9,9 @@ "include": ["src"], "references": [ { "path": "../experimental-utils/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" }, { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../shared-fixtures/tsconfig.build.json" } + { "path": "../shared-fixtures/tsconfig.build.json" }, + { "path": "../types/tsconfig.build.json" }, + { "path": "../typescript-estree/tsconfig.build.json" } ] } diff --git a/packages/parser/tsconfig.json b/packages/parser/tsconfig.json index a987c8b550de..6f9d20826372 100644 --- a/packages/parser/tsconfig.json +++ b/packages/parser/tsconfig.json @@ -5,5 +5,12 @@ "rootDir": "." }, "include": ["src", "tests", "tools"], - "exclude": ["tests/fixtures"] + "exclude": ["tests/fixtures"], + "references": [ + { "path": "../experimental-utils/tsconfig.build.json" }, + { "path": "../scope-manager/tsconfig.build.json" }, + { "path": "../shared-fixtures/tsconfig.build.json" }, + { "path": "../types/tsconfig.build.json" }, + { "path": "../typescript-estree/tsconfig.build.json" } + ] } diff --git a/packages/scope-manager/tsconfig.json b/packages/scope-manager/tsconfig.json index 9cea515ba6b2..649c1abf4620 100644 --- a/packages/scope-manager/tsconfig.json +++ b/packages/scope-manager/tsconfig.json @@ -4,5 +4,10 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools"] + "include": ["src", "typings", "tests", "tools"], + "references": [ + { "path": "../types/tsconfig.build.json" }, + { "path": "../typescript-estree/tsconfig.build.json" }, + { "path": "../visitor-keys/tsconfig.build.json" } + ] } diff --git a/packages/types/src/parser-options.ts b/packages/types/src/parser-options.ts index 898f6583ef66..8f6632df9a42 100644 --- a/packages/types/src/parser-options.ts +++ b/packages/types/src/parser-options.ts @@ -37,6 +37,7 @@ interface ParserOptions { debugLevel?: DebugLevel; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; errorOnUnknownASTType?: boolean; + EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean; // purposely undocumented for now extraFileExtensions?: string[]; filePath?: string; loc?: boolean; diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md index 4fdbb42dc10d..8a59159647d0 100644 --- a/packages/typescript-estree/README.md +++ b/packages/typescript-estree/README.md @@ -152,6 +152,18 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { */ errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; + /** + * ***EXPERIMENTAL FLAG*** - Use this at your own risk. + * + * Causes TS to use the source files for referenced projects instead of the compiled .d.ts files. + * This feature is not yet optimized, and is likely to cause OOMs for medium to large projects. + * + * This flag REQUIRES at least TS v3.9, otherwise it does nothing. + * + * See: https://github.com/typescript-eslint/typescript-eslint/issues/2094 + */ + EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean; + /** * When `project` is provided, this controls the non-standard file extensions which will be parsed. * It accepts an array of file extensions, each preceded by a `.`. diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index bf703b38d932..b770f22e4802 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -117,6 +117,20 @@ function createHash(content: string): string { return content; } +function updateCachedFileList( + tsconfigPath: CanonicalPath, + program: ts.Program, + extra: Extra, +): Set { + const fileList = extra.EXPERIMENTAL_useSourceOfProjectReferenceRedirect + ? new Set( + program.getSourceFiles().map(sf => getCanonicalFileName(sf.fileName)), + ) + : new Set(program.getRootFileNames().map(f => getCanonicalFileName(f))); + programFileListCache.set(tsconfigPath, fileList); + return fileList; +} + /** * Calculate project environments using options provided by consumer and paths from config * @param code The code being linted @@ -154,21 +168,12 @@ function getProgramsForProjects( * before we go into the process of attempting to find and update every program * see if we know of a program that contains this file */ - for (const rawTsconfigPath of extra.projects) { - const tsconfigPath = getTsconfigPath(rawTsconfigPath, extra); - const existingWatch = knownWatchProgramMap.get(tsconfigPath); - if (!existingWatch) { - continue; - } - + for (const [tsconfigPath, existingWatch] of knownWatchProgramMap.entries()) { let fileList = programFileListCache.get(tsconfigPath); let updatedProgram: ts.Program | null = null; if (!fileList) { updatedProgram = existingWatch.getProgram().getProgram(); - fileList = new Set( - updatedProgram.getRootFileNames().map(f => getCanonicalFileName(f)), - ); - programFileListCache.set(tsconfigPath, fileList); + fileList = updateCachedFileList(tsconfigPath, updatedProgram, extra); } if (fileList.has(filePath)) { @@ -209,18 +214,39 @@ function getProgramsForProjects( // sets parent pointers in source files updatedProgram.getTypeChecker(); - results.push(updatedProgram); + // cache and check the file list + const fileList = updateCachedFileList( + tsconfigPath, + updatedProgram, + extra, + ); + if (fileList.has(filePath)) { + log('Found updated program for file. %s', filePath); + // we can return early because we know this program contains the file + return [updatedProgram]; + } + + results.push(updatedProgram); continue; } const programWatch = createWatchProgram(tsconfigPath, extra); const program = programWatch.getProgram().getProgram(); + program.getTypeChecker(); // cache watch program and return current program knownWatchProgramMap.set(tsconfigPath, programWatch); + + // cache and check the file list + const fileList = updateCachedFileList(tsconfigPath, program, extra); + if (fileList.has(filePath)) { + log('Found program for file. %s', filePath); + // we can return early because we know this program contains the file + return [program]; + } + // sets parent pointers in source files - program.getTypeChecker(); results.push(program); } @@ -324,6 +350,13 @@ function createWatchProgram( ); watchCompilerHost.trace = log; + /** + * TODO(bradzacher): this needs refinement and development, but we're allowing users to opt-in to this for now + * See https://github.com/typescript-eslint/typescript-eslint/issues/2094 + */ + watchCompilerHost.useSourceOfProjectReferenceRedirect = (): boolean => + extra.EXPERIMENTAL_useSourceOfProjectReferenceRedirect; + // Since we don't want to asynchronously update program we want to disable timeout methods // So any changes in the program will be delayed and updated when getProgram is called on watch let callback: (() => void) | undefined; diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index 70db19645a2d..33195b0c8d65 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -12,6 +12,7 @@ export interface Extra { debugLevel: Set; errorOnTypeScriptSyntacticAndSemanticIssues: boolean; errorOnUnknownASTType: boolean; + EXPERIMENTAL_useSourceOfProjectReferenceRedirect: boolean; extraFileExtensions: string[]; filePath: string; jsx: boolean; @@ -111,6 +112,18 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { */ errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; + /** + * ***EXPERIMENTAL FLAG*** - Use this at your own risk. + * + * Causes TS to use the source files for referenced projects instead of the compiled .d.ts files. + * This feature is not yet optimized, and is likely to cause OOMs for medium to large projects. + * + * This flag REQUIRES at least TS v3.9, otherwise it does nothing. + * + * See: https://github.com/typescript-eslint/typescript-eslint/issues/2094 + */ + EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean; + /** * When `project` is provided, this controls the non-standard file extensions which will be parsed. * It accepts an array of file extensions, each preceded by a `.`. diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 56dc4109e801..2b9970e48cf5 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -93,6 +93,7 @@ function resetExtra(): void { debugLevel: new Set(), errorOnTypeScriptSyntacticAndSemanticIssues: false, errorOnUnknownASTType: false, + EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false, extraFileExtensions: [], filePath: getFileName(), jsx: false, @@ -168,7 +169,7 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { if ( extra.debugLevel.has('eslint') || // make sure we don't turn off the eslint debug if it was enabled via --debug - debug.enabled('eslint:*') + debug.enabled('eslint:*,-eslint:code-path') ) { // https://github.com/eslint/eslint/blob/9dfc8501fb1956c90dc11e6377b4cb38a6bea65d/bin/eslint.js#L25 namespaces.push('eslint:*,-eslint:code-path'); @@ -284,6 +285,10 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { extra.createDefaultProgram = typeof options.createDefaultProgram === 'boolean' && options.createDefaultProgram; + + extra.EXPERIMENTAL_useSourceOfProjectReferenceRedirect = + typeof options.EXPERIMENTAL_useSourceOfProjectReferenceRedirect === + 'boolean' && options.EXPERIMENTAL_useSourceOfProjectReferenceRedirect; } function warnAboutTSVersion(): void { diff --git a/packages/typescript-estree/tsconfig.build.json b/packages/typescript-estree/tsconfig.build.json index 215a0282df2b..ca949f029eb8 100644 --- a/packages/typescript-estree/tsconfig.build.json +++ b/packages/typescript-estree/tsconfig.build.json @@ -6,5 +6,10 @@ "rootDir": "./src", "resolveJsonModule": true }, - "include": ["src", "typings"] + "include": ["src", "typings"], + "references": [ + { "path": "../shared-fixtures/tsconfig.build.json" }, + { "path": "../types/tsconfig.build.json" }, + { "path": "../visitor-keys/tsconfig.build.json" } + ] } From ec0151cb79dfff55366e022377f95280e77cf4a4 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 12 Oct 2020 13:07:47 -0700 Subject: [PATCH 2/3] spelling --- .../typescript-estree/src/create-program/createWatchProgram.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index b770f22e4802..95dad18dddbe 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -351,7 +351,7 @@ function createWatchProgram( watchCompilerHost.trace = log; /** - * TODO(bradzacher): this needs refinement and development, but we're allowing users to opt-in to this for now + * TODO: this needs refinement and development, but we're allowing users to opt-in to this for now for testing and feedback. * See https://github.com/typescript-eslint/typescript-eslint/issues/2094 */ watchCompilerHost.useSourceOfProjectReferenceRedirect = (): boolean => From 8ae1895b512d9eefa3c8fc2d45871857bd3a9b5e Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 12 Oct 2020 13:34:54 -0700 Subject: [PATCH 3/3] nit move comments --- .../src/create-program/createWatchProgram.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index 95dad18dddbe..da9ff8384b73 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -232,12 +232,12 @@ function getProgramsForProjects( } const programWatch = createWatchProgram(tsconfigPath, extra); + knownWatchProgramMap.set(tsconfigPath, programWatch); + const program = programWatch.getProgram().getProgram(); + // sets parent pointers in source files program.getTypeChecker(); - // cache watch program and return current program - knownWatchProgramMap.set(tsconfigPath, programWatch); - // cache and check the file list const fileList = updateCachedFileList(tsconfigPath, program, extra); if (fileList.has(filePath)) { @@ -246,7 +246,6 @@ function getProgramsForProjects( return [program]; } - // sets parent pointers in source files results.push(program); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy