Installation
Depending on the ESLint version used in your project, you can choose:
- @nish1896/eslint-flat-config for ESLint v9
- @nish1896/eslint-config for ESLint v8
However, since ESLint v8 and below are now deprecated, upgrading to v9 is recommended for ongoing support and improvements.
In case you are upgrading to eslint v9 or above , please check the eslint 8 to 9 migration guide.
📘 This version of the documentation focuses on the installation and usage of @nish1896/eslint-flat-config
. For information on @nish1896/eslint-config
, please refer to version 3 of the docs.
You'll first need to install ESLint. If you project is a monorepo, consider creating a separate eslint-config for each package.
Please do refer the official docs to install eslint if needed.
npm i eslint --save-dev
yarn add -D eslint
pnpm add -D eslint
Next, install @nish1896/eslint-flat-config
.
npm install @nish1896/eslint-flat-config --save-dev
yarn add -D @nish1896/eslint-flat-config
pnpm add -D @nish1896/eslint-flat-config
Setup
Paste the following scripts in your package.json
file
"lint": "eslint",
"lint:fix": "eslint --fix"
The first script will check for lint warnings in your code while the second script will format code as per the rules specified in the eslint configuration of your application. The remaining warnings or errors need to be manually fixed by the developer.
You can also add "lint" command to your package.json
file through command line.
npm pkg set scripts.lint="eslint --fix ."
After that, you can run ESLint on any file or directory like this:
npx eslint yourfile.js
yarn eslint yourfile.jsx
pnpm eslint yourfile.tsx
This config extends the following plugins -