typescript 在 VSCode 中禁用 TSLint
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50823743/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Disable TSLint in VSCode
提问by Clanket
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.
所以这感觉这应该是一项如此简单的任务,但它开始让我发疯。我似乎无法关闭 TSLint 或 TS 或任何给我这些错误的东西。我只想要带有我自己配置的规则的 ESLint,没有别的。
Is it built in TS? I have disabled TSLint extension (even uninstalled it). I have set the following rules:
它是内置于 TS 中的吗?我已经禁用了 TSLint 扩展(甚至卸载了它)。我设置了以下规则:
"typescript.format.enable": false,
"typescript.validate.enable": false,
Still gives me error. How do I turn this off?
仍然给我错误。我如何关闭它?
回答by user3151902
It seems that the error is coming from the TypeScript extension, which is alsohandling the JavaScript IntelliSense. Due to some UX ignorance, VSCode prefixes the error with [ts]
instead of [js]
.
错误似乎来自TypeScript 扩展,它也在处理 JavaScript IntelliSense。由于一些 UX 无知,VSCode 将错误添加到前缀[ts]
而不是[js]
.
To disable these validations, set
要禁用这些验证,请设置
"javascript.validate.enable": false
See this issuefor more details.
有关更多详细信息,请参阅此问题。
回答by Bita Djaghouri
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.
一个月的大部分时间里,我一直在寻找这个答案。我找到了一个适用于 VS Code 的解决方案,它不是全面禁用 javascript 的所有验证,也不需要我将文件/声明添加到不是我的存储库中。
Add this line to your user settings:
将此行添加到您的用户设置中:
"javascript.suggestionActions.enabled": false
"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.
与"javascript.validate.enable": false
(您不应该使用的)不同,上面的设置将删除[ts] Could not find a declaration file for module
javascript 文件中无类型模块导入的那些烦人的错误,它仍然可以很好地与 linter 配合使用,并为您提供适当的相关错误。
回答by Piero
Ctrl-Shift-P (Command Palette) "Preferences: Open Workspace Settings" add "tslint.enable":false
Ctrl-Shift-P(命令面板)“首选项:打开工作区设置”添加“tslint.enable”:false
save and restart VSCode
保存并重启 VSCode