简体   繁体   English

如何避免tslint特定规则?

[英]How to avoid tslint specific rule?

So I'm in a situation where I want for a specific class to be able to disable max-classes-per-file. 因此,我希望某个特定类能够禁用每个文件max-classes。

However I've tried to add the rule /* tslint:disable:max-classes-per-file: */ 但是我尝试添加规则/* tslint:disable:max-classes-per-file: */

At the beginning of the file but I still got the warning. 在文件开头,但我仍然收到警告。

Even doing "exclude": [ "src/modules/Utils/Utils.tsx" ] in my tsconfig.json is not Working. 即使执行"exclude": [ "src/modules/Utils/Utils.tsx" ]我的tsconfig.json中的"exclude": [ "src/modules/Utils/Utils.tsx" ]也无法正常工作。

Im still getting 我还在

web_1 | web_1 | /usr/app/web/src/modules/Utils/Utils.tsx /usr/app/web/src/modules/Utils/Utils.tsx

web_1 | web_1 | ERROR in /usr/app/web/src/modules/Utils/Utils.tsx(19,1): /usr/app/web/src/modules/Utils/Utils.tsx(19,1)中的错误:

web_1 | web_1 | max-classes-per-file: A maximum of 1 class per file is allowed. 每个文件max-classes:每个文件最多允许1个类。

Am I missing something ? 我想念什么吗?

The comment you're looking for is: 您要查找的评论是:

/* tslint:disable:max-classes-per-file */

Note the lack of : at the end. 请注意最后没有:

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

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