Description
Bug report
Hello
Actual Behavior
When using multiple webpack configurations, eslint-webpack-plugin reuses the same ESLint instance for each configuration.
In fact, each configuration instantiates ESLint, but because the instance is stored in a global variable, the last one overrides all previous instances.
This leads to incorrect cwd and context being used, and ultimately to errors.
Expected Behavior
Each webpack configuration should use its own ESLint instance.
There must be no global ESLint instance that is shared or overridden.
How Do We Reproduce?
Create an array of webpack configurations, each pointing to a different codebase.
Run webpack with eslint-webpack-plugin enabled.
Observe that linting fails because all configurations share the same instance.
Comment out all but one configuration and rerun: linting succeeds for the remaining configuration.
Please paste the results of npx webpack-cli info
here, and mention other relevant information.
Investigation
In eslint-webpack-plugin/dist/worker.js, the global variables ESLint and eslint are responsible for this behavior. They are reused by the lintFiles method, which calls them from the global scope rather than from the method’s own binding(Which did not exists).
Environment
webpack: latest version
eslint-webpack-plugin: latest version
Have a nice day.