Lint: Prevent private API imports in all bundled packages - #82015
Conversation
|
Size Change: 0 B Total Size: 7.91 MB |
|
Flaky tests detected in d894939. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/32950427518 remembers sidebar dismissal between sessions in
|
aduth
left a comment
There was a problem hiding this comment.
Thanks for following-up on this 👍
There was a problem hiding this comment.
We existing issues here are concerning 🙈 We might want to track them somehow, or at least the ones that are likely to cause issues.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
a206cb5 to
ae4ad74
Compare
ciampo
left a comment
There was a problem hiding this comment.
LGTM, apart from a minor comment 🚀
Good to merge once feedback is addressed. Thank you!
What?
Follow up of: #81478 (comment)
This PR extends the restriction from #81478 to every bundled package (packages with neither
wpScriptnorwpScriptModuleExports), so private API usage can't creep into any package that plugins may bundle via npm. Besides the direct@wordpress/private-apisimports, the rule also restricts the relativelock-unlockimports, so new usages inside packages that already use private APIs are blocked too.The existing usages (43 across 8 packages) are suppressed in
tools/eslint/suppressions.json, so they can only go down.uiande2e-test-utils-playwrightare excluded from the shared override because they have their ownno-restricted-importsoverrides,uigets the same restriction throughUI_RESTRICTED_IMPORTS.Testing Instructions
import { unlock } from './lock-unlock';to a file inpackages/fields/srcthat doesn't already import it and runnpm run lint:js -- <the file>. It should error.packages/ui/srcwithimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';. It should error.npm run lint:jsshould be 🟢.Use of AI Tools
Generated with Fable 5 and adjusted/reviewed manually.