-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Rule options from implicitly included plugins are not validated #11559
Comments
Thanks for the report. This seems like a serious issue, I'm surprised no one had noticed this before now. I think this is probably already fixed by #11546 (cc @mysticatea). |
Thanks for the quick response! I pulled down the |
I confirmed that this reproduced. And yes, #11546 fixed this bug because it has separated config schema validation and rule option validation. In #11546, ESLint validates config schema when each config file was read and validates rule options and environments when the configuration was determined for each source file (i.e. after all cascading config files, shareable configs, plugins, and parsers are loaded). |
I've pulled this into a vue project where I have been having problems with eslint and their plugin for months. I can confirm that this fixes the error I was having. Is this going to be merged in before version 6.0.0? |
We have published the final release of ESLint Unfortunately, we have not backported bug fixes to old major versions because backporting makes complex our release process and we don't have enough human resource for that. And, #11546 changes our codebase about configuration from almost scratch and that fixes some bugs which are considered breaking changes, so it's hard to backport. At a glance, the current |
Great. #11546 seems to fix the issue for |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using? default (Espree)
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
$ ./node_modules/.bin/eslint .
What did you expect to happen?
I expected ESLint to report a validation error like so:
What actually happened? Please include the actual, raw output from ESLint.
The validation error is ignored and ESLint continues as if the plugin option is valid
I've created a reproduction repository that demonstrates the difference in plugin rule validation behavior when implicitly vs explicitly including a plugin.
I believe I have narrowed it down to this code:
eslint/lib/config/config-file.js
Lines 541 to 552 in a6168f8
eslint/lib/config/config-validator.js
Lines 170 to 173 in a6168f8
It validates the local config (including rule options) before applying config extensions, so the plugin and its rules aren't loaded into the linter until after the rules enabled by the local config are validated. Since the rules aren't present at the time of validation, validation is silently skipped.
The text was updated successfully, but these errors were encountered: