You've probably at least heard of ESLint before, but just in case you haven't. ESLint is tool for performing static analysis on your code and finding places where you're code might have some unexpected edge-cases. On it's best days, it can be a powerful tool to help you enforce best practices in your codebase. On it's worst days, it can annoy your co-workers with pendantic formatting issues and other stylistic nitpicks.
To install eslint
:
npm install -D eslint
Next, you'll need to initialize a configuration file.
npm init @eslint/config
This will ask you a few questions:
? How would you like to use ESLint? …
To check syntax only
❯ To check syntax and find problems
To check syntax, find problems, and enforce code style
I'll let you answer those questions as you see fit. It's your enterprise application—you do what you want.
Let's take look at this rule.
- Command Line Interface Reference - ESLint - Pluggable JavaScript Linter
- How To Enable Linting on Save with Visual Studio Code and ESLint | DigitalOcean
- Auto-fix and format your JavaScript with ESLint - IBM Developer
- javascript - Is it safe to apply autofix from ESLint? - Stack Overflow
- How to Set Up ESLint Autofix and Prettier on Save in WebStorm | The WebStorm Blog (jetbrains.com)