Installation
@nish1896/eslint-config works with ESLint 8.57.1 or below. For newer ESLint versions, install @nish1896/eslint-flat-config instead.
If you are migrating from v2 of this package, please check this guide.
You'll first need to install ESLint. If your project is a monorepo, consider creating a separate eslint-config for each package.
We will be installing v8.57.1, which was the last major version prior to the release of version 9.
- npm
- pnpm
- yarn
npm i eslint@8.57.1 --save-dev
pnpm add -D eslint@8.57.1
yarn add -D eslint@8.57.1
Next, install @nish1896/eslint-config.
- npm
- pnpm
- yarn
npm install @nish1896/eslint-config --save-dev
pnpm add -D @nish1896/eslint-config
yarn add -D @nish1896/eslint-config
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.js
yarn eslint yourfile.js
This config extends the following plugins -