lbry.tech/documents/guides.md
ポール ウェッブ 347c89755b JS styleguide!
2018-08-29 16:57:57 -05:00

1 KiB

title
Quality Guides

When contributing to this repo there are existing coding guidelines that you can find here (CSS) and here (JavaScript). However, here's a high-level overview:

CSS

  • Styles should never override - :not and media queries make this possible
  • IDs do not belong in stylesheets
  • Nesting should be a maximum of three levels deep
  • BEM is your friend
  • Nested includes should be at the top of rules
  • CSS parameters in alphabetical order, except for presentation styles

JS

  • Space indentation - Two spaces, makes reading code easy for humans
  • Double-quotes - Use single quotes within to avoid escaping
  • No unused variables - This one catches tons of bugs!
  • Semicolons protect you from yourself
  • Space after keyword - if (condition) {}
  • Space after function name - function name (arg) { ... }
  • No space in array bracket - const arr = [1, 2, 3]
  • Always space in block - const obj = { foo: "bar" }
  • Always === instead of == - Strict compares are consistent
  • No trailing commas