How I dealt with over 30,000 ESLint errors

How I dealt with over 30,000 ESLint errors

When I first learned about ESLint, I was incredibly excited to enable it for my codebase. I was eager to get all the benefits a codebase with ESLint enabled offered. However, this involved a fairly intensive migration to upgrade my codebase up to my ESLint configuration standard.

My Journey

When I first learned about ESLint, I was incredibly excited to enable it for my codebase. I was eager to get all the benefits a codebase with ESLint enabled offered. However, this involved a fairly intensive migration to upgrade my codebase up to my ESLint configuration standard. This was my experience.

My Configuration

I researched a lot about and ultimately decided with this configuration.

module.exports = {
  extends: [
    'airbnb',
    'airbnb/hooks',
    'plugin:jest/recommended',
    'plugin:jest/style',
    'plugin:prettier/recommended',
    'plugin:testing-library/react',
    'prettier/react',
  ],
};

Airbnb’s ESLint seemed to be the the de facto coding standard in the Javascript community, and I included Airbnb’s Hooks rules as well since I was beginning to use React Hooks. I used Jest and React Testing Library so it made sense to also include their recommended ESLint configurations. And finally, I included Prettier since I heard great things about how it essentially eliminates the need to think and worry about code formatting.

Migration

Armed with this configuration, I ran ESLint for the first time. Oh man, did I received a surprise punch to the gut. My codebase had over 30,000 errors! What had I done!?

After a few minutes of shock and disbelief and regretting my initiative, I ran ESLint’s auto fix. This time I only had about 5,000 errors. Well, that was a lot better. Auto fix fixed 25,000 errors but I still had a massive amount to manually resolve.

web-development eslint javascript programming code-quality

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

13 Useful JavaScript Developer Tools for Writing High-Quality Code

Today I’m going to show you 13 well-know and popular tools to write better and cleaner JavaScript code. These are tools that I’m using right now on my JavaScript developer journey. So if you want to improve the quality of your projects, this list is for you.

ESLint — A Proofreader for your Code

ESLint is Javascript’s linter. It works by analyzing your code and warning you if any configured rules are violated. These rules can detect suspicious or concerning coding quality or formatting issues.

Why Web Development is Important for your Business

With the rapid development in technology, the old ways to do business have changed completely. A lot more advanced and developed ways are ...

Important Reasons to Hire a Professional Web Development Company

    You name the business and I will tell you how web development can help you promote your business. If it is a startup or you seeking some...

Principles of Functional Programming in JavaScript That Will Make Your Coding Life Easier

Who else loves to write side-effects-free functions? I think we, as programmers, all do. Today, in this story, I will walk you through the basic principles of functional programming that will make your coding life easier.