-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic tsconfig.json validation #47595
Conversation
Size Change: 0 B Total Size: 1.31 MB ℹ️ View Unchanged
|
Flaky tests detected in 8410fb0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4081307057
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good improvement to me!
Although I'd prefer if someone else, more experienced with the repo's overall structure and scripts strategy, also took a look before merging.
Thanks @ciampo!
Realised that this is really easy to configure via the |
Just a thought: I wonder if this is achievable with eslint? 😅 |
Please elaborate! I thought it only checked JavaScript? |
Let's cc. @gziolo who is my go-to for such things 😀 but to be honest I'm pretty confident in this so will just merge. If something breaks can fix or revert. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you @noisysocks
* Add validate-tsconfig script * Fix lint errors * Add tsconfig linting to lint-staged
Cherry-picked this PR to the wp/6.2 branch. |
What?
Adds a very basic script to validate that each package's
tsconfig.json
contains references for any@wordpress/
dependency that has typings.For example if
deprecated
appears inblock-editor
'spackage.json
, and bothblock-editor
anddeprecated
have atsconfig.json
, thendeprecated
must appear inblock-editor
'stsconfig.json
.Why?
I was working on #47229 and it took me a billion years to figure out that a "Missing type declaration" error was to do with a missing reference in a completely unrelated package.
How?
Adds a new
bin
script similar in nature to the existingvalidate-package-lock.js
script. It is ran as part ofnpm run lint
. I think this means it's ran in CI but not ongit commit
. Maybe that's something we can improve. I figure anything is better than nothing, though.I also fixed all missing references in the project.
Testing Instructions
npm run lint:tsconfig