Rules Hub
Code Ruleset
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP2universalStack: Tooling / JSON config
toolingconfigdxjson-schema
Add a $schema reference to config JSON files
Point config JSON (tsconfig, lint config, etc.) at its JSON schema so editors give autocomplete and validation even for newly added options.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codejson
| 1 | { |
| 2 | "compilerOptions": { "lib": ["dom", "es2025"] } |
| 3 | } |
Explanation (EN)
Without a matching schema, misspelled options and invalid values can escape editor validation.
Objašnjenje (HR)
Good example
New codejsonc
| 1 | { |
| 2 | "$schema": "https://json.schemastore.org/tsconfig", |
| 3 | "compilerOptions": { "lib": ["dom", "es2025"] } |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
For an editable JSON configuration, add a compatible schema reference only when the consumer accepts that metadata and the schema matches the tool version.
Exceptions / Tradeoffs (EN)
Strict consumers may reject $schema; an editor can supply schema association externally instead.