简体   繁体   English

如何运行tslint.json?

[英]How to run tslint.json?

I am newbie to typescript. 我是打字稿的新手。 I have tslint.json file created but don't have an idea about how to run this file using command line. 我创建了tslint.json文件,但不知道如何使用命令行运行此文件。 Please advise which command do I need to use to run this config 请告知我需要使用哪个命令来运行此配置

tslint.json is TSLint configuration file. tslint.json是TSLint配置文件。 It requires either global tslint installation: 它需要全局tslint安装:

npm i -g tslint

In this TSLint can be executed from command line as tslint 在此TSLint中,可以从命令行执行tslint

Or local installation: 或本地安装:

npm i tslint

In this case tslint should be specified in package.json scripts: 在这种情况下,应在pa​​ckage.json脚本中指定tslint:

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

And be executed as npm run lint . 并作为npm run lint执行。

As tslint --help says, it accepts the following commandline options: 正如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 from existing file structure will be used by default. 默认情况下将使用现有文件结构中的tslint.json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM