Skip to content
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

feat(parser, typescript-estree): export withoutProjectParserOptions utility #9233

Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions packages/parser/src/index.ts
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export {
ParserServicesWithoutTypeInformation,
clearCaches,
createProgram,
removeParserOptionsThatPromptTypechecking,
} from '@typescript-eslint/typescript-estree';

// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder
Expand Down
1 change: 1 addition & 0 deletions packages/typescript-estree/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export { typescriptVersionIsAtLeast } from './version-check';
export * from './getModifiers';
export { TSError } from './node-utils';
export * from './clear-caches';
export { removeParserOptionsThatPromptTypechecking } from './removeParserOptionsThatPromptTypechecking';

// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
Expand Down
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { TSESTreeOptions } from './parser-options';

/**
* Removes options that prompt the parser to parse the project with type
* information. In other words, you can use this if you are invoking the parser
* directly, to ensure that one file will be parsed in isolation, which is much,
* much faster.
*
* @see https://github.com/typescript-eslint/typescript-eslint/issues/8428
*/
export function removeParserOptionsThatPromptTypechecking(
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
opts: TSESTreeOptions,
): TSESTreeOptions {
delete opts.EXPERIMENTAL_useProjectService;
delete opts.project;

return opts;
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
}
Loading