chore: share the type-checking strictness through a base tsconfig - #556
Merged
Merged
Conversation
`strict` was repeated in all four TypeScript configurations, and two further strictness flags existed in `addons` only. Nothing kept them aligned, so a package could silently relax its checking, which is how the packages drift apart. Add `tsconfig.base.json` at the root and extend it everywhere, including from `tsconfig.eslint.json`. It carries only what must not differ: `strict`, `forceConsistentCasingInFileNames` and `noImplicitOverride`. Everything else stays local, and the file says why rather than leaving the next reader to wonder. `target`, `module`, `lib` and `moduleResolution` differ because the packages have different jobs: a published library, a bundled demo, and a compatibility check that mimics a minimal consumer. `skipLibCheck` is false where third-party types must be validated and true where they are known to be noisy. Emit options belong to whichever package emits. The two hoisted flags are new for `demo`, `check-ts-support` and the ESLint configuration, so this is not only deduplication. Nothing had to be fixed to satisfy them: the addons build, the addons test type-check, the 107 tests, the demo build, `check-ts-support` on TypeScript 4.5.2 and the repository lint all pass unchanged. Verified that the inheritance is effective rather than silently ignored: `tsc --showConfig` in `check-ts-support` reports the three inherited flags while its local `skipLibCheck: false` and `target` survive, and a class overriding a method without the `override` modifier now fails there with TS4114, which it would not have before.
|
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
strictwas repeated in all four TypeScript configurations, and two further strictness flags,forceConsistentCasingInFileNamesandnoImplicitOverride, existed inpackages/addonsonly. Nothing kept them aligned, so a package could quietly relax its type checking and no one would notice.Fix
Add
tsconfig.base.jsonat the repository root and extend it frompackages/addons,packages/demo,packages/check-ts-supportandtsconfig.eslint.json.It carries only what must not differ between packages:
{ "compilerOptions": { "strict": true, "forceConsistentCasingInFileNames": true, "noImplicitOverride": true } }Everything else deliberately stays local, and the file records why, so the next person does not have to guess whether an option was forgotten or excluded:
target,module,libandmoduleResolutiondiffer because the packages have different jobs: a published library, a bundled demo, and a compatibility check that mimics a minimal consumer.skipLibCheckisfalsewhere third-party types must be validated (addons,check-ts-support) andtruewhere they are known to be noisy (demo, and the addons test config).declaration,outDir,stripInternal,noEmit) belong to whichever package emits.Not only deduplication
forceConsistentCasingInFileNamesandnoImplicitOverrideare new fordemo,check-ts-supportand the ESLint configuration. Nothing had to be changed to satisfy them.Verification
Everything passes unchanged: addons build, addons
test-check, 107 tests, demo build,check-ts-supporton TypeScript 4.5.2, and the repository-wide lint.Two checks that the inheritance actually takes effect rather than being silently ignored, both run in
check-ts-support, the package with the oldest compiler and therefore the most likely to misbehave:tsc --showConfigreportsstrict,forceConsistentCasingInFileNamesandnoImplicitOverrideas inherited, while its localskipLibCheck: falseandtargetsurvive.overridemodifier now fails there withTS4114, which it would not have before this change. The probe file was removed afterwards.Part of the follow-up list of #552, where it is the last remaining tooling item.