typescript 如何运行 tslint.json?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52575553/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to run tslint.json?
提问by Hemadri Dasari
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. Please advise which command do I need to use to run this config
我是打字稿的新手。我tslint.json
创建了文件,但不知道如何使用命令行运行此文件。请告知我需要使用哪个命令来运行此配置
回答by Quentin
tslint.json
is TSLint configuration file. It requires either global tslint
installation:
tslint.json
是 TSLint 配置文件。它需要全局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:
在这种情况下,应在 package.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.
-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
默认情况下将使用来自现有文件结构。