Member-only story

ESLint, TypeScript, & Prettier Setup

Ben Grunfeld
3 min readSep 3, 2020

Looking for a great (remote only) React Dev? Or just feel like having a chat? Visit my profile on LinkedIn and say hi! šŸ˜ƒ

Often, the hardest part of using a package is configuring it and making sure it plays nice with all the other packages that work in the same domain.

Naturally, thereā€™s significant overlap between ESLint, Prettier, and TypeScript, and if you havenā€™t set it up in the right way, youā€™ll soon be gazing in a bovine trance at the ā€œGreat Wall of Errorsā€.

In this article, weā€™ll go over installation and configuration, but weā€™re not going to do it step-by-step. I just find that way exhausting. Youā€™re not looking for how to make sure each atomic piece works for a niche situation ā€” you just want all of it to work together. So thereā€™ll be a lot of copy/paste configuration files. Itā€™s just easier.

npm i -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-prettier eslint-plugin-prettier eslint-plugin-react husky lint-staged prettier typescript

Youā€™ll notice that Iā€™m also adding in husky and lint-staged. Husky makes sure that the ESLint checks all pass before it allows you to make a commit and Lint-Staged optimizes the ESLint checks so that only files that have changed are linted. Lint-Staged really shines in larger projects where there are tensā€¦

--

--

Ben Grunfeld
Ben Grunfeld

Written by Ben Grunfeld

Iā€™m a Front End Engineer who loves React, NextJS, and GraphQL. Looking for a developer in #Israel? Contact me at: https://www.linkedin.com/in/bengrunfeld/

No responses yet