EsLint NOTE

Ketan Trentiya
1 min readFeb 12, 2022

Hands on guideline for Eslint.

Quick Start

Step 1:
Install eslint as dev dependencies in local app
npm install eslint --save-dev
or
yarn add eslint --dev

Step 2 :
Initialize eslint into the app
eslint --init

Step 3:
Put the below lines into the “scripts” object of the package.json file to Run Eslint from the command line.

"lint": "eslint \"src/**/*.{js,jsx}\"",
"lint-fix": "eslint \"src/**/*.{js,jsx}\" --fix"

Step 4:
Run Eslint into app
npm run lint
or
yarn run lint

Use Airbnb Style Guide along with Eslint

Step 1 :
Install Airbnb style guide
yarn add eslint-config-airbnb --dev

Step 2:
Run this command to list all the peer dependencies
npm info "eslint-config-airbnb@latest" peerDependencies

Step 3:
Run this command to Install peer dependencies (Required npm version 5+)
npx install-peerdeps --dev eslint-config-airbnb

Step 4:
Extend “airbnb” in .eslintrc.json file like this:

"extends": [
...,
...,
"airbnb"
]

--

--