如何运行tslint.json?

时间:2018-09-30 07:15:00

标签: javascript node.js typescript tslint

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

1 个答案:

答案 0 :(得分:5)

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

npm i -g tslint

在此TSLint中,可以从命令行以tslint的身份执行

或本地安装:

npm i tslint

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

"scripts": { "lint": "tslint" }

并以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.
默认情况下,将使用现有文件结构中的

tslint.json