Skip to content
Advertisement

How to Extend Eslint to work with create-react-app

I’m working on a React application and I would like to have a linter set up so that I can see all the warning/errors in the console.

The docs doesn’t say much: https://create-react-app.dev/docs/setting-up-your-editor/

I have added EXTEND_ESLINT=true in my .env.dev file and I have created a .eslintrc.json file as well, with the following content (taken from the docs):

JavaScript

Every rule I try to add won’t do anything, I still see no warnings in the console and on top of that if I try to run the linter from the command line:

JavaScript

I get the following error:

JavaScript

What am I missing?

Advertisement

Answer

You can either create a .eslintrc.js file inside your src folder, with this syntax:

JavaScript

Or add this to your package.json (not a .eslintrc.json file):

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement