Create your own ESLint Plugin with custom project-specific Linting Rules (5 min)

J Hinter
3 min readMay 4, 2021

Linting rules are a powerful tool to establish common ground within a development team. The rules define guidelines on how to format and structure your code.

Using predefined rule sets, like Airbnb’s ESLint config with more than 2 million weekly downloads, is really popular nowadays. Some frontend frameworks even include them by default.

But the real power of ESLint lies in custom rules! Most grown projects have these fragile parts within an application that Junior developers are afraid to touch. You have to do things in a certain way and you always have to watch out not to do anything wrong.

My recommendation to all Seniors: Don’t write tech documentation nobody is going to read! Simply create custom ESLint rules to provide guidelines to your colleagues and catch common mistakes early.

That’s exactly what I’m going to show you here. We’re going to create our very own ESLint plugin with project-specific rules.

Example Use Case

For making sure our Jest tests run properly, my team has to make sure to always wait for React-Testing-Library’s “waitFor” to resolve.

That’s why we want ESLint to throw an error if it spots the usage of “waitFor” without a…

--

--