eslint-webpack-plugin
eslint-webpack-plugin copied to clipboard
(perf) Reduce filesystem calls
Modification Proposal
Reduce filesystem calls, by linting source code provided by webpack, instead of reading modules from filesystem again.
Webpack has an undocumented feature exposing module's original source code via a public method: https://github.com/webpack/webpack/issues/4526
ESLint has a lintText method to lint source code directly instead of providing glob patterns (which are expensive to expand) to lintFiles: https://eslint.org/docs/developer-guide/nodejs-api#-eslintlinttextcode-options
There may be some other possible optimizations to avoid filesystem calls, e.g. here: (but not sure of the total impact to perf)
https://github.com/webpack-contrib/eslint-webpack-plugin/blob/08af5d683394ec0156aaa61d4c204d4181e76fb0/src/utils.js#L73-L76
Expected Behavior / Situation
This plugin should (ideally) not need to read from the filesystem at all. This plugin should be (ideally) very fast!
Actual Behavior / Situation
This plugin uses many synchronous filesystem calls, directly and indirectly (i.e. via ESLint's lintFiles method), and (seem to be) all synchronous.
This slows down the process quite a bit, especially in certain conditions.
For example, we are developing our application inside a Docker container with source code in a mount to host filesystem. This makes filesystem access quite a bit slower when using WSL2 (which now seems to be standard). Production build executes in about 2 minutes without this plugin vs about 15 minutes with this plugin. Dev server (doesn't transpile code with Babel) starts up in about 35 seconds without this plugin vs about 13 minutes without this plugin.
Please paste the results of npx webpack-cli info here, and mention other relevant information
Using Quasar Framework App CLI, not webpack-cli. Relevant information is mentioned above. Please let me know if anyone wants any other details.
Related issue: https://github.com/webpack-contrib/eslint-webpack-plugin/issues/30
It looks like eslint-loader did it the proposed way: https://github.com/webpack-contrib/eslint-loader/blob/fc94b5d976f3176eba6d1460fba9dde99227ac32/src/Linter.js#L35-L37
Looks good, Can someone follow up on this issue as soon as possible?
The plugin does not read files, only at the beginning to define the files and folders that will be excluded