1.0.1 • Published 6 years ago

tslint-config-adidas v1.0.1

Weekly downloads
184
License
MIT
Repository
github
Last release
6 years ago

npm version

tslint-config-adidas

Basic TypeScript TSLint rules.

This should be the base for every TypeScript project.

Install

npm i --save-dev tslint@5 tslint-eslint-rules@5 tslint-config-adidas

Usage

Create a tslint.json file on the root folder of the project and add the following:

{
  "extends": "tslint-config-adidas"
}

You can also create tslint.yaml, check TSLint documentation for details.

Running

Create a lint script in your package.json:

{
  "scripts": {
    "lint": "tslint -p tsconfig.json" // run the linter over the files watched by the compiler as specified in tsconfig.json
  }
}

tslint CLI provides far more options, make sure to check its documentation.

In a terminal, run:

npm run lint

The linter will run and either exit clean if there were no issues or display a report log with all the issues found and exit with error.

Overriding rules

It sometimes can happen that some rule conflicts with the code, and the latter cannot be changed/updated to match the rule.

In those cases there are plenty of options, you can disable the rule globally, partially or override the rule.

Check this TSLint page on disabling rules through comments in the code. It is not recommended, but sometimes it's inevitable.

To override, add a rules entry in your tslint.json configuration and set any rules that should be overridden:

{
  "extends": "tslint-config-adidas",
  "rules": {
    // overrides "no-this-assignment": [true, { "allowed-names": ["^_this$"], "allow-destructuring": true }]
    "no-this-assignment": [true, { "allowed-names": ["^self$"] }],

    // overrides "radix": true
    "radix": false
  }
}

Links