ESLint is a tool for formatting (linting) your code. It analyze your code and warn you of any potential errors. In order for it to work, you need to configure it with specific rules. Luckily, Standard provides an ESLint configuration that anyone can use.
- First we need to install Node.js
- Inside your current project. Initialize npm configuration. Using this command.
npm init -y
- Now enable support for linting common JavaScript features. Paste this in your terminal
npm i -D eslint eslint-config-standard eslint-plugin-import eslint-plugin-node eslint-plugin-promise eslint-plugin-standard
- Now create a
.eslintrc.js
file, use this commandtouch .eslintrc.js
- Add the following content inside your
.eslintrc
. Paste this inside your.eslintrc.js
file."extends": "standard" };
- Open
VsCode
and pressCtrl + Shift + X
- Type
ESLint
in the search bar - Find ESLint in the results, then click the Install
- Go ahead and close VSCode and then re-open it again.