TSLint

An extensible linter for the TypeScript language.

Version

The version specified in your package.json or 5.10.0

Runtime

TypeScript Versions

Node.js Versions

Supported Languages

TypeScript

Official Documentation

https://palantir.github.io/tslint/

YAML Configuration

tslint:

  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:

    true/false

    Specifying true implies --fix option.

  • config-file:

    Alias of --config option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.5 CPU with 1920 MiB RAM.

  • options:

    Below is the list of options that are supported:

    -c, --config:
        The location of the configuration file that tslint will use to
        determine which rules are activated and what options to provide
        to the rules. If no option is specified, the config file named
        tslint.json is used, so long as it exists in the path.
        The format of the file is { rules: { /* rules list */ } },
        where /* rules list */ is a key: value comma-separated list of
        rulename: rule-options pairs. Rule-options can be either a
        boolean true/false value denoting whether the rule is used or not,
        or a list [boolean, ...] where the boolean provides the same role
        as in the non-list case, and the rest of the list are options passed
        to the rule that will determine what it checks for (such as number
        of characters for the max-line-length rule, or what functions to ban
        for the ban rule).
    
    -e, --exclude:
        A filename or glob which indicates files to exclude from linting.
        This option can be supplied multiple times if you need multiple
        globs to indicate which files to exclude.
    
    -r, --rules-dir:
        An additional rules directory, for user-created rules.
        tslint will always check its default rules directory, in
        node_modules/tslint/lib/rules, before checking the user-provided
        rules directory, so rules in the user-provided rules directory
        with the same name as the base rules will not be loaded.
  • experimental:

    • incremental:

      true/false

      Note: The incremental analysis is disabled if any kinds of configuration files are changed. The files recognized as configuration files are as follows:

      • Configuration files:
        • Files specified in config-file field
        • Files specified to -c, --config options
        • If none of the above configuration files are found:
          • **/tslint.json, **/tslint.yaml, **/tslint.yml
      • Rules files:
        • <rules-dir>/**/*Rule.js, <rules-dir>/**/*Rule.ts where <rules-dir> is one of the directories specified to -r, --rules-dir options

YAML Examples

  • With default options:

    inspecode:
      tslint: default
  • With enabling auto-fixing and default options:

    inspecode:
      tslint: auto-fix
  • With custom machine:

    inspecode:
      tslint:
        machine:
          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
  • With custom options:

    inspecode:
      tslint:
        options:
          --rules-dir: ./myrules
  • With a configuration file:

    inspecode:
      tslint:
        config-file: ./my-tslint.json

    The above configuration is equivalent to:

    inspecode:
      tslint:
        options:
          --config: ./my-tslint.json

Configuration File Detection

If no configuration files are specified via config-file or options field, Inspecode first lets TSLint to find configuration files in your repository. See https://palantir.github.io/tslint/usage/cli/#cli-usage about how TSLint looks for configuration files.

In addition, if TSLint cannot find any configuration files, Inspecode also walks the file tree in lexical order in your repository to find a configuration file named tslint.json, tslint.yaml or tslint.yml (case-insensitive) and specifies the file first found to TSLint automatically via --config option.

Note: Inspecode ignores specific configuration files while searching. See Configuration > Tool Configuration > Field: config-file for detail.

If the configuration file detected by Inspecode is not the one you want to use or you do not want to use any configuration files, you can disable Inspecode from detecting configuration files by explicitly setting an empty string to config-file field like below:

inspecode:
  tslint:
    config-file: ""

results matching ""

    No results matching ""