EsLint NOTE
Hands on guideline for Eslint.
Quick Start
Step 1:
Install eslint as dev dependencies in local appnpm install eslint --save-dev
oryarn add eslint --dev
Step 2 :
Initialize eslint into the appeslint --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
oryarn run lint
Use Airbnb Style Guide along with Eslint
Step 1 :
Install Airbnb style guideyarn add eslint-config-airbnb --dev
Step 2:
Run this command to list all the peer dependenciesnpm 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"
]