Repository navigation
Conversation
…se-styles is declared Add a local jetpack/no-redundant-base-styles-wrapper rule that reports @use, @forward and @import of @automattic/jetpack-base-styles/gutenberg-base-styles in files whose nearest package.json declares @wordpress/base-styles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K4t4VY7ojGc1sr9Cb1z84Z
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Nested package.json files (wp-build routes, packages/init) list no dependencies, so stopping at the nearest one skipped every stylesheet under them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K4t4VY7ojGc1sr9Cb1z84Z
anomiex
left a comment
There was a problem hiding this comment.
Would it be easier to get rid of the final few uses of the wrapper entirely and then delete it, instead of adding a linting rule?
The linear issue says to not touch the wrapper on the projects that get the mixins without taking on the dependency. And in any case, I think that it can be good to have the rule against future regressions. Wdyt? |
|
The Linear issue does say that, but it doesn't say why. Maybe it just didn't consider taking it far enough? Or maybe it didn't realize how few uses would be left? If we get rid of the wrapper entirely, that would also prevent regressions because the code would fail on trying to load the missing wrapper. 😀 |
|
At second glance, more specifically it says (emphasis added)
Let's decide "yes" because there are only three projects left, may as well make a complete job of it. I further note that in two of those projects the only uses of |
|
Agreed, done that way instead:
Closing this one. |
Part of JETPACK-2754
The sweep (#54281–#54289) replaced
@automattic/jetpack-base-styles/gutenberg-base-styleswith direct@wordpress/base-styles/<module>imports in every project that declares@wordpress/base-styles. This rule keeps the wrapper from coming back there.Proposed changes
jetpack/no-redundant-base-styles-wrapper, enabled in the shared base config. It reports@use,@forwardand@importof the wrapper when anypackage.jsonbetween the file and its project root (the directory withcomposer.json) declares@wordpress/base-styles. Nested ones such as wp-buildroutes/*list no dependencies, so it checks all of them.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
tools/js-tools/node_modules/.bin/stylelint 'projects/**/*.{scss,css}'reports nothing for the new rule on trunk's current styles.@use "@automattic/jetpack-base-styles/gutenberg-base-styles" as gb;to an SCSS file inprojects/packages/my-jetpack, both under_inc/and underroutes/dashboard/, and run stylelint on it: the rule reports both.projects/js-packages/components: no report.🤖 Generated with Claude Code