Skip to content

⚡️ Performance: Default parserOptions.jsDocParsingMode to 'none' or 'type-info' #9857

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

Open
JoshuaKGoldberg opened this issue Aug 21, 2024 · 7 comments
Labels
blocked by another issue Issues which are not ready because another issue needs to be resolved first blocked by another PR PRs which are ready to go but waiting on another PR

Comments

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Aug 21, 2024

Overview

Following conversations in #7997 and #9783 (comment): we'd previously added a parserOptions.jsDocParsingMode that API consumers can use to skip parsing JSDoc comments. JSDoc comment parsing can be quite expensive.

We'd previously been blocked from doing so because at least one popular ecosystem project, eslint-plugin-deprecation, uses them. Our initial version of a deprecation rule does too: #9783. So this issue is blocked until we create a suitable alternative, such as our own quick regexp parser.

See also #7906 for tracking running a performance comparison.

💖

@JoshuaKGoldberg JoshuaKGoldberg added blocked by another PR PRs which are ready to go but waiting on another PR blocked by another issue Issues which are not ready because another issue needs to be resolved first labels Aug 21, 2024
@uhyo
Copy link
Contributor

uhyo commented Aug 21, 2024

Hello, coming over from an X thread. I maintain another third-party plugin that relies on parsed JSDoc information, though not very popular. 😅

https://github.com/uhyo/eslint-plugin-import-access

The plugin sees JSDoc tags @package, @private and @access and uses this information to decide whether importing a binding form another module is allowed. Also it depends on TypeScript's module resolution because the plugin has an inter-module linting logic.

I'm not severly requesting to keep the slower jsDocParsingMode default; I'm happy to guide my users to manually set jsDocParsingMode in order to make my plugin work.

I just wanted to share my use case of JSDoc parsing and also my humble hope that the planned alternative JSDoc parser (#9858) could be extended so that it can be used for third-party use cases too. Thank you 🙂

@silverwind

This comment was marked as off-topic.

@Josh-Cena

This comment was marked as off-topic.

@bradzacher
Copy link
Member

@silverwind please don't hop on unrelated threads to ask questions!
This issue is about changing the default for parserOptions.jsDocParsingMode, not about the new no-deprecated rule. If you would like to ask questions -- please use our discord.

But Josh is right -- the first rule bears the brunt of the type info that gets lazily computed and cached. If you isolated the test runs you'd see they should be equivalent perf.

@Josh-Cena
Copy link
Member

This issue is about changing the default for parserOptions.jsDocParsingMode, not about the new no-deprecated rule. If you would like to ask questions -- please use our discord.

This issue is motivated by the new rule, because we are now in the business of checking JSDoc. :)

@silverwind
Copy link

silverwind commented Aug 27, 2024

@Josh-Cena thanks for clarification, I will run my benchmark on these rules in isolation so that each rule has to bear the jsDoc loading cost. I expect the two rules to perform similarily under those conditions.

@bradzacher
Copy link
Member

If you find it's slower - please file a new issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked by another issue Issues which are not ready because another issue needs to be resolved first blocked by another PR PRs which are ready to go but waiting on another PR
Projects
None yet
Development

No branches or pull requests

5 participants