ESLint has the best JavaScript program analysis tools. ESLint can check for style violations and potential errors. The pluggable architecture allows anyone to create their own rules or custom configurations.
One of my favorite features is the ability auto-fix with the –fix flag. Integrating auto-fix gives you constant feedback by fixing mistakes and cleaning up code before you upload it to a repository. Ensuring that code contributions are clean and tidy can save time and reduce the amount of work required to review them.
This is what I do when I save files in my editor. This provides quick feedback and keeps the changes on disk. This article will show you how to do this for popular editors.
Installing ESLint
ESLint can be installed locally on a project (inside the module) and globally for all projects. This tutorial will use a local ESLint installation, but many of the same features will also work globally.
S Code
Install the package to use VS Code. To format on save, navigate to global settings, search for ESLint, and then turn on the ESLint Auto Fix on Save option.
Atom
Install the Linter-Eslint Package and any dependencies. Next, check the plug-in settings to fix errors.
Sublime Text
Install the ESLint -Formatter package using Package Control. To save the Preferences, add the following: Package Settings -> Elsint-Formatter Settings -> Settings — User.
Other editors
Your editor may not be represented above.
For example, the Vim plug-in will run something like the following: