Skip to content

Warn about unknown diagnostic rule names after config parsing - #756

Merged
mattiamanzati merged 2 commits into
mainfrom
t3code/warn-invalid-diagnostic-rules
Sep 17, 2026
Merged

mattiamanzati merged 2 commits into
mainfrom
t3code/warn-invalid-diagnostic-rules

Conversation

@mattiamanzati

@mattiamanzati mattiamanzati commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Unknown names in diagnosticSeverity are currently accepted silently. Report them as tsconfig warnings after compiler options have been fully parsed and merged, covering the top-level severity map and overrides.

For example, this plugin configuration now reports warning TS377134: Unknown Effect diagnostic rule 'floatingEfect' in 'diagnosticSeverity'. effect(unknownRuleName):

{
  "name": "@effect/language-service",
  "diagnosticSeverity": {
    "floatingEfect": "error"
  }
}

Configure the diagnostic through diagnosticSeverity.unknownRuleName; it defaults to warning, supports error and off, and honors inherited settings and diagnostics: false. Warnings follow the existing Effect CLI exit-code policy.

Validation reads the resolved Effect options through one post-merge callback, with matching patches for both compiler providers. Source syntax is used only for diagnostic placement: local keys are underlined, while inherited keys without local syntax and JSON-only configurations produce locationless diagnostics, following the content-mapper pattern. Expose the existing generic ForEachTsConfigPropArray through a shared forwarding shim.

Tests cover local and override keys, known diagnostic names, severity controls, chained and multiple extends, existing compiler options, JSON-only parsing, and project references sharing a cached base configuration. Includes a minor changeset.

Validation passed: pnpm setup-repo, pnpm lint (zero issues; deadcode clean), pnpm check, and the full test suite on both TypeScript 7.0.2 and next (Go and shim-generator tests; all 128 CLI tests on each provider). Also checked -p and repeated --build runs with warning, error, and disabled configurations.

The JSON config parser has matching compatibility shims for both providers: 7.0.2 accepts the extra file extensions argument, while the newer compiler omits it. The JSON-only regression test uses the compiler's ordered-map representation, which both versions support.

Supersedes the implementation in #748 with the single post-merge validation approach. Spelling suggestions are not included; inherited declarations use the locationless fallback described above.

Closes #747
Closes #748

TypeScript 7.0.2 requires an extra file extensions argument that the newer compiler removed. Match the existing source-file parser compatibility wrappers and use the compiler's ordered JSON representation in the regression test.
@mattiamanzati
mattiamanzati merged commit 9652243 into main Sep 17, 2026
8 checks passed
@mattiamanzati
mattiamanzati deleted the t3code/warn-invalid-diagnostic-rules branch September 17, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diagnosticSeverity silently accepts a rule name that does not exist

1 participant