Skip to content

refactor!: validate ts_project attributes with tsc --showConfig#950

Open
jbedard wants to merge 1 commit into
aspect-build:mainfrom
jbedard:tsconfig-validation
Open

refactor!: validate ts_project attributes with tsc --showConfig#950
jbedard wants to merge 1 commit into
aspect-build:mainfrom
jbedard:tsconfig-validation

Conversation

@jbedard

@jbedard jbedard commented Jul 10, 2026

Copy link
Copy Markdown
Member

This expands the rules_ts 3.x typescript 7 tsc --showConfig logic (#969) to also apply to typescript <7 so we have a single implementation.

Currently (typescript 7.0.2) typescript 7 is not as strict as typescript 5,6 so an extra generated {extends: "./realConfigjson", files: []} is required for 5,6 - but we're doing it 100% of the time just for simplicity. A lot of the test cases added are to ensure this generated tsconfig works when in parent/children dirs, different repos etc.

Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

Some previously unsupported/undetected tsconfig validation (config vs ts_project attribute) issues will now be caught such as invalid ts_project attributes based on the a tsconfig.json which extends from an npm package. The extended npm package may now be correctly taken into account.

Test plan

  • Covered by existing test cases
  • New test cases added

@jbedard jbedard changed the title fix: resolve tsconfig extends when doing tsconfig/ts_project-attr validation fix: resolve tsconfig extends when doing tsconfig/ts_project-attr validation via --showConfig Jul 10, 2026
@jbedard jbedard changed the title fix: resolve tsconfig extends when doing tsconfig/ts_project-attr validation via --showConfig fix: resolve tsconfig extends when doing tsconfig/ts_project-attr validation via --showConfig (via node) Jul 11, 2026
@jbedard
jbedard force-pushed the tsconfig-validation branch 3 times, most recently from 4081324 to 7df7168 Compare July 14, 2026 21:07
@jbedard
jbedard force-pushed the tsconfig-validation branch 2 times, most recently from 70d2e79 to 10d9a08 Compare July 15, 2026 20:15
thesayyn pushed a commit that referenced this pull request Jul 18, 2026
Close #962 which had an
alternative approach.
Ref #950 or
#967 which do all
validation (not only >=7.x) this way in rules_ts 4.x

### Changes are visible to end-users: yes

- Searched for relevant documentation and updated as needed: yes
- Breaking change (forces users to change their own code or config): no
- Suggested release notes appear below: yes

`ts_project` attribute vs tsconfig validation for ts v7+ is now done
using `tsc --showConfig`. This may catch additional validation errors
not previously found such as when tsconfigs extend from npm packages.

### Test plan

- Covered by existing test cases
- New test cases added
@jbedard
jbedard force-pushed the tsconfig-validation branch from 10d9a08 to 0e2fae6 Compare July 18, 2026 02:40
@jbedard jbedard changed the title fix: resolve tsconfig extends when doing tsconfig/ts_project-attr validation via --showConfig (via node) refactor!: validate ts_project attributes with tsc --showConfig Jul 18, 2026
@jbedard
jbedard force-pushed the tsconfig-validation branch 2 times, most recently from 0a5311b to f483ba5 Compare July 18, 2026 03:23
…idation

Validation now resolves the tsconfig with `tsc --showConfig` and checks the
ts_project attributes against the resolved config, writing it as the validation
output. Previously the "extends" chain was not always resolved (in particular
from npm packages), silently skipping some checks. Options that tsc materializes
as computed defaults of other options do not require attribute mirroring.
@jbedard
jbedard force-pushed the tsconfig-validation branch from f483ba5 to 257c94f Compare July 18, 2026 03:36
@jbedard
jbedard requested a review from acozzette July 18, 2026 03:38
@jbedard
jbedard marked this pull request as ready for review July 18, 2026 03:40
@jbedard
jbedard enabled auto-merge (squash) July 18, 2026 04:19
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.

1 participant