Extended diagnostics: Add extension point for own checks

This issue has been created since 2022-11-18.

Which @angular/* package(s) are relevant/related to the feature request?

compiler-cli

Description

With great pleasure I looked at the new possibilities of extended diagnostics, but unfortunately I found out that there is no possibility to extend it myself.

For the moment I can patch the execution to inject some own checks but it feels not awesome.

Proposed solution

I think a good way to add some own rules would be a similar system like the builders schema.
You define within a checks.json file all supported rules, each rule can have a schema.json file to handle all configuration parameters.

{
  "checks": {
    "custom-check": {
      "implementation": "./custom-check",
      "schema": "./custom-check/schema.json",
      "description": "checks some custom stuff."
    },
    "custom-check-without-configuration": {
      "implementation": "./custom-check-without-configuration",
      "description": "checks some custom stuff."
    }
  }
}

The angular.json file contains a list of extending check sets on root level (same level as projects) and load all rules during build, serve, etc.

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "projects": {
  },
  "extendedDiagnosticsExtensions": [
    "./local-provided-custom-checks",
    "@npm-provided/custom-checks"
  ]
}

The tsconfig.json file lists all checks also custom ones. If a custom one is not listed, it won't be enabled.

{
  "angularCompilerOptions": {
    "extendedDiagnostics": {
      // The categories to use for specific diagnostics.
      "checks": {
        // Maps check name to its category.
        "invalidBananaInBox": "suppress",
        "customCheck": "error",
        "customCheckWithoutConfiguration": "suppress",
      },

      // The category to use for any diagnostics not listed in `checks` above.
      "defaultCategory": "error"
    }
  }
}

Alternatives considered

to be considered

angular-robot[bot] wrote this answer on 2022-11-23

This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.

You can find more details about the feature request process in our documentation.

More Details About Repo
Owner Name angular
Repo Name angular
Full Name angular/angular
Language TypeScript
Created Date 2014-09-18
Updated Date 2022-12-01
Star Count 85220
Watcher Count 3042
Fork Count 22607
Issue Count 1316

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Duplizieren von Items und automatisches generieren von Aliasen 3 2017-05-09 2022-09-14
Autoscrolling for Linux 2 2021-11-08 2022-05-09
Dialog弹出框 external-classes不能进行修改样式 1 2022-01-14 2022-12-01
Números em morse estão errados 2 2021-05-29 2022-11-10
Album art from Ogg audio files often won’t display 0 2022-04-12 2022-11-13
CSSUTILS logger overrides existing config on import 1 2021-07-14 2022-07-21
Illuminate\Contracts\Filesystem\FileNotFoundException in GET /public/step1 0 2022-03-26 2022-10-30
✨ Solana-Core: Core_2- Lesson_14_Displaying_NFTs_from_Wallet 0 2022-11-09 2022-11-22
RRF: add support for sending gcode checksums 0 2021-11-16 2022-09-14
拖拽开始事件及结束事件调用弹窗,弹窗加载有问题 2 2021-04-21 2022-11-24
Support image conversion for nerdctl 1 2022-06-08 2022-11-12
doc not include video sample. 2 2022-09-16 2022-11-17
Xcode 14 update causes issues, appears when build iOS for Release. 2 2022-09-14 2022-11-17
Badge Request: Hacktoberfest 2021! 🎃 1 2021-09-30 2022-08-19
taro/types/api/network/request.d.ts 325行RequestParams缺少泛型参数 0 2022-07-10 2022-11-08
can't set "content-type" for JSON files (and others) 4 2021-09-28 2022-11-02
lint-staged failed due to a git error 9 2020-11-19 2022-11-29
Strengthen the function of pre-test to kuberhealthy endpoint for checker 2 2022-01-10 2022-11-06
problem with finding new Index in react-sortable-hoc-rtl 0 2022-01-19 2022-11-22
There was an error in magic function detect_rdata_single 5 2021-06-11 2022-09-21
CSS rgb and rgba functions can't accept custom property 4 2021-06-08 2022-11-15
use base64 encoded instead of service account string directly in bigquery extractor 1 2022-10-19 2022-11-22
Allow `null` as default value for nullable strings 3 2021-12-02 2022-08-31
can't assume that IDA/Ghidra/r2/etc. python have floss installed 1 2021-07-22 2022-11-05
Contribute a solution to Bootcamp! 0 2021-09-14 2022-10-13
OBW: WooCommerce Payments not suggested as a business feature for a store with a US address 3 2022-01-27 2022-08-25
Maybe tweak %WrapForValidAsyncIteratorPrototype%.return along the lines of #197 1 2022-07-09 2022-11-17
What to do with the older CG? 6 2021-06-02 2022-10-25
rustfmt-formattable syntax? 2 2020-07-09 2022-11-08
Upstream files overridden are updated 0 2021-12-02 2022-11-28
build error on Quarkus PR 0 2021-09-07 2022-11-25
build for android failed 3 2021-11-25 2022-10-08
Structure refactor 11 2020-03-07 2022-01-14
Record count queries are extremely slow (>5 MINUTES) 4 2021-10-07 2022-11-13
Name of School needs better formatting 3 2021-05-31 2022-08-07
Update Cake.Hosts to target Cake v1.0.0 0 2021-05-18 2022-08-08
[strict-mode] unknown config directive: max-worker-lifetime-delta 0 2022-01-14 2022-11-29
Can't create service on Red Hat Developer Sandbox 1 2022-02-08 2022-09-03
bug: React IonSelect "multiple" gets into infinite render loop 2 2022-02-02 2022-11-12
[Bug] Active sidebar function suggestion 4 2020-08-23 2022-11-28
Governance New Horizon 1 2021-11-12 2022-10-05
stan-bench is not present in the Docker image 4 2021-01-19 2022-11-28
Timezone - GMT+10 Sydney (currently shows as GMT+11) 2 2022-05-17 2022-11-25
[ogre-next] update to 2.3.1 0 2022-07-19 2022-07-16
Unable to create ECDSA-based (curve) CA using example from docs 2 2022-06-01 2022-11-19
[SUPPORT] Ensure `hoodie.datasource.write.keygenerator.type` internally sets `hoodie.datasource.write.keygenerator.class` and respects the table config validation across all code flows 0 2022-11-24 2022-11-30
select doesn't auto topLeft and safari menu hover bug 9 2017-12-07 2022-10-28
[Bug]: Static Routes not ordered by priority as of 10.2.0 1 2021-11-17 2022-11-04
[Synthetics] Step name column in list does not display well on mobile 4 2021-12-22 2022-11-28
[Bug Report][3.0.0] VTextField should not swallow enter keystroke 2 2022-11-01 2022-11-15