Logo

dev-resources.site

for different kinds of informations.

Do me lint! 🙋‍♂️ An easy way to setup ESLint in any project.

Published at
12/30/2024
Categories
javascript
typescript
eslint
Author
mavrik
Categories
3 categories in total
javascript
open
typescript
open
eslint
open
Author
6 person written this
mavrik
open
Do me lint! 🙋‍♂️ An easy way to setup ESLint in any project.

ESLint

You’ve probably used ESLint (or at least heard of it) in your JavaScript or TypeScript projects. It’s a great tool to keep your code consistent and error-free, but setting it up is not that simple.

I want to share a cool little tool I found to make eslint setup in your project a just one command!

Why ESLint at all? 🤔

ESLint helps you:

  1. Catch Bugs Early: It flags issues in your code before they become real problems.
  2. Keep Things Consistent: Everyone on the team writes code the same way.
  3. Write Better Code: Cleaner, more maintainable code is always a win.

Strict rules are great for catching problems early, but getting that setup right? That’s where things get tricky.

ESLint setup is hard

ESLint has so many rules, and while that’s awesome, it also makes setting it up a bit of a headache. You’ve got to:

  • Spend time figuring out what rules to use.
  • Test them to make sure they fit your codebase.
  • Deal with the sheer number of options (which can be pretty intimidating).

Meet do-me-lint 🪄

do-me-lint is a script you can run in your project, and it’ll generate an .eslintrc.yml file for you. The cool thing is, it analyzes your project and selects rules that actually make sense. Sure, it’s opinionated (in a good way), but the author spent a lot of time researching and testing these rules to ensure they work well for most projects.

Here’s how you use it:

  1. Run this in your terminal (in your existing project):
   npx do-me-lint
Enter fullscreen mode Exit fullscreen mode

That’s it! You’ll get a solid .eslintrc.yml file ready to go, along with all the necessary ESLint packages installed to streamline the selected rules.

Tweaking the Rules 🔨

Of course, no setup is perfect for everyone. Sometimes you’ll want to tone down a rule or turn it off completely. Do it in do-me-lint config:

  1. Change Errors to Warnings: Create .domelintrc.yml and add the rule under relaxedRules:.
   relaxedRules:
     - import/no-default-export
Enter fullscreen mode Exit fullscreen mode
  1. Disable Rules Completely: Add the rule to ignoredRules:.
   ignoredRules:
     - import/no-default-export
     - '@typescript-eslint/class-methods-use-this'
Enter fullscreen mode Exit fullscreen mode

Next time you run do-me-lint, it’ll apply your changes.

Is it a hidden gem? 💎

Honestly, do-me-lint feels like a hidden gem. It gets the job done and saves you a ton of time. If you’ve ever felt overwhelmed by ESLint setup, give it a try. It might just become one of your favorite tools 👍.

That’s all for now — happy linting! 🚀

Links

Project on GitHub.

eslint Article's
30 articles in total
Favicon
Just use this Next.js Eslint Configuration
Favicon
3. How to setup Jest in a Next 15 project (+ eslint for testing)
Favicon
Do me lint! 🙋‍♂️ An easy way to setup ESLint in any project.
Favicon
Restricting some syntax with ESLint
Favicon
Beyond Spellcheck: How Static Analysis Tools Enhance Collaboration in Coding
Favicon
ESlint 9
Favicon
How to Fix Common ESLint Errors: Troubleshooting Unknown or Strange Issues
Favicon
Incrementally fixing lots of ESlint errors in a clean way with ESlint Nibble
Favicon
Setup Eslint Prettier in a TypeScript project with mongoose ODM
Favicon
Vue3 + ESLint 9.13.0 + Prettier +TypeScript and VSCode Autoformat on Save
Favicon
Configurando un proyecto de React para producciĂłn
Favicon
Configurando Prettier, ESLint y Husky en Angular
Favicon
Eslint Code Insights from Bitbucket pipelines
Favicon
How to get ESLint 9.11.1 to run in Vue 3
Favicon
CĂłmo hacer que ESLint 9.11.1 funcione en Vue 3
Favicon
Performing Maintenance Task For A Large Codebase
Favicon
Setup Prettier Pada Nextjs Tailwind Project
Favicon
“Eslint-Summary” — Hack your Eslint Config
Favicon
Regras customizáveis para Prettier + Eslint em React
Favicon
Useful VS Code Extensions for JS
Favicon
ESLint 9 Flat config tutorial
Favicon
ESLint x Prettier: The Right Way To Start A JavaScript Project
Favicon
How to Set Up ESLint and Prettier in a TypeScript Project
Favicon
Customizable rules for Prettier + Eslint in React
Favicon
How to set up Eslint and prettier
Favicon
Configure Eslint, Prettier and show eslint warning into running console vite react typescript project
Favicon
Building Vue3 Component Library from Scratch #11 ESlint + Prettier + Stylelint
Favicon
Setup Eslint + Prettier for code standardization in React
Favicon
Setup Eslint + Prettier para padronização de código em React
Favicon
ESLint Plugin. What was missed in the doc?

Featured ones: