Using ESLint and alternatives
ESLint statically analyzes code to identify common patterns and find problems. It can be used as a library from your Node.js applications, as a tool from your Node.js scripts, in your CI/CD pipelines, or implicitly within your code editor.
The general recommendation is to install ESLint locally in your Node.js project. A local installation can be done with your favorite package manager, such as npm:
$ npm install eslint --save-dev
In most cases, you’ll want to specify the --save-dev
flag. This will add a dependency to the development dependencies, which are not installed in consuming applications and will be skipped for production installations. Indeed, development dependencies are only interesting during the project’s actual development.
Alternatively, you can also make ESLint a global tool. This way, you can run ESLint even in projects and code files that do not already include it. To install ESLint globally, you need to run...