Skip to content

perf(typescript): strip projectService from parser options when needed #704

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

Conversation

mcous
Copy link
Contributor

@mcous mcous commented Apr 17, 2025

This PR relates to sveltejs/eslint-plugin-svelte#1084, but does not resolve it. During performance testing, I found a large discrepancy in lint times between project: './tsconfig.json' and projectService: true. Using project was slow, but using projectService was extremely slow.

While comparing the Svelte parser with the similar Vue parser, I noticed that when the Svelte parser tries to use the TS parser without type information, it strips the project parser option. However, the Vue parser strips both project and projectService.

This PR ensures all typing-related parser options are stripped when needed rather than only project. This brings lint times using projectService into alignment with project - still slow, but less slow

Copy link

changeset-bot bot commented Apr 17, 2025

🦋 Changeset detected

Latest commit: f6afc77

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte-eslint-parser Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mcous mcous force-pushed the perf/typescript-strip-project-service branch from f00e609 to 7f4d62e Compare April 17, 2025 15:22
Copy link
Contributor

github-actions bot commented Apr 19, 2025

Try the Instant Preview in Online Playground

ESLint Online Playground

Install the Instant Preview to Your Local

npm i https://pkg.pr.new/svelte-eslint-parser@f6afc77

Published Instant Preview Packages:

View Commit

@coveralls
Copy link

Pull Request Test Coverage Report for Build 14543931958

Details

  • 32 of 32 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.007%) to 94.675%

Totals Coverage Status
Change from base Build 14543922508: 0.007%
Covered Lines: 10508
Relevant Lines: 10975

💛 - Coveralls

Comment on lines +118 to +129
export function withoutProjectParserOptions(
options: NormalizedParserOptions,
): NormalizedParserOptions {
const {
project: _strippedProject,
projectService: _strippedProjectService,
EXPERIMENTAL_useProjectService: _strippedExperimentalUseProjectService,
...result
} = options;

return result;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@baseballyama baseballyama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@baseballyama baseballyama merged commit 0436da6 into sveltejs:main Apr 19, 2025
12 checks passed
@mcous mcous deleted the perf/typescript-strip-project-service branch April 19, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants