TypeScript Config Aller
Aller Media's common configuration files for TypeScript projects. These include:
- tsconfig.json -- the Compiler
- tslint.js -- the Linter
Installation
Get started by running this command in the root of your project:
npm install --save-dev @aller/ts-config-aller
cp node_modules/@aller/ts-config-aller/tsconfig.example.json tsconfig.json
cp node_modules/@aller/ts-config-aller/tslint.example.json tslint.json
Setup
TypeScript Compiler
The tsc
compiler expects a configuration file in the root directory of the project:
{
"extends": "./node_modules/@aller/ts-config-aller/tsconfig.json",
"files": [
...
],
"include": [
...
],
"compilerOptions": {
"outDir": "dist"
}
}
The sections files
and include
determine which files or locations will be picked up by the compiler. Please refer to the official documentation for detailed examples.
TSlint
The configuration for TSlint was originally taken from Reader Critics and then extended/modified with some of the rules that already have an equivalent in the ESlint configurations which are used in our department:
{
"extends": "@aller/ts-config-aller"
}
Most of the rules are actually equal to those of Airbnb with the exception of a few which we found annoying. Additionally, we don't use custom rulesets.
License
Copyright © 2017 DB Medialab / Aller Media AS (Oslo, Norway)
Licensed under the MIT License.