@nationalbankbelgium/code-style
Version:
Front-End code style
60 lines (46 loc) • 2.31 kB
Markdown
<h1 align="center">
code style - TSLint
</h1>
## About
This sub-package hosts the [TSLint](https://palantir.github.io/tslint/) configuration.
The following versions are available (based on **TSLint** version):
- 4.3.x - `/code-style/tslint/4.3.x`
- 5.10.x - `/code-style/tslint/5.10.x`
- 5.11.x - `/code-style/tslint/5.11.x`
- 5.12.x - `/code-style/tslint/5.12.x`
- 5.13.x - `/code-style/tslint/5.13.x`
- 5.14.x - `/code-style/tslint/5.14.x`
- 5.15.x - `/code-style/tslint/5.15.x`
- 5.16.x - `/code-style/tslint/5.16.x`
- 5.17.x - `/code-style/tslint/5.17.x`
- 5.18.x - `/code-style/tslint/5.18.x`
- 5.19.x - `/code-style/tslint/5.19.x`
- 5.20.x - `/code-style/tslint/5.20.x`
- 6.0.x - `/code-style/tslint/6.0.x`
- 6.1.x - `/code-style/tslint/6.1.x`
## Usage
Adapt the content of your `tslint.json` file as follows:
```text
{
"extends": ["tslint:latest", "whatever config", "@nationalbankbelgium/code-style/tslint/6.1.x"],
"rules": {
// your rules
}
}
```
## Recommended Additional Configs
We highly recommend using [Prettier](https://prettier.io) to handle all the formatting hassle in your codebase.
In fact `code-style` also provides a Prettier config you can use: [code style - Prettier](../prettier/README.md).
In this case, when using Prettier you would also need an additional TSLint configuration preset: [tslint-config-prettier](https://github.com/prettier/tslint-config-prettier)
to avoid conflicts with this `code-style/tslint` config regarding some formatting related rules.
So make sure to use those configs in your `tslint.json` as follows:
```text
{
"extends": ["tslint:latest", "whatever config", "@nationalbankbelgium/code-style/tslint/6.1.x", "tslint-config-prettier"],
"rules": {
// your rules
}
}
```
**IMPORTANT: notice that the `tslint-config-prettier` preset is used at the end of the `extends` list. The reason for this is that such preset
overrides any formatting TSLint rule that was enabled by the precedent presets that may conflict with Prettier.**