-
-
Notifications
You must be signed in to change notification settings - Fork 121
Cannot use different configs for different instances #105
Comments
Hi, thanks for the great explanation. This part of the code ensure on engine only is started. One should be started for a given config. Improvement should be easy to handle by making a hash from the config object and creating an engine per config hash. PR welcome! If you need a hand, this might help https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github |
Without looking at the code, my instinct would tell me that the preloader configuration is selected based on the first match of test-regexp. Because of this, and the fact that the preloader configurations are listed in the order they are on the example, I don't think this is actually a bug; every ".spec.js" will match the earlier ".js" test. Easy workaround would probably be to just reorder the configurations in the array; more specific ones first, less specific ones later. Harder workaround would mean that the code would need to check "how specific match we got on the test" and based on that, pick the most specific one ... and this could potentially lead to some very hard to debug issues (because developers are generally not good at writing regular expressions:) Just my 2c ... I may have misunderstood the problem description; if so, please disregard my comment. |
@DiscoNova, you are not wrong about the configuration ordering in my example above being wrong. I can assure that I have, however, been testing it with the spec loader first and have been able to log the results from both loaders. I have updated my example above and I have put in a pull request that resolves what I found to be the real issue. |
After some tests, I found that eslint-loader accepts only the first configuration object passed to the loader
'eslint-loader?{ configFile: "eslint.yaml" }'
.Use case: I'm attempting to use a different configFile for linting my
.spec.js
files vs my.js
files (so that I can enable specific es6 and plugin rules for one and not the other), however, eslint-loader seems to carry over the configFile set from one loader instance to the other. So, for instance, if I set semi-colons toalways
in one file butnever
in the other, whichever config gets set first that config's settings for that rule will be enforces for both loaders.Here is an example config in which the error can be replicated. Given
eslint.yaml
exists andfoobar.yaml
points to a non-existent files:Expected behavior: webpack should show the following error:
Actual behaviors: it still loading the first config
Changing the syntax around doesn't seem to make a difference either:
Conclusion: eslint-loader is not accepting any change after the configuration has been set in the first eslint-loader's loader.
After spending hours, I am not able to find any workarounds either.Thank you in advance for any responses. If you need any more details I'll be happy to update my comments.Update 1: a nasty workaround
node_modules/eslint-loader
folder tonode_modules/eslint-loader2
eslint-loader2
to tests loaders array aseslint-loader2?{ configFile: "eslint.test.yaml" }
Update 2
I have updated my config example above per @DiscoNova's comments.
The text was updated successfully, but these errors were encountered: