-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Slowness when using typescript parser with project
option
#1408
Comments
Might deleting those result in different paths tho, potentially causing lint errors? |
Passing in Without the project, we just act like a normal eslint parser - we load the file you tell us and parse it in isolation. We don't use the project option to resolve filenames, so there won't be anything that breaks without it. The project config is completely optional, and only required if the user wants to use rules that require type information. As the import rules don't use type information, it won't impact anything. |
Thanks, makes sense to me. |
typescript-eslint/typescript-eslint#389 (comment) That's the result I was looking for! Copy pasting comment content here for posterity. Some more measurements:
So yes, while |
A few of our users are reporting slowness when using our parser (
@typescript-eslint/parser
) with this plugin.Having a quick look at the codebase, I notice that you invoke the parser yourself so you can gather information about other files.
https://github.com/benmosher/eslint-plugin-import/blob/05c3935/utils/parse.js#L9-L39
As part of this, you pass in the
parserOptions
from the root config. If theproject
/projects
option is set in theparserOptions
, it will cause our parser to do a complete typechecking parse cycle, which is often rather slow.I'm still gathering information from users, we have some caching and such in the parser to attempt to circumvent this, but I think there's a double parse happening because you have a new instance of everything.
My hypothesis is that if we add the following lines at line 25 in the above file, it will make your parser invocation be a single-file, non type-checked parse, which should obviously be fast!
Once I get some data from users I'll happily raise a PR for this - I just wanted to bring it to your attention first.
The text was updated successfully, but these errors were encountered: