-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Eslint is slow when used with webpack #788
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
Comments
If you disable the webpack aliases and the resolver config for them, does it go faster? |
I found the problem! I suggest the config is read once and then cached. I will make a pr. |
Glad you figured it out; seems like a webpack issue. |
Wait, or are you saying that eslint-plugin-import reads your webpack config? |
Yes, |
Sounds like a great improvement, thanks! |
After some further investigation I concluded that caching it would not speed it up (too much) since I've created a pr anyway as it moves out some common processing. |
Actually, correction I was testing it wrong. With this pr I got an improvement of over 2s. |
fyi: caching it permanently will impair things like caching it impermanently (i.e. maybe for 30s tops) would be fine. |
Could it be cached permanently but with an md5 hash of the file's contents, so any change busts the cache? |
lol yep, just suggested that over on #789 😁 |
Hmm. using md5 of webpack config file will not make it quicker then. |
ahhh, right, I forgot that every file doesn't necessarily have the same webpack config. part of the resolver is finding the "right" one. you're right, would need to do that every time anyway |
I guess then that there is nothing much that can be done here, i.e. at least my pr (#789) does not make sense. |
fwiw, |
thanx @benmosher. I am using atom.io with https://github.com/Adezandee/fast-eslint and it works nice for me. I had a problem with https://github.com/AtomLinter/linter-eslint though, it was unuseably slow. |
@mieszko4 how did you get the table with rule execution times? |
@mikhailChibel prefix the call with |
This is still a major problem. We have ./index.mjs that re-exports a component and I have a feeling that simply adding re-exports is making the linter exponentially slower. |
Tested 2.12.0 and it looks like I am having a different issue that is causing slowness. |
@kamronbatman 🤦♂️ ohh nooo! any ideas? |
so #1091 was driven by my own results dropping timing logs into the webpack resolver and looking at what took the most time; the stuff I cached reduced my times by 80%, though it was only ~5sec of my 60s total lint time and so it only shaved ~4s off. if you could either use the Node profiler (though I found this difficult and of limited utility) or just add some timing captures and logs and see what regions of code specifically are slowing you down, that would be the most helpful. I have already fixed the big waste that I could see. also: did you upgrade your webpack resolver to 0.10? most of the fixes (if not all of them) were in there, and not in v2.12 of the plugin. |
In my production,
It takes 22 seconds! |
I upgraded my webpack config to be a factory (exporting a function instead of a simple object like CRA does) and my ESLint timing went through the roof. So instead of setting the webpack config factory directly to // webpack.config.eslint.js
const configFactory = require('./webpack.config');
module.exports = configFactory('development'); Before
After
|
Just wanted to bump this with another data point. Added this along with |
@mosherc this happens when you have any rules enabled that use the import map (ie, that traverse all of your modules). |
Ok so it really is between using |
Usually when a codebase is large enough to run into these problems, I suggest using jest and jest-runner-eslint to parallelize linting. |
I am wondering if it is possible to boost up performance when using eslint-plugin-import with webpack.
In my project:
find node_modules/ -type f -name "package.json" | wc -l
)resolve.alias
module.rules
.Eslinting lasts ~30s, and I can see that
import/no-unresolved
takes most of the time:Any suggestions on improvement?
The text was updated successfully, but these errors were encountered: