Rules redefining: shallow or deep?
See original GitHub issueWhat version of ESLint are you using?
2.11.1
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
{
"extends": [
"eslint:recommended",
"airbnb-base"
],
"rules": {
"eqeqeq": 2,
"no-console": 0
}
}
What did you do?..
After reading the documentation about cascading, hierarchy and rules redefining, I wrongly supposed that rules
in the user .eslintrc
file redefine rules in the extends
files as a whole, i.e. if the airbnb-base
sets 'no-unused-vars': [2, { 'vars': 'local', 'args': 'after-used' }]
and I sets "no-unused-vars": 2
the results will be just "no-unused-vars": 2
.
However, the eslint --print-config
tests have taught me that I should redefine each option from extends
file manually (i.e. the results above will be still "no-unused-vars": [2, { "vars": "local", "args": "after-used" }]
if I does not redefine vars
and args
).
Maybe I’ve missed something in the docs. If I have not, maybe it is worth more clarirfication.
However, I don’t understend how can I cancel array options from extends
files rules. So, if airbnb-base
sets 'eqeqeq': [2, 'allow-null']
, how can I cancel 'allow-null'
?
With .eslintrc.json example above and this file:
console.log(undefined == null);
console.log(undefined == 0);
eslint says just:
3:23 error Expected '===' and instead saw '==' eqeqeq
✖ 1 problem (1 error, 0 warnings)
and eslint --print-config
inticates that result rule is still
"eqeqeq": [2, "allow-null"]
Issue Analytics
- State:
- Created 7 years ago
- Comments:27 (23 by maintainers)
Top GitHub Comments
@nzakas So is this an intentional merging scheme?
while
So we’ll point users to documentation that tells them there’s no way to do something that is very reasonable to want to do? 😟 I don’t think that makes it much better. We should fix this. It’s a broken design.