Initialize package
// npm
npm init -y
// yarn
yarn init -y
Install eslint
// npm
npm install eslint --save-dev
// yarn
yarn add eslint --dev
Initialize basic config for eslint
// npm
npx eslint --init
//yarn
yarn run eslint --init
Configure .eslintrc.{js,yml,json}
{
"rules": {
"semi": ["error", "always"],
"qoutes": ["error", "double"]
}
}
"off"
=== 0
"warn"
=== 1
"error"
=== 2
{
"extends": "eslint:recommended"
}
Rules with check on this page will be extended to your config.
You can use configurations created by the others by extending them. Can be find here
// npm
npx eslint yourfile.js
// yarn
yarn run eslint yourfile.js