Skip to content

feat(typescript-estree): remove slow deprecated and isolated programs #8834

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
6 changes: 0 additions & 6 deletions docs/packages/TypeScript_ESTree.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,6 @@ interface ParseAndGenerateServicesOptions extends ParseOptions {
*/
programs?: Program[];

/**
* @deprecated - this flag will be removed in the next major.
* Do not rely on the behavior provided by this flag.
*/
DEPRECATED__createDefaultProgram?: boolean;

/**
* ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts,
* such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@ const DEFAULT_EXTRA_FILE_EXTENSIONS = [
function createProjectProgram(
parseSettings: ParseSettings,
programsForProjects: readonly ts.Program[],
): ASTAndDefiniteProgram | undefined {
): ASTAndDefiniteProgram {
log('Creating project program for: %s', parseSettings.filePath);

const astAndProgram = firstDefined(programsForProjects, currentProgram =>
getAstFromProgram(currentProgram, parseSettings.filePath),
);

// The file was either matched within the tsconfig, or we allow creating a default program
// eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major
if (astAndProgram || parseSettings.DEPRECATED__createDefaultProgram) {
// The file was matched within the tsconfig
if (astAndProgram) {
return astAndProgram;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ export function createParseSettings(
codeFullText,
comment: options.comment === true,
comments: [],
DEPRECATED__createDefaultProgram:
// eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major
options.DEPRECATED__createDefaultProgram === true,
debugLevel:
options.debugLevel === true
? new Set(['typescript-eslint'])
Expand Down
7 changes: 0 additions & 7 deletions packages/typescript-estree/src/parseSettings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ export interface MutableParseSettings {
*/
comments: TSESTree.Comment[];

/**
* @deprecated
* This is a legacy option that comes with severe performance penalties.
* Please do not use it.
*/
DEPRECATED__createDefaultProgram: boolean;

/**
* Which debug areas should be logged.
*/
Expand Down
6 changes: 0 additions & 6 deletions packages/typescript-estree/src/parser-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,6 @@ interface ParseAndGenerateServicesOptions extends ParseOptions {
*/
programs?: ts.Program[] | null;

/**
* @deprecated - this flag will be removed in the next major.
* Do not rely on the behavior provided by this flag.
*/
DEPRECATED__createDefaultProgram?: boolean;

/**
* ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts,
* such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback
Expand Down
17 changes: 1 addition & 16 deletions packages/typescript-estree/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type * as ts from 'typescript';

import { astConverter } from './ast-converter';
import { convertError } from './convert';
import { createDefaultProgram } from './create-program/createDefaultProgram';
import { createIsolatedProgram } from './create-program/createIsolatedProgram';
import { createProjectProgram } from './create-program/createProjectProgram';
import {
Expand Down Expand Up @@ -76,24 +75,10 @@ function getProgramAndAST(
return createNoProgram(parseSettings);
}

const fromProjectProgram = createProjectProgram(
return createProjectProgram(
parseSettings,
getWatchProgramsForProjects(parseSettings),
);
if (fromProjectProgram) {
return fromProjectProgram;
}

// eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major
if (parseSettings.DEPRECATED__createDefaultProgram) {
// eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major
const fromDefaultProgram = createDefaultProgram(parseSettings);
if (fromDefaultProgram) {
return fromDefaultProgram;
}
}

return createIsolatedProgram(parseSettings);
}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
Expand Down
9 changes: 0 additions & 9 deletions packages/typescript-estree/tests/lib/semanticInfo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,6 @@ describe('semanticInfo', () => {
});
}

it('default program produced with option', () => {
const parseResult = parseCodeAndGenerateServices('var foo = 5;', {
...createOptions('<input>'),
DEPRECATED__createDefaultProgram: true,
});

expectToHaveParserServices(parseResult.services);
});

it('empty programs array should throw', () => {
const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts');
const badConfig = createOptions(fileName);
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 @@ -10,7 +10,6 @@ export const defaultParseSettings: ParseSettings = {
comment: true,
comments: [],
debugLevel: new Set(),
DEPRECATED__createDefaultProgram: false,
errorOnTypeScriptSyntacticAndSemanticIssues: false,
errorOnUnknownASTType: false,
EXPERIMENTAL_projectService: undefined,
Expand Down
Loading