With the right tools, any developer can enjoy deeply satisfying coding sessions. Mastering flow is empowering. The opposite leads to frustration and annoyance. Luckily, linters and formatters can help do the heavy lifting when it comes to coding best practices.

In the guide below, VS Code users and Ruby on Rails developers can find a detailed setup to build well-formatted and styled projects in no time!

  1. JavaScript  StandardJS (w Prettier)
  2. CSS and SCSS — Stylelint
  3. Ruby — Rubocop and Rubocop Rails
  4. Markdown — Markdownlint

First, what is the difference between a linter and a formatter?

A linter checks code for best practices and code quality. It checks for both programmatic as well as stylistic errors. It’s like an advanced spell checker (e.g. Grammarly) for programming languages. A formatter shines in applying a consistent format everywhere (like tabs and spaces). Linters can be used as formatters, but they might not always be the best at that. It depends. For JavaScript files, using Standard as the linter and Prettier as the formatter is an excellent combo. For Ruby, Rubocop has both great formatting as well as linting capabilities.

A linter can be executed by a terminal command. On top of that, it can be integrated into an editor (e.g. VS Code). You can unleash advanced formatting and styling skills without ever leaving your development env. This article will help you to set up both. No more endless searching around to install the right package or to find the right formatting rules. Below is an installation guide from A to Z.

#javascript

How To Set Up Linters and Formatters for VS Code and Ruby on Rails
1.50 GEEK