简体   繁体   English

WebStorm禁用js文件的TSLint

[英]WebStorm disable TSLint of js files

I'm using WebStorm 2019.1 我正在使用WebStorm 2019.1

I've generated a project using the Angular CLI. 我已经使用Angular CLI生成了一个项目。

Everything works fine but I have one or two .js files in my project - eg protractor.conf.js 一切正常,但是我的项目中有一个或两个.js文件-例如protractor.conf.js

Within the IDE, TSLint is linting the .js files and showing loads of red. 在IDE中,TSLint正在整理.js文件并显示红色负载。 But I don't want TSLint to lint the .js files. 但是我不希望TSLint整理.js文件。

I know I could disable TSLint for this file but I'd rather configure my project correctly by doing this via tsconfig.json or tslint.json or if all else fails via WebStorm settings. 我知道我可以为此文件禁用TSLint,但我宁愿通过tsconfig.jsontslint.json进行此操作来正确配置我的项目,或者如果其他所有操作均通过WebStorm设置失败了。

在此处输入图片说明

I've tried "tslint.jsEnable": false as described here - https://github.com/Microsoft/vscode-tslint/issues/261 - but I think this is for a different IDE. 我已经尝试过"tslint.jsEnable": false此处所述为"tslint.jsEnable": false - https://github.com/Microsoft/vscode-tslint/issues/261-但我认为这是针对其他IDE的。 Any ideas how to do this via tsconfig.json or tslint.json or failing that via WebStorm settings? 有什么想法如何通过tsconfig.jsontslint.json进行此tsconfig.json还是通过WebStorm设置失败?

Since 2019.1 .js files are linted if jsRules is present in tslint.json ( WEB-36890 ). 从2019.1开始,如果jsRules中存在tslint.jsonWEB-36890 ), tslint.json删除.js文件。 You can add .js files to "exclude": option in tslint.json if you don't want them to be linted: 如果不希望将.js文件添加到tslint.json "exclude":选项中,则可以:

"linterOptions": {
    "exclude": ["**/*.js"]
}

This change will be reverted in 2019.1.1 - there will be the checkbox that existed in previous versions - Process JS files , off by default 此更改将在2019.1.1中还原-先前版本中将存在该复选框- 处理JS文件 ,默认情况下处于关闭状态

正如@lena所说的那样,它将在2019.1.1中修复( WEB-38096

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM