Skip to content
Snippets Groups Projects
Select Git revision
20 results

style_guide_js.md

Forked from GitLab.org / GitLab FOSS
1232 commits behind the upstream repository.
style_guide_js.md 9.81 KiB

Style guides and linting

See the relevant style guides for our guidelines and for information on linting:

JavaScript

We defer to Airbnb on most style-related conventions and enforce them with eslint.

See our current .eslintrc for specific rules and patterns.

Common

ESlint

  1. Never disable eslint rules unless you have a good reason.
    You may see a lot of legacy files with /* eslint-disable some-rule, some-other-rule */ at the top, but legacy files are a special case. Any time you develop a new feature or refactor an existing one, you should abide by the eslint rules.

  2. Never Ever EVER disable eslint globally for a file

  // bad
  /* eslint-disable */

  // better
  /* eslint-disable some-rule, some-other-rule */

  // best
  // nothing :)
  1. If you do need to disable a rule for a single violation, try to do it as locally as possible