DEV Community

Samuel Lubliner
Samuel Lubliner

Posted on • Updated on

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.

Top comments (1)

Collapse
 
emmabase profile image
Emmanuel Eneche

Quite informative 👏