tslint.json is not working in VS Code
Asked Answered
V

1

6

So, I have my tsconfig.json and tslint.json at the root of my project. When I run tslint, it displays all of the errors in Terminal. But I do not get any hints/lines in VS Code. I'm driving myself crazy trying to figure out why it won't work. I deliberately went against a rule but nothing happens. I've tried force-quitting several times. I've tried other rules and going against them. (Note, I am not talking about the VSCode extension for TSLint.) I wrote a pretty basic one:

{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended"
    ],
    "jsRules": {},
    "rules": {
        "quotemark": [
            true,
            "single",
            "avoid-escape"
        ],
        "semicolon": [
            true,
            "always"
        ]
    },
    "rulesDirectory": []
}
Vauban answered 29/8, 2017 at 23:24 Comment(6)
I have this under my scripts in my package.json - "lint": "tslint ./src/**/*.ts --exclude \"./**/node_modules/**/*.ts\""Vauban
Do you have TypeScript and TSLint installed globally in npm? You need to have both installed globally for tslint to work. npm install typescript tslint -gGraeae
Yep. I even tried with yarn too. Made no differenceVauban
This is not clear for me: You have installed the tslint extension right? Can you set up a basic example repo, so we can check it out? :-/Perceivable
I filed an issue on Github. Yeah, I didn't mean that I don't have the extension. I meant that I wasn't going against the extension's default rules; I was going against my rules, which I showed above in the code block. I actually got it working, but I am not sure what part did it. Here's the issue: github.com/Microsoft/vscode-tslint/issues/248Vauban
Is the "tslint.configFile" property set in your .vscode/settings.json?Audreaaudres
G
1

If you have not installed tslint extension and do not run tslint via task manually - VSCode will not "check" its rules.

VSCode has no "embedded" support of the tslint. You must install the aforementioned extension in order to get intellisense support you are looking after.

Gratt answered 30/8, 2017 at 9:29 Comment(1)
I should have clarified... I meant that I am not going against the default rules of TSLint (the extension).Vauban

© 2022 - 2024 — McMap. All rights reserved.