简体   繁体   English

如何使用 Angular Cli 运行 tslint?

[英]How to run tslint using Angular Cli?

I am facing issue when I am trying to run tslint from Angular Cli.当我尝试从 Angular Cli 运行 tslint 时遇到问题。

> ng lint > 绒毛

Error错误

Failed to load E:\\Projects\\lsp-ui\\node_modules\\ng2-slimscroll\\tslint.json: Could not find custom rule directory: E:\\Projects\\lsp-ui\\node_modules\\ng2-slimscroll\\node_modules\\codelyzer无法加载 E:\\Projects\\lsp-ui\\node_modules\\ng2-slimscroll\\tslint.json:找不到自定义规则目录:E:\\Projects\\lsp-ui\\node_modules\\ng2-slimscroll\\node_modules\\codelyzer

[Error while running] [运行时出错]

在此处输入图片说明

Run npm install or npm install codelyzer first.首先运行npm installnpm install codelyzer

Also check the file path of tsconfig.json in the Angular Cli configuration lint section, the configuration of rules directory in tslint.json, such as:还要查看Angular Cli配置lint部分中tsconfig.json的文件路径, tsconfig.json中rules目录的配置,如:

"rulesDirectory": [
        "../node_modules/codelyzer"
    ]

Here is official guide for you.这是给你的官方指南。

Codelyzer should work out of the box with Atom but for VSCode you will have to open Code > Preferences > User Settings, and enter the following config: Codelyzer 应该与 Atom 一起开箱即用,但对于 VSCode,您必须打开代码 > 首选项 > 用户设置,然后输入以下配置:

{ "tslint.rulesDirectory": "./node_modules/codelyzer", { "tslint.rulesDirectory": "./node_modules/codelyzer",
"typescript.tsdk": "node_modules/typescript/lib" } "typescript.tsdk": "node_modules/typescript/lib" }

https://github.com/mgechev/codelyzer#editor-configuration https://github.com/mgechev/codelyzer#editor-configuration

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

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