Expose stable machine-readable Angular build diagnostics
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- angular, typescript
- Domaine
- build-system, cli, developer-experience
Piste de recherche
Commencez par le package compiler-cli et le point d’entrée ng build, puis suivez le cheminement pour déterminer où les diagnostics du compilateur Angular et des templates sont produits et formatés. Définissez et documentez une sortie stable lisible par machine contenant les champs de diagnostic demandés, et vérifiez qu’un build strict-check peut l’émettre pour des outils de baseline externes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 17 h 25 min
- PR mergées (30 j)
- 183
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-server Ouvertearea: @angular/build gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
angular/angular-cli#33055 · 1 commentaire · 3 réactions ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 personne assignée ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 personne assignée ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 1 personne assignée ·
Toutes les issues de angular/angular-cli
Issues similaires
-
[Bug]: Discord Activity titles with emoji are rejected as over 80 characters when they are not Ouverteclawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
supermomonga/zcode-acp#24 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100