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
.eslintignore patterns are not excluded from globbing, so performance can be very slow #6710
Comments
I think the dust has mostly settled from our last attempt to fix globbing of ignored directories (in the default ignore directories), so I'd love to see us take another crack at this. But we'll see what the team thinks. |
Thanks for opening the issue. I think I have an idea of how to do this, so I'll take a stab at this. |
We did say we would do this, so marking as accepted. |
My PR (rocketmonkeys#1) has a really naive attempt at fixing this. It's probably all sorts of wrong, but it does work for at least my case, and speeds things up a ton. |
@rocketmonkeys Unfortunately, it wouldn't work for all cases. .eslintignore is using gitignore style, but traversal is done using globs. While those two patterns intersect and have common syntax, they are not the same, and in a lot of cases, glob will not understand gitignore patterns. That's the reason we couldn't fix it correctly the first time around. |
@rocketmonkeys you should read through the whole thread on #6215 where we discuss some of the gotchas. |
My intention was to do glob ignoring only when we have an ignored folder in a glob compatible syntax (no wildcards or any special syntax? absolute path?) an we can ensure it's not unignored later (no unignore at all?). |
Maybe we could inherit Our custom But there is still maintainence issue, that we will have to upgrade our sub-class if
|
@eslint/eslint-team any opinions on how do we want to approach this? @kaelzhang also submitted #6730 that addresses this by forking glob |
Though I don't understand this issue. My image is: const IGNORE = Symbol("ignore");
class OurGlob extends glob.GlobSync {
constructor(pattern, options, ignore) {
super(pattern, options);
this[IGNORE] = ignore; // use symbol to avoid to conflict with base class's property.
}
_readdir(abs, inGlobStar) {
if (this[IGNORE].match(abs)) {
return null;
}
return super._readdir(abs, inGlobStar);
}
} |
I don't think we want to fork glob to solve this problem. Inheritance seems like a better option. |
@nzakas Ok,I'm working on this. |
What version of ESLint are you using?
v3.1.1
What parser (default, Babel-ESLint, etc.) are you using?
Default (espree?)
Please show your full configuration:
In .eslintignore:
What did you do? Please include the actual source code causing the issue.
run
eslint .
What did you expect to happen?
eslint should be quick, since I've excluded folders via
.eslintignore
.What actually happened? Please include the actual, raw output from ESLint.
eslint takes a long time, since it still globs all folders even if they're in .eslintignore.
This is a follow-on from #5679. The fix for that one excluded "DEFAULT_IGNORE_DIRS" from globbing, which was a good start.
However, if your project has large folders outside of the default ones, globbing will still take a long time even if you specify them in .eslintignore.
Including all patterns from .eslintignore speeds things up a lot. The goal is to exclude the patterns in .eslintignore from globbing, just like we do with DEFAULT_IGNORE_DIRS already.
The text was updated successfully, but these errors were encountered: