DEV Community

Cover image for Do me lint! 🙋‍♂️ An easy way to setup ESLint in any project.
Artem M
Artem M

Posted on

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.

Top comments (0)