Reputation: 7153
I have a an .eslintrc.json file whose rules my code is obeying. Except the "no-unused-vars" rule.
It works in my editor, that is, the unused vars are no longer highlighted red, but when I run the app in the console the console throws the warning. It's like they're using two separate configs or something. It's a create-react-app.
Upvotes: 0
Views: 375
Reputation: 7153
As it turned out, the only thing I needed to do was add a .env
file in my project root with this:
EXTEND_ESLINT=true
Then everything worked fine. I love simple solutions but my lord was that tedious! :)
Upvotes: 0
Reputation: 381
Stop your app, run rm -rf node_modules/.cache/eslint-loader
, then start it again. If that doesn't work then your editor is probably using a different eslint config than your app, but it's hard to say without looking at your setup.
Either way, check out CRA's official documentation on extending ESLint rules, or even better, use something like craco, react-app-rewired or customize-cra to get complete control over your ESLint config without having to eject from CRA.
Upvotes: 1