Oberon TSlint config & standard
The Oberon typescript code standard & config.
- Semicolons at the end of each statement.
- camelCasing should be used on all object properties.
- Always use curly brace conventions. Even if your block only consists of a single statement.
- Single quotes are the default. But use double quotes within JSX.
- Indents with 4 spaces, no tabs allowed.
- Always use === for comparing equality
- Don't use var, use const/let instead.
- Don't declare multiple variables on a single line. Except for uninitialized variables. This is allowed:
const a b c;
const a = false b = true c = false;
tslint.json file to your project:
Install tslint & tslint-config-oberon locally (
npm i -D tslint tslint-config-oberon)
Optionally, add tslint as a precommit hook by installing husky (
npm i -D husky) and adding a
precommit script to your package.json
Optional prettier setup:
In order to enforce good practices concerning code quality, it is advised to let prettier handle the code formatting and tslint the semantics and syntax. To install prettier please follow the readme of the oberon-config-prettier. To resolve conflicts between tslint and prettier you also need to install tslint-config-prettier (
npm i -D tslint-config-prettier) and add it to the