Cannot disable template rules

オープン
#821 コメント 8 件 リアクション 12 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
angular, typescript
領域
tooling

調査の方向性

まず、示されている tsconfig.json の設定と、コンポーネント内の template-cyclomatic-complexity コメントを使って、ng lint で報告を再現します。Angular テンプレートルールが無効化ディレクティブをどのように受け取るかを追跡し、期待される結果を確認します。そのルールを無効にすると、そのルールのすべての診断が消えることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

bug

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 はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mgechev/codelyzer のほかの issue

mgechev/codelyzer の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。