-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Testing: Add lint for Babel runtime dependency in transpiled packages #14373
Copy link
Copy link
Open
Labels
Good First IssueAn issue that's suitable for someone looking to contribute for the first timeAn issue that's suitable for someone looking to contribute for the first timeNeeds DevReady for, and needs developer effortsReady for, and needs developer efforts[Type] Automated TestingTesting infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to take
Metadata
Metadata
Assignees
Labels
Good First IssueAn issue that's suitable for someone looking to contribute for the first timeAn issue that's suitable for someone looking to contribute for the first timeNeeds DevReady for, and needs developer effortsReady for, and needs developer efforts[Type] Automated TestingTesting infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to take
Type
Fields
Give feedbackNo fields configured for issues without a type.
Each package transpiled using Babel is configured to apply the Babel runtime transform (source). Thus, the built output for any package is expected to contain references to the
@babel/runtimemodule. For this reason, the package must explicitly define@babel/runtimeas a dependency.For any package which is transpiled using Babel, we should lint to ensure it also includes an explicit dependency on
@babel/runtime.Implementation:
package.jsonincludes amainreference to abuild/relative path.src/directory (source), but themainreference is a better indication that it's actually used (related)npm-package-json-lintrequiring a specific dependency to be present, and for each exception package (the minority of cases), a package-specific.npmpackagejsonlintrc.jsonconfiguration override should disable the lint rule.@wordpress/npm-package-json-lint-configrequire-dependenciesonly requires that thedependenciesblock be present, andno-restricted-dependenciesis the inverse of what we need. We may need to consider contributing an upstream enhancement.cc @greatislander in case it's of interest to you, as you'd done similarly in the past for #13947 with an upstream enhancement at tclindner/npm-package-json-lint#106 .