Disable TSLint in VSCode
Asked Answered
R

8

91

So this feels like this should be such an easy task but it's starting to drive me insane. I can't seem to turn off TSLint or TS or whatever it is that gives me these errors. I just want the ESLint with my own configured rules, nothing else.

I only want the ESLint error

Is it built in TS? I have disabled TSLint extension (even uninstalled it). I have set the following rules:

"typescript.format.enable": false,
"typescript.validate.enable": false,

Still gives me error. How do I turn this off?

Raper answered 12/6, 2018 at 18:38 Comment(7)
you could try doing /*tslint:disabled*/ after the line. If that doesn't work then it might be your IDE that is throwing the error/warning saying you are doing something wrong. It says you are never using CircleSpinner so are you using it in your html and bypassing the typescript? You may be able to add it to the constructor or something and it will go away.Licha
Did you restart the editor after you made changes to your settings? Setting "typescript.validate.enable": false, made my [ts] checks go away.Duel
@HenrikAndersson Actually it doesn't seem to work. It keeps coming back. I have that rule set to false already and I tried reloading and restarting. Same issue still :(Raper
@Licha It works but as far as I'm concerned it really doesn't solve anything. I don't want a fix, but rather a proper solution.Raper
It's not working. It drives me crazy.Cyanamide
Note: maybe this will change with 1.42? (https://mcmap.net/q/245863/-how-can-i-synchronise-eslint-or-setup-similar-tslint-and-prettier-with-typescript)Stein
It does not work for me either. I open a new question #73233644Baileybailie
G
102

It seems that the error is coming from the TypeScript extension, which is also handling the JavaScript IntelliSense. Due to some UX ignorance, VSCode prefixes the error with [ts] instead of [js].

To disable these validations, set

"javascript.validate.enable": false

See this issue for more details.

Greenquist answered 23/8, 2018 at 20:19 Comment(1)
This is the correct solution. The files are JS so it's "Javascript validation". But this validation is done via the underlying Typescript engine. Could be a bit confusing. IMO ESLint suffices especially for older projects where the TS engine will throw tons of errors without an obvious way to configure.Worthwhile
A
28

I've been hunting around for this answer for the better part of a month now. I found a solution that works in VS Code that isn't a wholesale disabling of all validation for javascript and also did not require that I add files/declarations to a repository that is not mine.

Add this line to your user settings:

"javascript.suggestionActions.enabled": false

Unlike "javascript.validate.enable": false (which you should not use), the above setting will remove those annoying [ts] Could not find a declaration file for module errors for untyped module imports in javascript files and it will still play nice with linters and give you appropriate and relevant errors.

Aegir answered 19/9, 2018 at 2:23 Comment(4)
Exactly! We don't want to disable errors, just "warnings" - in my case, it was pestering me incessantly that it could have inferred better types for JavaScript code?!? If I wanted types (and I do, but can't use them in this project) I would have used TypeScript... thanks for this!Anesthesia
@rawpower,@Morrel, I thinks you guys are wrong, the OP already has esLint activated and wants to remove both the TSLint errors and warnings.Dramaturge
@HugoCantacuzene This solution will actually be the only one that doesn't effect eslint! The other solutions will disable linters. This one will prevent TS lint from trying to validate JS. :)Aegir
I don't know why but this not works for me . "javascript.validate.enable": false works but as you mentioned I don't want disabled all nalidations.Labyrinthine
M
16

Ctrl-Shift-P (Command Palette)

Type Preferences: Open Workspace Settings JSON

add

"tslint.enable":false

Or

"typescript.validate.enable": false

But beware, as @rawpower has said "We don't want to disable errors, just 'warnings'"

Anyways, save and restart VSCode

Middling answered 27/7, 2018 at 16:0 Comment(3)
even after disabling typescript validate and tslint in VSCode I still see ts error messages: "typescript.validate.enable": false, "tslint.enable": false, "tslint.jsEnable": falseMilburt
That's very strange. Must be something else going on - maybe bad settings.json file or in wrong location?Bezel
For mine, I had [ts] 💩 showing up. So, I had to just add: "typescript.validate.enable": false,. Immediately, it went away.Bezel
F
13

Most of the answers turn off the duplicate errors for JavaScript, not TypeScript, like the OP asked about. What worked for me was:

  1. Uninstall the TSLint vscode extension
  2. Install the ESLint vscode extension
  3. Finish configuring ESLint for TypeScript (will now have both "ts errors" and "eslint errors" at this point like the OP).
  4. Open settings.json and add this to the bottom: "typescript.validate.enable": false

At first, I was concerned that this option would turn off all typescript validation, including eslint, but fortunately that wasn't the case. It only disables the built-in vscode typescript validation and leaves eslint alone.

The most important part is adding "typescript.validate.enable": false to settings.json

Or, instead of manually editing settings.json, another way is to uncheck the box in the settings menu (ctrl+'):

vscode settings view to disable typescript validation

FYI, you can add it to either your User settings.json (applies to all your projects) or your Workspace settings.json (only applies to the current project).

Fleischer answered 23/7, 2020 at 8:35 Comment(0)
A
2

Just open settings (File -> preference -> Settings) or short cut (Ctl + ,) and search for the 'Javascript Validate'.

enter image description here

Adrianaadriane answered 16/6, 2020 at 6:22 Comment(0)
B
2

As far as I understand, VSCode is checking himself the javascript, and believe the TypeScript errors are what you expect.

To stop VSCode from checking my code, and let only the eslint extension check it, I did:

  • use eslint to check my javascript (install the extension)
  • tell vscode not to check my javascript files: in jsconfig.json:
{
   "compilerOptions": {
      "checkJs": false
   }
}

I still see the "eslint" reported errors, and those errors are coherent with command line run of eslint.

PS: jsconfig reference here: https://code.visualstudio.com/docs/languages/jsconfig

Bynum answered 5/7, 2021 at 8:11 Comment(0)
V
1

For me the solution was to create a jsconfig.json file at root level. Inside you can configure the compilerOptions, which did the trick for me after restart of VSCode.

Vanden answered 15/12, 2020 at 7:36 Comment(0)
P
0

In VSCode User settings.json, I changed js/ts.implicitProjectConfig.checkJs from true to false

// settings.json
{
    "js/ts.implicitProjectConfig.checkJs": false
}
Peroxidize answered 8/12, 2022 at 23:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.