Installation
Depending on the ESLint version used in your project, you can choose:
- @nish1896/eslint-flat-config for ESLint
v10 - @nish1896/eslint-flat-config
v3for ESLintv9 - @nish1896/eslint-config for ESLint
v8
However, since both ESLint v8 and v9 are deprecated, upgrading to v10 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 need to install ESLint and @nish1896/eslint-flat-config.
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
- pnpm
- yarn
npm i eslint @nish1896/eslint-flat-config --save-dev
pnpm add -D eslint @nish1896/eslint-flat-config
yarn add -D eslint @nish1896/eslint-flat-config
Requires Node.js ^20.19.0 || ^22.13.0 || >=24 and ESLint >=10.
@eslint/js is a peer dependency that npm and pnpm install automatically;
with Yarn 1, add it yourself. If you use the ts or next-ts modules,
install typescript >=4.8.4 <6.1.0, because typescript-eslint does not
support TypeScript 7 yet.
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:
- npm
- pnpm
- yarn
npx eslint yourfile.js
pnpm eslint yourfile.tsx
yarn eslint yourfile.jsx
This config extends the following plugins -