Skip to main content

Style Guides

All of our repositories should follow similar code design patterns. This makes our code more digestible by both humans and machines. We accomplish this by using strict linting settings and asking all of our contributors to verse themselves on the de-facto standard style guides that apply to the type of project they are working with.

Below, you will find recommendations for style guides to abide by depending on the project type. Linting details are covered on the Linting page.

General

In general, you should take note of the style guides published by industry giants like Google. Some of these style guides, which includes style guides for multiple languages, are:

  1. Google's Style Guides
  2. Awesome Guidelines
  3. Thoughtbot's Guides
  4. Khan Academy Coding Style Guides

These style guide catalogs link to style guides to a plethora of languages that we do not focus on as well as auxilary style guides that should be paid attention to like Google's Markdown Style Guide.

Ansible

There are no widely accepted style guides available for Ansible. Instead, we recommend you look at our Android Studio role as an example. Take special note of the following:

  • Comments in the task files are specially marked up
  • Comments in the variable files are specially marked up
  • The main.yml file references other files based on the operating system.

If you follow the format of the Android Studio role, our automated system will automatically generate documentation properly for the role. This leads to a better experience for internetizens who make use of the role.

Bash / Shell

The following style guides are recommended:

  1. Google's Shell Style Guide
  2. Bahamas10 Bash Style Guide

Combine the advice given by the style guides along with the recommendations given by the shellcheck linter.

CSS / SASS / HTML

There is no shortage of CSS / SASS / HTML style guides. All of the following guides / information portals are recommended:

  1. Airbnb CSS / SASS Style Guide
  2. Airbnb CSS in JavaScript Guide
  3. Google HTML / CSS Style Guide
  4. BEM
  5. CSS Guidelines
  6. SASS Guidelines
  7. Khan Academy CSS Style Guide

Go

The following style guides are recommended:

  1. Google Go Style Guide
  2. Uber Go Style Guide
  3. Khan Academy Go Style Guide

Our Go projects are configured to use golangci-lint with a handful of plugins. The configuration is stored in the .config/ folder.

PowerShell

The following PowerShell style guide is perhaps one of the more notable style guides available for PowerShell:

  1. PowerShell Practice and Style

Python

  1. Google Python Style Guide
  2. Official PEP 8 Python Style Guide
  3. Khan Academy Python Style Guide

Additionally, the Hitcherhiker's Guide to Python is a comprehensive documentation portal that could be invaluable to some.

Flake8, with a few plugins, is used in our Python projects. The configuration is stored in the .config/ folder.

Rust

  1. Official Rust Style Guide

TypeScript / JavaScript

  1. Airbnb JavaScript Style Guide
  2. Google TypeScript Style Guide
  3. Google JavaScript Style Guide
  4. Clean Code JavaScript
  5. Khan Academy JavaScript Style Guide

Additionally, JavaScript, The Right Way is a valuable resource that links to many useful resources.

Our projects are configured to use ESLint with a custom NPM module named eslint-config-strict-mode that defines the ESLint settings / plugins. If you would like to change the settings, you should either create a pull request against eslint-config-strict-mode or utilize the package.json file to define project-specific linting overrides.

Angular

The official Angular website offers an official style guide:

  1. Official Angular Style Guide

Node.js

  1. Microsoft's Node.js Guidelines
  2. Felixge's Node.js Style Guide

React

  1. Airbnb React/JSX Style Guide
  2. Khan Academy React Style Guide