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
Cannot overwrite rule options from sharable config #6144
Comments
Thank you for this issue. I think this is an intentional behavior. |
I think we should just update documentation to make it clear that configs are deep-merged. |
That doesn't solve these types of issues where you can't override behavior from extended configs. A non-breaking change we could make is to allow a predefined string to be passed as the second argument of a rule which tells eslint to use the rule defaults. Something like, {
"rules": {
"eqeqeq": ["error", "use-defaults"]
}
} This would disable merging of rule options for this rule and use the defaults defined for this rule. |
I think there should be an explicit default option for |
@alberto I feel like that is a bit of a band-aid solution, as this is an issue for other rules as well. |
Then we should add options for those as well. |
Fair enough. Just seems error prone to have to add those options on a rule-by-rule basis. |
Any updates on this? |
I'm not sure I agree with the logic that (in the OP's example) Note that this still allows for the most common cases (derived config turns off rule enabled in base config, derived config turns on rule disabled in base config) to continue to work as they always have. In the case of derived config turning a rule on, the derived config must already specify a full and valid configuration. In the case described by OP, we have an example of configuration being implicit in the derived configuration file. That strikes me as violating the principle of least surprise and I think we should change it, even if it's a breaking change. |
I agree with @platinumazure on this. I found it very surprising to inherit options from parent configs for rules I overrode in child configs. But at least if we were given a explicit default option, we could work around this. As it is, you can get stuck with certain rule options from parent configs and there is no way to override them. |
@danny-andrews I added an option for |
Closing in favor of #6361 |
* Update docs to explain config option merging There was a lot of [confusion](#6361) generated by the merging behavior of rules inherited from base configs, so I thought I would clear that up here. There still may be [scenarios](#6144) which arise where options cannot be overridden from base configs, but we'll deal with those on a per-case basis. * Use 4 spaces, not 2 * Use string notation, instead of numeric * Fix level
What version of ESLint are you using?
v2.9.0
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
Please show your full configuration:
my eslint-es5.js:
Relevant part of airbnb-base/legacy.js:
What did you expect to happen?
I expected there to be a way to overwrite this 'allow-null' exception because I want to enforce eqeqeq at all times.
What actually happened? Please include the actual, raw output from ESLint.
I am still able to do
bool == null
.The text was updated successfully, but these errors were encountered: