Stack Builder

ESLint

Catch errors and enforce code styles.

Installation

Use Anthony Fu's configuration

Anthony Fu's ESLint Configuration

Terminal
npx @antfu/eslint-config@latest

Downversion to ESLint 8.57.0

ESLint 9 is installed by default, which as of writing is still buggy and incompatible with many plugins.

Terminal
npm i -D eslint@8

Install eslint-plugin-format if it's missing in package.json.

Terminal
npm install -D eslint-plugin-format

The commands need to be run in order for the rest of the packages to be installed.

Terminal
npm run lint; npm run lint:fix; npm run lint:inspect

Your entire project will be linted and fixable errors will be fixed.

You should also see a browser tap open up with the address localhost:7777. This is the ESLint Config Inspector, which is only available for flat ESLint configs, like the one we just configured.

Last updated on

On this page

Edit on GitHub