Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat(parser, typescript-estree): export withoutProjectParserOptions utility#9233
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
JoshuaKGoldberg merged 13 commits intotypescript-eslint:mainfromfpapado:8428-export-utility-to-remove-type-infoJun 6, 2024
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
13 commits Select commitHold shift + click to select a range
3f657cd feat(typescript-estree): add function to remove parser options
fpapado62b677e feat(parser): re-export removeParserOptionsThatPromptTypechecking
fpapado5d9d6e7 chore: fix lint rule about importing types
fpapadob0319e4 refactor: prefer rest/spread over delete
fpapadof583a3e refactor: rename to withoutProjectParserOptions
fpapado4dbeacf refactor: rename withoutProjectParserOptions file as well
fpapado4ca0ac0 test: add unit test for withoutProjectParserOptions
fpapado3f83bf3 docs: add withoutProjectParserOptions
fpapado30c0e63 refactor: use single unit test for withoutProjectParserOptions
fpapadoa1a6282 chore: fix no-unused-vars lint error
fpapado15d47de chore: avoid wrapping lines in Parser.mdx
fpapado8e62e0b fix: update test with toEqual assertion
fpapado35a3d4b Merge branch 'main' into 8428-export-utility-to-remove-type-info
fpapadoFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletionsdocs/packages/Parser.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletionspackages/parser/src/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletionspackages/typescript-estree/src/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletionspackages/typescript-estree/src/withoutProjectParserOptions.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| 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 withoutProjectParserOptions( | ||
| opts: TSESTreeOptions, | ||
| ): TSESTreeOptions { | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars -- The variables are meant to be omitted | ||
| const { EXPERIMENTAL_useProjectService, project, ...rest } = opts; | ||
| return rest; | ||
| } |
14 changes: 14 additions & 0 deletionspackages/typescript-estree/tests/lib/withoutProjectParserOptions.test.ts
JoshuaKGoldberg marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { withoutProjectParserOptions } from '../../src'; | ||
| describe('withoutProjectParserOptions', () => { | ||
| it('removes only project parser options', () => { | ||
| const without = withoutProjectParserOptions({ | ||
| comment: true, | ||
| EXPERIMENTAL_useProjectService: true, | ||
| project: true, | ||
| }); | ||
| expect(without).toEqual({ | ||
| comment: true, | ||
| }); | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.