DEV Community

Samuel Lubliner
Samuel Lubliner

Posted on β€’ Edited on

4

Linting

Style Guides

Linters

  • Scan code with a set of style rules
  • Report any errors to you that they find
  • Can also be set to automatically fix some errors

The industry standard for JavaScript is ESLint. VS Code has an ESLint extension. Here is a guide.

Prettier

  • Formats code according to a set of rules
  • Unlike a linter, it’s not looking for style errors
  • It specifically targets the layout of the code (spaces, indentation levels and line-breaks)

Resolving conflicts with using ESLint and Prettier together

Using ESLint and Prettier together causes conflicts. To fix that follow the instructions to install eslint-config-prettier. It turns off all ESLint rules that might conflict with Prettier.

Warning: eslint-plugin-prettier lets you run Prettier as if it were a rule in ESLint. However, doing this is not recommended.

Template Repositories

Minimize the repetitive work of setting up ESLint and Prettier by using a template repository.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (1)

Collapse
 
emmabase profile image
Emmanuel Eneche β€’

Quite informative πŸ‘

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more