Style Guide

Software Engineering at Driver

This guide recommends stylistic and architectural best practices, designed to make your code easier for others to understand. It offers guidelines not rules, and there are situations in which the advice offered should be actively ignored.

JavaScript

React/Redux

Flowtype

𝓣𝓢 TypeScript 𝓣𝓢

Prettier

Add the following to package.json:

  "prettier": {
    "overrides": [
      {
        "files": ["*.js", "*.scss", "*.css", "*.pcss"],
        "options": {
          "singleQuote": true,
          "trailingComma": "all"
        }
      }
    ]
  }

The following information about prettier is better described on the prettier documentation here. Use lint-staged to auto-call prettier in a precommitscript”:

  "lint-staged": {
    "src/**/*.scss": ["prettier --parser scss --write", "git add"],
    "src/**/*.{js,css}": ["prettier --parser flow --write", "git add"],
    "nightwatch/**/*.js": ["prettier --write", "git add"]
  }

Npm

  1. “watch”: Starts the dev server
  2. “build”: Builds static assets (if they exist) “/src” -> “/build
  3. “test”: Runs all tests (linting first, then unit tests)