Skip to content

feat(typescript-estree): remove EXPERIMENTAL_useSourceOfProjectReferenceRedirect #9104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions docs/packages/TypeScript_ESTree.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,6 @@ 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 `.`.
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/parser-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ interface ParserOptions {
debugLevel?: DebugLevel;
errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
errorOnUnknownASTType?: boolean;
EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean; // purposely undocumented for now
extraFileExtensions?: string[];
filePath?: string;
jsDocParsingMode?: JSDocParsingMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,10 @@ function diagnosticReporter(diagnostic: ts.Diagnostic): void {
function updateCachedFileList(
tsconfigPath: CanonicalPath,
program: ts.Program,
parseSettings: ParseSettings,
): Set<CanonicalPath> {
const fileList =
parseSettings.EXPERIMENTAL_useSourceOfProjectReferenceRedirect
? new Set(
program.getSourceFiles().map(sf => getCanonicalFileName(sf.fileName)),
)
: new Set(program.getRootFileNames().map(f => getCanonicalFileName(f)));
const fileList = new Set(
program.getRootFileNames().map(f => getCanonicalFileName(f)),
);
programFileListCache.set(tsconfigPath, fileList);
return fileList;
}
Expand Down Expand Up @@ -170,11 +166,7 @@ function getWatchProgramsForProjects(
let updatedProgram: ts.Program | null = null;
if (!fileList) {
updatedProgram = existingWatch.getProgram().getProgram();
fileList = updateCachedFileList(
tsconfigPath,
updatedProgram,
parseSettings,
);
fileList = updateCachedFileList(tsconfigPath, updatedProgram);
}

if (fileList.has(filePath)) {
Expand Down Expand Up @@ -214,11 +206,7 @@ function getWatchProgramsForProjects(
updatedProgram.getTypeChecker();

// cache and check the file list
const fileList = updateCachedFileList(
tsconfigPath[0],
updatedProgram,
parseSettings,
);
const fileList = updateCachedFileList(tsconfigPath[0], updatedProgram);
if (fileList.has(filePath)) {
log('Found updated program for file. %s', filePath);
// we can return early because we know this program contains the file
Expand All @@ -237,11 +225,7 @@ function getWatchProgramsForProjects(
program.getTypeChecker();

// cache and check the file list
const fileList = updateCachedFileList(
tsconfigPath[0],
program,
parseSettings,
);
const fileList = updateCachedFileList(tsconfigPath[0], program);
if (fileList.has(filePath)) {
log('Found program for file. %s', filePath);
// we can return early because we know this program contains the file
Expand Down Expand Up @@ -352,13 +336,6 @@ function createWatchProgram(
);
watchCompilerHost.trace = log;

/**
* 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 =>
parseSettings.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
watchCompilerHost.setTimeout = undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const DEFAULT_PROJECT_FILES_ERROR_EXPLANATION = `

Having many files run with the default project is known to cause performance issues and slow down linting.

See https://typescript-eslint.io/troubleshooting/#allowDefaultProject-glob-too-wide
See https://typescript-eslint.io/troubleshooting/#allowdefaultproject-glob-too-wide
`;

export function validateDefaultProjectForFilesGlob(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ export function createParseSettings(
: new Set(),
errorOnTypeScriptSyntacticAndSemanticIssues: false,
errorOnUnknownASTType: tsestreeOptions.errorOnUnknownASTType === true,
EXPERIMENTAL_useSourceOfProjectReferenceRedirect:
tsestreeOptions.EXPERIMENTAL_useSourceOfProjectReferenceRedirect === true,
extraFileExtensions:
Array.isArray(tsestreeOptions.extraFileExtensions) &&
tsestreeOptions.extraFileExtensions.every(ext => typeof ext === 'string')
Expand Down
9 changes: 0 additions & 9 deletions packages/typescript-estree/src/parseSettings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ export interface MutableParseSettings {
*/
errorOnUnknownASTType: boolean;

/**
* Whether TS should use the source files for referenced projects instead of the compiled .d.ts files.
*
* @remarks
* 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.
*/
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: boolean;

/**
* Any non-standard file extensions which will be parsed.
*/
Expand Down
12 changes: 0 additions & 12 deletions packages/typescript-estree/src/parser-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,6 @@ 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 `.`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ describe('useProgramFromProjectService', () => {

Having many files run with the default project is known to cause performance issues and slow down linting.

See https://typescript-eslint.io/troubleshooting/#allowDefaultProject-glob-too-wide
See https://typescript-eslint.io/troubleshooting/#allowdefaultproject-glob-too-wide

Matching files:
- a
Expand Down
1 change: 0 additions & 1 deletion packages/website/src/components/linter/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const defaultParseSettings: ParseSettings = {
debugLevel: new Set(),
errorOnTypeScriptSyntacticAndSemanticIssues: false,
errorOnUnknownASTType: false,
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false,
extraFileExtensions: [],
filePath: '',
// JSDocParsingMode was added in TS 5.3.
Expand Down
Loading