How to run tslint using Angular Cli?
Asked Answered
R

2

6

I am facing issue when I am trying to run tslint from Angular Cli.

> 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

[Error while running]

enter image description here

Rub answered 6/10, 2017 at 8:54 Comment(3)
You are missing codelyzer in your node_modules. Did you install the dependencies (with npm install)?Tablet
Yes i did. But still its is giving same errorRub
Try to check the versions of nodeJS, angular / angular-cli and VSC. If anything try to uninstall and re-install with all the latest versions.Apical
B
0

Run npm install or npm install codelyzer first.

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:

"rulesDirectory": [
        "../node_modules/codelyzer"
    ]
Baguette answered 16/11, 2017 at 3:14 Comment(1)
I'm not sure about this. Angular is supposed to install codelyzer: the "ng new" command is supposed to do all the installsApical
T
0

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:

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

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

Technology answered 13/2, 2018 at 16:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.