zero-tolerance-doctrine: noImplicitAny reported missing when strict is true

オープン 初心者向け
#506 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
devtools

調査の方向性

false の検出結果は、src/checkers/sacred-laws/zero-tolerance.ts にある compilerOptions.strict と compilerOptions.noImplicitAny に対する2つの独立したチェックから生じているので、まずそこから始めてください。既存のチェックで strict がどう扱われているかを読み、次に noImplicitAny が未設定の場合と明示的に false の場合の違いを検討してください。strict: true で noImplicitAny がないフィクスチャでは検出結果が出ず、strict: true, noImplicitAny: false のフィクスチャでは引き続き検出されれば完了です。

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

説明

bug

Version: develop, and #503 (bugfix/486-foreign-json-reader)
Law: Zero Tolerance Doctrine (SACRED LAW): src/checkers/sacred-laws/zero-tolerance.ts

What happens

The law reports TypeScript noImplicitAny not enabled for a tsconfig that sets "strict": true and does not repeat "noImplicitAny": true. strict turns noImplicitAny on, so the finding is false.

develop, zero-tolerance.ts:

if (!tsConfig || !compilerOptions.strict) {
  violations.push('TypeScript strict mode not enabled');
}
if (!tsConfig || !compilerOptions.noImplicitAny) {
  violations.push('TypeScript noImplicitAny not enabled');
}

#503 reads the extends chain, but it keeps the same two independent checks (for (const [flag, finding] of [['strict', …], ['noImplicitAny', …]])).

Reproduction

A project whose tsconfig.json is { "compilerOptions": { "strict": true } } gets TypeScript noImplicitAny not enabled.

What I ruled out

This repository's own self-audit is not affected, because its tsconfig sets both flags explicitly. I have only read the code path above and have not built a fixture yet.

Suggested direction

Treat noImplicitAny as enabled when it is true, or when it is unset and strict is true. Only an explicit "noImplicitAny": false should be reported. strictModeOf in #503's src/utils/tsconfig-chain.ts already models this "strict implies" rule the other way round. Red/green: a fixture with strict: true and no noImplicitAny produces no finding, and one with strict: true, noImplicitAny: false still produces it.

主要言語
TypeScript
スター
0
フォーク
0
平均マージ
2時間 36分
マージ済み PR(30日)
168

環境構築

はじめの一歩

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

Rule-Of-Code/RoC のほかの issue

Rule-Of-Code/RoC の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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