-
Notifications
You must be signed in to change notification settings - Fork 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
Lint: use @wordpress/stylelint-config preset #66909
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
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.
Nice, thanks for looking at this! I think we might need to tweak the rules a bit more. I think we should add these:
"rule-empty-line-before": [ "always", { "ignore": [ "after-comment", "first-nested" ] } ],
"at-rule-empty-line-before": [ "always", { "ignore": [ "after-comment", "first-nested" ] } ],
If you look at a file like apps/editing-toolkit/editing-toolkit-plugin/common/index.scss
, you'll see some weird errors until you add the above. (I don't think the above rules conflict with the WordPress style guidelines either, afaik.)
Open to other ideas too
I did notice that behavior. I thought maybe we want those empty lines. But yeah, I agree that we should try to minimize the number of lints for now. I have made the changes. Thank you. |
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.
I'm getting this error when trying to use the yarn run lint:css
command:
Error: The "syntax" option is no longer available. You should install an appropriate syntax, e.g. postcss-scss, and use the "customSyntax" option
at getPostcssResult (/Users/marin/Projects/calypso/node_modules/stylelint/lib/getPostcssResult.js:37:25)
at lintSource (/Users/marin/Projects/calypso/node_modules/stylelint/lib/lintSource.js:79:20)
at async /Users/marin/Projects/calypso/node_modules/stylelint/lib/standalone.js:228:27
at async Promise.all (index 4)
at async standalone (/Users/marin/Projects/calypso/node_modules/stylelint/lib/standalone.js:267:22)
@tyxla Thank you for catching that. It was due to a migration needed after upgrading |
Thanks for fixing that @manzoorwanijk! However, there's this warning when running
and the Unit Tests check appears to be failing because of that as well. |
@manzoorwanijk I pushed a commit fixing the peer dependency issues -- these often happen when updating WordPress dependencies and can be a bit tricky to resolve. (Especially since the WordPress dependencies are so inter-dependent, we may have to add multiple peer dependency rules to match the different dependency versions when we don't update them all at the same time.) |
Thank you for that @noahtallen |
Looking through a few more files, I think we could make some more rule changes. For example, in
I just want to make sure we don't introduce any weird patterns once people start using this and turn auto-fixing on :) |
@noahtallen the issue was the order of extended configs in Fixed that along with empty lines issue in imports. |
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.
Cool, I think this is good to merge. Thanks for working on it!
* Add/update dependencies * Extend @wordpress/stylelint-config/scss in stylelint config * yarn dedupe * Disable empty lines rules * Fix stylelint CLI usage * Fix deps * Resolve peer dependency warnings * Fix precedence of extended configs * Fix empty lines rule for imports Co-authored-by: Noah Allen <noahtallen@gmail.com>
@manzoorwanijk Why did we need to extend |
Because in v14, stylelint removed the built-in support for custom syntaxes and only supports CSS by default. Now, in order to use SCSS, we need specific config which is provided by More details here https://stylelint.io/migration-guide/to-14/ |
@manzoorwanijk could that be something done/changed in upstream package so that Calypso doesn't need to take that into account when re-using the upstream confirg? |
I think I didn't realize that CC: @noahtallen |
A good next steps to sort out all the new linting failures would be:
Thanks for everyone's work on this! Great to see this taken care finally. |
I think @noahtallen has already started working on it in #67468 🚀 |
Proposed Changes
This PR updates
.stylelintrc
to use@wordpress/stylelint-config
preset and removes certain rules that are already provided by@wordpress/stylelint-config
.Testing Instructions
It is assumed that you use VS Code for testing
settings.json
(Cmd + Shift + P
>Preferences: Open Settings (JSON)
)Cmd + Shift + P
>Developer: Reload Window
client/me/security-2fa-initial-setup/style.scss
Cmd + Shift + P
>Problems: Focus on Problems View
)Cmd + S
)Pre-merge Checklist
Related to #39568