Expose stable machine-readable Angular build diagnostics
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 冷清
- 技術堆疊
- angular, typescript
研究方向
從 compiler-cli 套件和 ng build 進入點開始,接著追蹤 Angular compiler 和 template diagnostics 的產生與格式化位置。定義並記錄一種穩定的機器可讀輸出,其中包含所要求的診斷欄位,並驗證 strict-check build 能夠為外部基線工具輸出該內容。
由索引模型根據 Issue 內容生成。
描述
Which @angular/* package(s) are relevant/related to the feature request?
compiler-cli
Description
Large Angular codebases often want to enable stricter compiler checks, especially strictTemplates and extended diagnostics, but cannot fix all existing diagnostics in one migration.
Angular already supports category-based strictness ratcheting through template type-checking flags. That helps when a whole category of checks is too noisy.
It does not solve the case where a team wants a check enabled, but wants to treat existing diagnostics as migration debt while preventing new diagnostics from being introduced.
Teams can build this externally by parsing ng build output, but text output is not a stable API. Angular diagnostics can include template source spans and compiler-specific formatting, which makes external parsing fragile.
This is not a request for strictTemplates warning mode. A previous discussion in https://github.com/angular/angular/issues/55868 explained why warning mode is not a good fit for strictTemplates, especially because template type-checking often produces TypeScript diagnostics from generated template-checking code.
This request is only about exposing stable diagnostic output so external tooling can implement baseline/ratchet workflows reliably.
Proposed solution
Expose stable machine-readable diagnostics from Angular CLI builds.
For example:
ng build my-app --configuration strict-check --diagnostics-format json
or:
ng build my-app --configuration strict-check --diagnostics-output angular-diagnostics.json
The exact CLI/API shape is not important. The important part is that ng build can emit stable, machine-readable diagnostics.
Example shape:
{
"diagnostics": [
{
"code": "NG8002",
"category": "error",
"source": "angular-template",
"message": "Can't bind to ...",
"file": "libs/example/src/example.component.html",
"startLine": 12,
"startColumn": 7,
"endLine": 12,
"endColumn": 28,
"relatedInformation": []
}
]
}
The schema should include enough stable information for tools to compare diagnostics across runs, such as diagnostic code, category/severity, source, file, source span, message, and related information when available.
This would enable external workflows like:
ng build my-app --configuration strict-check --diagnostics-output angular-diagnostics.json
angular-baseline check angular-diagnostics.json
That allows teams to create a migration ratchet:
- Existing diagnostics are treated as migration debt.
- New diagnostics fail CI.
- Fixed diagnostics can be removed from the baseline.
- The codebase becomes stricter over time.
This is similar in spirit to tsc-baseline or ESLint bulk suppressions, but for Angular compiler and template diagnostics.
Alternatives considered
Use existing template strictness flags
Angular's existing strictness flags are useful for category-based rollout.
However, disabling a category allows both existing and new violations in that category.
A diagnostic baseline lets a team keep the check enabled while allowing only known existing diagnostics.
Parse ng build text output
Teams can parse ng build output today, but this is fragile because CLI text output is optimized for humans, not long-term machine consumption.
Add first-class Angular diagnostic baselines
Angular could provide a full diagnostic baseline feature directly, for example:
ng build my-app --configuration strict-check --update-diagnostic-baseline
ng build my-app --configuration strict-check --diagnostic-baseline angular-diagnostics.baseline.json
That would be useful, but stable machine-readable diagnostics would already allow the ecosystem to build this externally.
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 16 小時 35 分鐘
- 30 天內合併 PR
- 176
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
angular/angular-cli 的其他 Issue
-
area: @angular/build gemini-triaged
難度 2/5 1-3 小時 新手友好度 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
難度 2/5 1-3 小時 新手友好度 72/100
angular/angular-cli#33055 · 1 則留言 · 3 個 reaction ·
-
area: @angular/build gemini-triaged
難度 4/5 3-5 天 新手友好度 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 已指派 1 人 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 已指派 1 人 ·
查看 angular/angular-cli 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 74/100
ontola/atomic-server#1625 ·
-
bug
難度 2/5 1-3 小時 新手友好度 70/100
melgarafael/DeskcommCRM#1451 ·
-
難度 1/5 1 小時以內 新手友好度 82/100
-
bug via-triage
難度 2/5 1-3 小時 新手友好度 78/100
-
bot:ai-assisted component:compact-js status:untriaged
難度 2/5 1-3 小時 新手友好度 84/100
midnightntwrk/midnight-sdk#403 ·