Skip to content

Code Style

Sean Spires edited this page Mar 19, 2020 · 9 revisions

Frontend Development

Coding practices outlined in AirBnb’s JavaScript Style Guide will be followed with a few exceptions (listed below). A linter has been configured to warn or generate errors depending on the severity that the code misaligns with AirBnb’s guide. The indentation and spacing will be handled by an opinionated formatter (Prettier).

Use npm run lint in the "split-webapp/split" directory to check whether your additions follow coding conventions.

Spacing/Indenting

The rules set below should be followed; It provides better readability and uniformity across the codebase.

  • Soft tabs are 2 spaces:
  • Maximum print width is 80 characters; this provides better readability especially on smaller screens.

This formatting will be applied automatically when making a commit, either wise if an IDE is used, you can use the “Prettier” extension and indent the code as you go.

Exceptions

  • .js will be used as opposed to .jsx for React components

Backend Development

Coding practices outlined in PEP 8 -- Style Guide for Python Code will be followed.

Spacing/Indenting

The rules set below should be followed; It provides better readability and uniformity across the codebase.

  • Use 4 spaces per indentation level.
  • Spaces are the preferred indentation method.
  • Tabs to be used solely to remain consistent with code that is already indented with tabs.

Clone this wiki locally