Skip to content

Instantly share code, notes, and snippets.

@ermish
Last active July 4, 2021 11:58
Show Gist options
  • Save ermish/cd94d2d661bf5614f31b9207719f0ff3 to your computer and use it in GitHub Desktop.
Save ermish/cd94d2d661bf5614f31b9207719f0ff3 to your computer and use it in GitHub Desktop.
a collection of coding guidelines/bestpractices/standards/goodthingstodo!

Coding Guidelines

Sass and html-y things

  • Don't use classes in html based on styles
    • i.e. instead of .table .table-lined .shift-right .moar-styling use user-table and use sass %placeholders instead.
  • Place @media queries within each related component
  • Use em's and rem's instead of px. (there's handy sass functions to convert px)
  • 99% of the time, avoid tables. instead, use divs to avoid the underlying styling challenges when using table.
  • Don't nest reusable styles in shared scss files. This makes it difficult to see the impact of what styles are inherited and forces the consumer to override unwanted nested styles.

React / Vue / javascript

  • Booleans should start with a verb like isVisible canOpen shouldClose
  • Use absolute paths in js imports
  • Use when possible:
    • arrow functions
    • pure functions
    • async/await
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment