Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/json-rule-evidence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@svelte-vitals/core': minor
'svelte-vitals': minor
'@svelte-vitals/vite': minor
---

`--reporter json` gains a top-level `rules` map of rule id to `{ findings, passed }`, listing every rule
that ran.

It answers a question the report could not: `issues` lists only failing findings, so a rule that found
nothing left no trace — indistinguishable from a rule that was never selected. A rule present in `rules`
ran; a rule missing from it was not selected. `passed` is also unavailable elsewhere, since `summary` is
project-wide.

The counts describe the report rather than the tree: baseline, suppression and `--diff` filtering are
applied first, so a rule whose findings were all suppressed shows `findings: 0` and stays present.
21 changes: 21 additions & 0 deletions docs/src/content/docs/guides/(reporting)/reporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ svelte-vitals --reporter json
}
},
"summary": { "critical": 0, "warning": 33, "info": 44, "passed": 610, "dynamic": 2 },
"rules": {
// Every rule that ran. An entry with `findings: 0` ran and reported nothing;
// a rule missing from this map was disabled at the top level — `--ignore`, `--rules`,
// `--category`, or `rules: { id: 'off' }` in config. A rule disabled through an
// `overrides` entry instead still ran and still appears here (see below).
"architecture/unit-entry-file": { "findings": 0, "passed": 12 }
},
"routes": [
{
"route": "/about", // a route id, or a source file path for file-scoped rules
Expand Down Expand Up @@ -74,6 +81,20 @@ Two field names are worth pointing out, because guessing them wrongly fails sile

`line`, `docsUrl` and `fix` are present only when the rule supplies them, and `location` only for a finding tied to a file. `issues` lists **failing** findings only — passing checks are counted in `summary.passed` but are not listed. A route with no failures still appears in `routes`, with an empty `issues` array and its own score.

`rules` answers a question the rest of the report cannot: **whether a rule ran at all.** `issues` lists
only failing findings, so a rule that found nothing leaves no trace there — and a rule disabled at the top
level (`--ignore`, `--rules`, `--category`, or `rules: { id: 'off' }` in config) leaves the same absence.
Look it up in `rules` instead: present means it ran, missing means it was excluded at the top level — with
one exception, below.

The counts describe the report, not the tree. Baseline, suppression and `--diff` filtering are applied
before the report is built, so a rule whose findings were all suppressed shows `findings: 0` while remaining
present. The same is true of a rule disabled through an `overrides` entry rather than at the top level:
`overrides` drops its results (passing ones included) after the rule has already run, so it shows
`{ "findings": 0, "passed": 0 }` — indistinguishable from a selected rule that simply found nothing.
Presence in `rules` proves a rule wasn't excluded by `--ignore`, `--rules`, `--category`, or config's
top-level `rules`; it does not prove `overrides` left anything for it to find.

### `agent`

A Markdown remediation document designed for AI coding agents. Each failing finding includes:
Expand Down
11 changes: 11 additions & 0 deletions docs/src/content/docs/ja/guides/(reporting)/reporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ svelte-vitals --reporter json
}
},
"summary": { "critical": 0, "warning": 33, "info": 44, "passed": 610, "dynamic": 2 },
"rules": {
// 実行されたすべてのルール。`findings: 0` のエントリは実行された上で何も検出しなかったことを示す。
// このマップに現れないルールはトップレベルで無効化されている(`--ignore`、`--rules`、`--category`、
// または設定ファイルの `rules: { id: 'off' }`)。`overrides` で無効化したルールは実行はされるため、
// 引き続きここに現れる(詳しくは後述)。
"architecture/unit-entry-file": { "findings": 0, "passed": 12 }
},
"routes": [
{
"route": "/about", // ルート ID。ファイル単位のルールではソースファイルのパス
Expand Down Expand Up @@ -74,6 +81,10 @@ svelte-vitals --reporter json

`line`・`docsUrl`・`fix` はルールが提供した場合のみ、`location` はファイルに紐づく検出の場合のみ現れます。`issues` に並ぶのは**失敗した検出のみ**です。合格したチェックは `summary.passed` に数として計上されますが、一覧には出ません。失敗が1件も無いルートも `routes` には現れ、`issues` が空配列のまま自分のスコアを持ちます。

`rules` は、レポートの他の部分では答えられない問い、**そのルールがそもそも実行されたかどうか**に答えます。`issues` に載るのは失敗した検出結果だけなので、何も検出しなかったルールはそこに痕跡を残しません。トップレベルで無効化した(`--ignore`、`--rules`、`--category`、または設定ファイルの `rules: { id: 'off' }`)ルールも同じく現れません。判定には `rules` を見ます。存在すれば実行された、存在しなければトップレベルで除外された、という意味です。ただし一つだけ例外があり、それは次に述べます。

件数が表すのはツリーではなくレポートそのものです。baseline、抑制、`--diff` によるフィルタリングはレポートを組み立てる前に適用されるため、検出結果がすべて抑制されたルールも `findings: 0` のまま `rules` に残ります。`overrides` で無効化したルールも同様です。トップレベルとは異なり、`overrides` はルールが実行された後にその結果(合格分も含む)を取り除くため、`{ "findings": 0, "passed": 0 }` として現れ、選択されて何も検出しなかったルールと見分けがつきません。`rules` に存在することが保証するのは、`--ignore`・`--rules`・`--category`・設定ファイルのトップレベルの `rules` で除外されなかったことだけで、`overrides` が検出結果を何も残さなかったことまでは保証しません。

### `agent`

AI コーディングエージェント向けに設計された Markdown 修正ドキュメントです。失敗した各検出結果には以下が含まれます:
Expand Down
Loading