Disable TSLint in VSCode

后端 未结 6 519
太阳男子
太阳男子 2021-01-31 06:59

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

相关标签:
6条回答
  • 2021-01-31 07:38

    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.

    0 讨论(0)
  • 2021-01-31 07:40

    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.

    0 讨论(0)
  • 2021-01-31 07:43

    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+'):

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

    0 讨论(0)
  • 2021-01-31 07:47

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

    0 讨论(0)
  • 2021-01-31 07:50

    Ctrl-Shift-P (Command Palette) "Preferences: Open Workspace Settings" add "tslint.enable":false

    save and restart VSCode

    0 讨论(0)
  • 2021-01-31 07:55

    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.

    0 讨论(0)
提交回复
热议问题