TSLint

Web Sitehttps://palantir.github.io/tslint/
LanguageTypeScript
Supported Version5.6.0

Getting Started

To start using TSLint in SideCI, declare dependency in package.json in your repository.

$ npm install tslint -D

If you need customization, use standard TSLint config file. Create tslint.json and include your repository.

Configuration via sideci.yml

Example settings for TSLint under tslint:

linter:
  tslint:
    npm_install: true
    options:
      config: 'lint_yml/tslint.json'
      exclude: 'node_modules/**'
      project: 'tsconfig.json'
      rules-dir 'your_custom_rule'
      type-check: true
    glob: '**/*.ts{,x}'

npm_install

This option controls npm command invocation. Using this option, you can install dependencies to your program

true
Run npm install --ignore-scripts
development
Run npm install --only=development --ignore-scripts
production
Run npm install --only=production --ignore-scripts

When your package.json contains dependency which cannot be installed in SideCI container, npm install fails. The analysis will be done but the result may be an unexpected one. In this case, try using development or production option, or let the dependency be optionalDependency

options

This option controls command line options given to tslint.

config

This option controls configurations file for TSLint. If you have tslint.json file, use this option.

exclude

This option controls which files TSLint excludes from linting. Default value of this option is node_modules/**. So you need not set this option.
Furthermore, in case you would like to exclude plural files/directories, declare it as list like below:

linter:
  tslint:
    options:
      exclude:
        - 'node_modules/**'
        - '.git/**'
        - 'cache/**'

project

This option controls project file. If you have tsconfig.json file, declare it in this directive.

rules-dir

This option controls customized rules TSLint inspects. If you would like to use your own ruleset for TSLint and you have the ruleset file, declare it in this directive.

type-check

This option controls whether makes the type checker enabled when running TSLint. In case of enabling type-check, declare true.

glob

This option controls files TSLint inspects. By default, .ts and .tsx files are inspected.

Please check the following for more details on the execution parameters when running tslint:
TSLint - CLI Usage