Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

JavaScript Style

Peter Hallam edited this page May 25, 2016 · 3 revisions

We try and enforce most of our style rules with eslint. Here's a list of style rules which are not currently enforced automatically.

Use _ prefix for private members of classes.

class List<T> {
  _values: Array<T>;
  constructor() {
    this._values = [];
  }
}

Don't implicitly convert values to Boolean.

This:

if (x == null) { ... }

Not:

if (!x) { ... }

TODO: Add more rules here ...