My Eslint and Prettier ConfigUpdated: March 29, 2020
I finally took some time to setup Eslint and Prettier with VS Code and made the eslint-config-eneax package.
If you want to know what Eslint rules I use, check them out here. If you want to install and configure the package on your projects, follow the instructions below.
You can use eslint globally and/or locally per project. I prefer to install it locally per single project, so I can have project specific settings:
package.json file with
npm init and install everything needed by the config:
.eslintrc file in the root of the project's directory and copy this:
You can add two scripts to your
package.json to lint and/or fix your code:
For instance, if all your code is in a
Now you can manually lint your code by running
npm run lint and fix all fixable issues with
npm run lint:fix.
If you want to overwrite eslint or prettier settings, go to your
.eslintrc file and you can add
ESLint rules go directly under
rules while prettier options go under
If you use VS Code and want it to lint all the errors for you, here are the instructions:
- Install the ESLint package
- Setup VS Code settings via
eslint modules that we installed previously:
package-lock.json file and delete the
node_modules/ directory and repeat above instructions again!