2020 April 03

ESLint & Prettier Setup


Requirement: Install Node.js

In your Github repo, be sure in your ".gitignore" file to add node_modules. This will prevent git from pushing this giant file full of dependencies to your master.

In your repo also add a new file called "package.json", I use the command npm init -y

ESLint Getting Started

cd into your repo and type this command npm i eslint --save-dev. This installs eslint in your repo. You could install this globally if you wish, but for now we'll keep it simple.

Next we want to create a new file called ".eslintrc.json", and in that we want to paste in the following code.

Prettier Getting Started

To install prettier, use this command npm install --save-dev --save-exact prettier

In your "package.json" file add this. This will allow prettier to actively watch and format as you type.

In VS Code editor

In "settings.json" for VS Code, be sure this is added.

Once this is saved, you should be set. Adjust as needed.

Copyright © 2021. Jake Wantulok