Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix(typescript-estree): only run projectService setHostConfiguration when needed#9336
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 23 commits intotypescript-eslint:v8fromhigherorderfunctor:perf/9312-set-host-config-once-per-project-serviceJun 22, 2024
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
23 commits Select commitHold shift + click to select a range
5a12641
perf(typescript-estree): moves setHostConfiguration into createProjec…
higherorderfunctor8ef28ae
fix(typescript-estree): fixes extraFileExtensions to allow updates
higherorderfunctor14261ca
refactor(typescript-estree): revert some changes to createParseSettings
higherorderfunctor3dff7e0
docs(typescript-estree): adds performance information to the document…
higherorderfunctor85ce13d
docs(cspell): filter words
higherorderfunctordd99286
refactor(typescript-estree): fixes test to show host config not updat…
higherorderfunctor8487e9d
refactor(typescript-estree): fixes broken test
higherorderfunctor2092269
refactor(typescript-estree): logs before/after updating extraFileExte…
higherorderfunctorae73208
Merge branch 'v8' into perf/9312-set-host-config-once-per-project-ser…
higherorderfunctorbfc80e6
test(typescript-estree): [ProjectService] adds additional extraFileEx…
higherorderfunctorcf09e1e
refactor(typescript-estree): simplifies last set extraFileExtensions …
higherorderfunctor113441d
docs: adds additional performance details for extraFileExtensions wit…
higherorderfunctor1b9887f
docs: fixes typo
higherorderfunctor559d8ea
docs: adds additional clarifying details to performance with extraFil…
higherorderfunctor5f83cc3
docs: updates sections that refer to performance with extraFileExtens…
higherorderfunctorec9d09b
docs: updates docs with review feedback
higherorderfunctoraa142c4
docs: reorders content related to this issue in the performance section
higherorderfunctorfa15073
docs: accepts review suggestion in docs/troubleshooting/Performance.mdx
higherorderfunctor1771c27
docs: accepts review suggestion in docs/troubleshooting/Performance.mdx
higherorderfunctor63992dc
docs: accepts review suggestion in docs/troubleshooting/Performance.mdx
higherorderfunctorddb970c
docs: accepts review suggestion in docs/troubleshooting/Performance.mdx
higherorderfunctoreaaee4f
docs: accepts review suggestion in docs/troubleshooting/Performance.mdx
higherorderfunctore081759
docs: fixes broken link and linting errors
higherorderfunctorFile 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
2 changes: 2 additions & 0 deletions.cspell.json
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
4 changes: 4 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
2 changes: 2 additions & 0 deletionsdocs/packages/TypeScript_ESTree.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
4 changes: 4 additions & 0 deletionsdocs/troubleshooting/FAQ.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
100 changes: 100 additions & 0 deletionsdocs/troubleshooting/Performance.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -79,6 +79,106 @@ module.exports = { | ||
See [Glob pattern in parser's option "project" slows down linting](https://github.com/typescript-eslint/typescript-eslint/issues/2611) for more details. | ||
## Changes to `extraFileExtensions` with `projectService` | ||
Using a different [`extraFileExtensions`](../packages/Parser.mdx#extrafileextensions) between files in the same project with | ||
the [`projectService`](../packages/Parser.mdx#projectservice) option may cause performance degradations. | ||
For every file linted, we update the `projectService` whenever `extraFileExtensions` changes. | ||
This causes the underlying TypeScript server to perform a full project reload. | ||
<Tabs groupId="eslint-config"> | ||
higherorderfunctor marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
<TabItem value="Flat Config"> | ||
```js title="eslint.config.js" | ||
// @ts-check | ||
import tseslint from 'typescript-eslint'; | ||
import vueParser from 'vue-eslint-parser'; | ||
// Add this line | ||
const extraFileExtensions = ['.vue']; | ||
export default [ | ||
{ | ||
files: ['*.ts'], | ||
languageOptions: { | ||
parser: tseslint.parser, | ||
parserOptions: { | ||
projectService: true, | ||
// Add this line | ||
extraFileExtensions, | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: ['*.vue'], | ||
languageOptions: { | ||
parser: vueParser, | ||
parserOptions: { | ||
projectService: true, | ||
parser: tseslint.parser, | ||
// Remove this line | ||
extraFileExtensions: ['.vue'], | ||
// Add this line | ||
extraFileExtensions, | ||
}, | ||
}, | ||
}, | ||
]; | ||
``` | ||
</TabItem> | ||
<TabItem value="Legacy Config"> | ||
```js title=".eslintrc.js" | ||
// Add this line | ||
const extraFileExtensions = ['.vue']; | ||
module.exports = { | ||
files: ['*.ts'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
projectService: true, | ||
// Add this line | ||
extraFileExtensions, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.vue'], | ||
parser: 'vue-eslint-parser', | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser', | ||
projectService: true, | ||
// Remove this line | ||
extraFileExtensions: ['.vue'], | ||
// Add this line | ||
extraFileExtensions, | ||
}, | ||
}, | ||
], | ||
}; | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
Project reloads can be observed using the [debug environment variable](../packages/typescript-estree/#debugging): `DEBUG='typescript-eslint:typescript-estree:*'`. | ||
``` | ||
typescript-estree:useProgramFromProjectService Updating extra file extensions: before=[]: after=[ '.vue' ] | ||
typescript-estree:tsserver:info reload projects. | ||
typescript-estree:useProgramFromProjectService Extra file extensions updated: [ '.vue' ] | ||
... | ||
typescript-estree:useProgramFromProjectService Updating extra file extensions: before=[ '.vue' ]: after=[] | ||
typescript-estree:tsserver:info reload projects. | ||
typescript-estree:useProgramFromProjectService Extra file extensions updated: [] | ||
... | ||
typescript-estree:tsserver:info Scheduled: /path/to/tsconfig.src.json, Cancelled earlier one +0ms | ||
typescript-estree:tsserver:info Scheduled: *ensureProjectForOpenFiles*, Cancelled earlier one +0ms | ||
... | ||
typescript-estree:useProgramFromProjectService Updating extra file extensions: before=[]: after=[ '.vue' ] | ||
typescript-estree:tsserver:info reload projects. | ||
typescript-estree:useProgramFromProjectService Extra file extensions updated: [ '.vue' ] | ||
``` | ||
## The `indent` / `@typescript-eslint/indent` rules | ||
This rule helps ensure your codebase follows a consistent indentation pattern. | ||
2 changes: 2 additions & 0 deletionspackages/typescript-estree/src/parser-options.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
46 changes: 34 additions & 12 deletionspackages/typescript-estree/src/useProgramFromProjectService.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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.