A reference store of my ESLint configurations for new projects.
October 14, 2020
I feel this config is a bit outdated. I haven't gotten around to updating this based on the new stuff I'm using so please use with caution.
I start new projects often, and I'm obsessive about doing them the right way. ESLint, Prettier, the works. Even if it's a single page Next.js site, every project needs to have all the bells and whistles, so things are perfectly consistent across all my code ever written.
This collection is still a work in progress while I tinker with things.
Let's get started.
Prettier
I love Prettier. It's opinionated and gives me a fantastic base to get started. I use a pre-commit hook alongside Prettier to make sure anything missed gets formatted.
Before installing Husky, make sure you've created a Git repository first, or installing Git hooks will fail.
I rely on a lot of ESLint plugins to help lint my code. I'm obsessive about standards and consistency. Other than Prettier and standard ESLint / TypeScript rules, here are the things I need.
Imports should be grouped and sorted
Object (including destructured) keys should be sorted alphabetically
Component props should be sorted alphabetically
By using these rules, I can be certain that code across repositories will be consistent. But different types of projects require different rules and configurations. Let's break it down.