Steps to take to add ESLint to JavaScript projects.
Itβs a linter; think syntax correction, cleaning up your code, errors etc.
To install it, head over to either the VSCode market place or click on the extensions icon on the left hand side within VSCode (squares icon) and search for ESLint.
Within your JavaScript project, head over to package.json
and add the following:
You can also download it via npm install eslint -g
, which will install it globally. In your root project you will need to pass the command eslint --init
.
scripts: {
"lint": "eslint"
}
npm run lint
In the root of your project, you can create an .eslintrc.json
file.
Example config of the file
{
"env": {
"brower": true,
"es6": true
},
...
"rules": {
no-empty: 0;
no-irregular-whitespace: 0;
}
}