Disable TSLint in VSCode

TypescriptVisual Studio-CodeTslint

Typescript Problem Overview


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?

Typescript Solutions


Solution 1 - Typescript

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.

Solution 2 - Typescript

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.

Solution 3 - Typescript

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

Solution 4 - Typescript

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).

Solution 5 - Typescript

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

enter image description here

Solution 6 - Typescript

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.

Solution 7 - Typescript

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionClanketView Question on Stackoverflow
Solution 1 - Typescriptuser3151902View Answer on Stackoverflow
Solution 2 - TypescriptBita DjaghouriView Answer on Stackoverflow
Solution 3 - TypescriptPierreView Answer on Stackoverflow
Solution 4 - TypescriptRcoderNYView Answer on Stackoverflow
Solution 5 - TypescriptRajeshView Answer on Stackoverflow
Solution 6 - Typescriptfmi21View Answer on Stackoverflow
Solution 7 - TypescriptjehonView Answer on Stackoverflow