The first step to automating the quality of your React source code is installing and configuring the tool used to automate it—ESLint. When ESLint is installed, it installs an eslint command on your system. Like other packages that install commands, it's better to have them installed locally as part of the project, so that you don't have to rely on the command being available globally on the system.
To install ESLint in your project, run the following npm command:
npm install eslint --save-dev
Now that you have ESLint installed, you can create a new npm script that will run ESLint for you. Add the following to the scripts section of your package.json file:
"scripts": { ... "lint": "eslint" },
You now have an eslint command that you can run within your project. Try it out:
npm run lint
Instead...