Style Guide - mvrt-115/MVRT_Site GitHub Wiki

Note: This is a work in progress and is subject to change.

As a wise guy said:

Every line of code should appear to be written by a single person, no matter the number of contributors.

General

  • Use EditorConfig. It sets up rules regarding whitespaces and tabs.

HTML

  • Use the most sematically apropriate element if possible, i.e. <p> for paragraphs; <ol>, <ul>, <dl> for ordered, unordered, and description lists, respectively; <h1>-<h6> for headings.
  • Attributes should be double quoted, like this: <p class="double-quoted-attribute">
  • Avoid inlining JavaScript/DOM events into HTML
  • Avoid using slashes in empty elements, i.e. <br>, <hr>, <img>, etc.
  • use-hyphens-for-class-and-id-names

SCSS

  • use-hyphens-for-naming-selectors
  • Do not nest too much

JavaScript

  • If it breaks in JSHint, it's probably wrong
  • Do not use semicolons (up to debate) except in cases specified here
  • When declaring functions, add a space between the function name and the ()
  • Open curly braces go on the line where the block is declared
  • Avoid making lines greater than 80 characters
  • When possible, use modules
  • Use lowerCamelCase for normal variables and functions, UpperCamelCase for "class" names, hy-phens for CSS strings and CAPS_SNAKE_CASE for constants.
⚠️ **GitHub.com Fallback** ⚠️