如何运行tslint.json?

Hem*_*ari 4 javascript node.js typescript tslint

我是打字新手。我已tslint.json创建文件,但对如何使用命令行运行此文件一无所知。请告知我需要使用哪个命令来运行此配置

Que*_*tin 6

tslint.json是TSLint配置文件。它需要全局tslint安装:

npm i -g tslint
Run Code Online (Sandbox Code Playgroud)

在此TSLint可以从命令行执行为 tslint

或本地安装:

npm i tslint
Run Code Online (Sandbox Code Playgroud)

在这种情况下,应在pa​​ckage.json脚本中指定tslint:

"scripts": { "lint": "tslint" }
Run Code Online (Sandbox Code Playgroud)

并执行为npm run lint

如前所述tslint --help,它接受以下命令行选项:

-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.
Run Code Online (Sandbox Code Playgroud)

tslint.json 默认情况下,将使用现有文件结构中的。