TypeScript TSLint - assuring code quality and consistency Using a predefined ruleset as default


tslint can extend an existing rule set and is shipped with the defaults tslint:recommended and tslint:latest.

tslint:recommended is a stable, somewhat opinionated set of rules which we encourage for general TypeScript programming. This configuration follows semver, so it will not have breaking changes across minor or patch releases.

tslint:latest extends tslint:recommended and is continuously updated to include configuration for the latest rules in every TSLint release. Using this config may introduce breaking changes across minor releases as new rules are enabled which cause lint failures in your code. When TSLint reaches a major version bump, tslint:recommended will be updated to be identical to tslint:latest.

Docs and source code of predfined ruleset

So one can simply use:

  "extends": "tslint:recommended"

to have a sensible starting configuration.

One can then overwrite rules from that preset via rules, e.g. for node developers it made sense to set no-console to false:

  "extends": "tslint:recommended",
  "rules": {
    "no-console": false