I'm having issues running eslint with "extends": "airbnb". I used the instructions on the npm page, and ran the command:
(
export PKG=eslint-config-airbnb;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)
which added the following to package.json:
...
devDependencies: {
"eslint": "^3.13.1",
"eslint-config-airbnb": "^14.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^3.0.2",
"eslint-plugin-react": "^6.9.0"
}
...
but, when running eslint, I get an error for:
Rule 'no-empty-label' was removed and replaced by: no-labels
If I remove the "extends": "airbnb" section from the .eslintrc file, I don't get these errors.
Did I do anything wrong?
I ended up adding the rule "no-empty-label": 0 which made the error go away. Is this the correct way to fix this?
Indeed that would fix it; but we haven't defined no-empty-label since before we split the rules into eslint-config-airbnb-base. Are you sure you have the latest config installed on disk? What does npm ls --depth=0 tell you?
@ljharb full output:
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected] extraneous
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
If you cd into node_modules and grep/ag for "no-empty-label", can you find that rule enabled anywhere?
โ node_modules git:(react) grep 'no-empty-label' -r .
./domain-browser/.eslintrc.js: 'no-empty-label': ERROR,
./eslint/CHANGELOG.md:* e64b2c2 Breaking: remove `no-empty-label` (fixes #5042) (Toru Nagashima)
./eslint/CHANGELOG.md:* Update: Add quotes around the label in `no-empty-label` error reports (fixes #3526) (Burak Yigit Kaya)
./eslint/CHANGELOG.md:* Fix: for-in support to no-empty-label rule (fixes #1161) (Marc Harter)
./eslint/CHANGELOG.md:* Rule: no-empty-label (Ilya Volodin)
./eslint/conf/category-list.json: { "removed": "no-empty-label", "replacedBy": ["no-labels"] },
./eslint/conf/replacements.json: "no-empty-label": ["no-labels"],
./extend/.eslintrc: "no-empty-label": [2],
./fsevents/node_modules/extend/.eslintrc: "no-empty-label": [2],
./is-regex/.eslintrc: "no-empty-label": [2],
./is-symbol/.eslintrc: "no-empty-label": [2],
So while a few dependencies use it (i see a few of mine in there i need to update, thanks :-p), that shouldn't impact your project. What if you grep for it in the root dir of your repo, excluding node_modules?
Oh my... please forgive my stupidity... I did not notice that somehow (bad drag and drop?) I had in one of the parent folders I had another .eslintrc where this rule was turned on... Thank you for your help!
I highly recommend adding "root": true to all of your repos' top-level configs.