Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.18 KB

coding_style.md

File metadata and controls

34 lines (24 loc) · 1.18 KB

Coding Standards

The Servus codebase uses prettier to automatically format our code files. Our continuous integration test for formatting will fail if it detects that committed files do not follow the standards set in our prettier config (Servus/.prettierrc.json) file:

{
    "trailingComma": "es5",
    "tabWidth": 4,
    "semi": true,
    "singleQuote": true,
    "jsxBracketSameLine": true,
    "arrowParens": "avoid",
    "endOfLine": "lf"
}

Conventions

JavaScript

  • camelCase is used for variable and function naming.
  • let is preferred over var for declaring variables.
  • single quotes ('text') are used for strings, except when using template literals, where we use ` instead.

Google Maps API

  • The Google Maps API has some variables that are in snake_case, which must occasionally be used in the code base as such.

Database

  • Database entities are named in snake_case. Thus, the corresponding backend variables that refer to database elements are in snake_case.
    • We thought this could be a good way to distinguish between local variables and accesses to variables that must match the name of the database schema.