Cannot disable template rules
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- angular, typescript
- 领域
- tooling
调研方向
首先,使用所示的 tsconfig.json 设置以及组件中的 template-cyclomatic-complexity 注释,通过 ng lint 重现该报告。跟踪 Angular 模板规则如何接收禁用指令,并验证预期结果:禁用该规则后,该规则的所有诊断信息都会消失。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
Can't disable the template-cyclomatic-complexity rule.
Context and configuration
I'm using tslint in an Angular project.
tsconfig.json setting: "template-cyclomatic-complexity": [true, 10],
Following this readme (https://github.com/mgechev/codelyzer/blob/master/README.md#disable-a-rule-that-validates-template-or-styles) in order to disable a rule, I have to write the tslint:disable:rule in the ts file that references the template.
When I execute the ng lint command without the tslint:disable:rule comment, I can see this output:
ERROR: /project/src/app/module/components/temp/temp.component.html:7:2 - The cyclomatic complexity exceeded the defined limit (cost '10'). Your template should be refactored.
ERROR: /project/src/app/module/components/temp/temp.component.html:48:6 - The cyclomatic complexity exceeded the defined limit (cost '10'). Your template should be refactored.
ERROR: /project/src/app/module/components/temp/temp.component.html:59:16 - The cyclomatic complexity exceeded the defined limit (cost '10'). Your template should be refactored.
If I add the tslint:disable:rule comment, this is the output:
ERROR: /project/src/app/module/components/temp/temp.component.html:7:2 - The cyclomatic complexity exceeded the defined limit (cost '10'). Your template should be refactored.
Seems that the rule is not entirely disabled.
To Reproduce
ng lint on the root of the project.
Expected behavior
The rule should be disabled entirely.
Code
/* tslint:disable:template-cyclomatic-complexity */
@Component({
selector: 'temp',
templateUrl: './temp.component.html',
styleUrls: ['./temp.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
Environment
- OS: MacOS
- Node.js version: 8.11.3
- npm version: 6.9.0
- Angular version:
"@angular/core": "^7.2.0" - tslint version:
"tslint": "^5.15.0""tslint-angular": "^1.1.2"
Additional context
N/A
- 主要语言
- TypeScript
- 星标
- 2.5k
- 派生
- 232
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mgechev/codelyzer 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 2/5 1-3 小时 新手友好度 32/100
-
Angular 14未关闭
难度 2/5 1-3 小时 新手友好度 35/100
-
Support for Angular 10可能已有人在做 @ccarmesin 于 1842 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 25/100
查看 mgechev/codelyzer 的全部 Issue
相似的 Issue
-
clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster maturity:stable P3
难度 2/5 1-3 小时 新手友好度 72/100
openclaw/openclaw#200937 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
accepted bug needs-info triaged
难度 2/5 1-3 小时 新手友好度 76/100
zts212653/clowder-ai#2025 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
letehaha/moneymatter#906 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
blinkospace/blinko#1287 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
Feyisara2108/stellargive#1379 ·
维护者通常 1 天内回复