Problem/Motivation

We are currently on Stylelint 13 but Stylelint 14 is now released.

Steps to reproduce

Proposed resolution

Upgrade.
Decide which new rules we should fix and which we should ignore.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Stylelint has been updated to version 14, and minor changes have been made to whitespace and quoting in core CSS. Refer to the change record on the Stylelint 14 update for more information.

Issue fork drupal-3246211

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs work

NW to deal with the many new rules.

longwave’s picture

Status: Needs work » Needs review

I either disabled or reconfigured the failing rules so stylelint should now pass, but it's probably worth discussing if we want to fix some of these instead of disabling them.

longwave’s picture

Fixed two hopefully uncontroversial rules.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

alexpott’s picture

Decide which new rules we should fix and which we should ignore.

I think we can do that in follow-ups.

longwave’s picture

StatusFileSize
new74.64 KB
new74.69 KB

Rerolled for 9.4.x and 10.0.x and bumped to latest versions of stylelint and related packages.

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

These look great. Thanks @longwave

lauriii’s picture

Status: Reviewed & tested by the community » Needs review

Are the commit-code-check.sh changes working? I tried checking the DrupalCI output and it looks like only files that were changed by the patch were actually tested.

longwave’s picture

Yes:

14:48:41 stylelint: passed
14:48:41 
14:48:41 ----------------------------------------------------------------------------------------------------
14:48:41 Checking core/.stylelintrc.json
14:48:41 
14:48:41 core/.stylelintrc.json passed
14:48:41 
14:48:41 ----------------------------------------------------------------------------------------------------
14:48:41 Checking core/misc/dropbutton/dropbutton.css
14:48:41 
14:48:41 STYLELINT: core/misc/dropbutton/dropbutton.css passed
14:48:41 core/misc/dropbutton/dropbutton.css passed
14:48:41 
14:48:41 ----------------------------------------------------------------------------------------------------
14:48:41 Checking core/misc/print.css
14:48:41 
14:48:42 STYLELINT: core/misc/print.css passed
14:48:42 core/misc/print.css passed

The first "stylelint: passed" is a full run, this is newly added by these patches.

The individual lines later on are a run against each changed file in turn. I guess we should drop the individual runs if we are doing a full run anyway?

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

Let's open a follow-up to discuss how to stop individual checks when a general scan all the things has occurred. We have this for JS and PHPCS too so a generic solution might be better.

lauriii’s picture

Issue tags: +Needs follow-up

Ahh makes sense. Could someone file follow-up for #12?

alexpott’s picture

  • lauriii committed f1a00d1 on 10.0.x
    Issue #3246211 by longwave, alexpott: Update to Stylelint 14
    

  • lauriii committed a4bec1b on 9.4.x
    Issue #3246211 by longwave, alexpott: Update to Stylelint 14
    
lauriii’s picture

Version: 9.4.x-dev » 9.3.x-dev

Committed f1a00d1 and pushed to 10.0.x. Also committed the 9.x patch to 9.4.x. Thanks!

I think we should backport this to 9.3.x too to make backporting patches easier. Any thoughts on that?

longwave’s picture

9.4.x patch applies straight to 9.3.x, so I guess we might as well as it's only a core development dependency. But also it's not that important because as far as I can see any patch that passes Stylelint 14 should also pass in the earlier version.

  • lauriii committed 6bff40e on 9.3.x
    Issue #3246211 by longwave, alexpott: Update to Stylelint 14
    
    (cherry...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Discussed with @longwave and @catch and we didn't see that there would be problem cherry-picking to 9.3.x since Stylelint is a dev dependency. There are couple of CSS changes so I think it's better to have the active branches as consistent as possible so that backports remain straight forward.

xjm’s picture

Title: Update to Stylelint 14 » [Regression?] Update to Stylelint 14
Status: Fixed » Needs review
StatusFileSize
new74.81 KB

HEAD has been failing on 9.3.x and 9.4.x with PHP 7.3 since Jan. 26. This is the only issue that was committed to 9.3.x between Dec. 29 and yesterday, so it seems like the only possible cause unless there was an upstream change on CI that is causing the fail.
Edit: That was a git log weirdness, from a commit being cherry-picked much later.

https://www.drupal.org/pift-ci-job/2305316

So, here's a revert to test whether HEAD will pass.

Additionally, this issue should not have been backported to 9.3.x under our allowed changes policy, because even dev dependency updates disrupt build pipelines. Especially since it's a major version update. Normally we would only do such an update in the production branch if there were a security issue. So regardless of whether this is the cause of the HEAD fail, it should probably be reverted from 9.3.x and not re-committed there.

xjm’s picture

The CI output for #21 does not make any sense -- it says that custom commands failed, but then all the checks individually are listed as passing. Running sh ./core/scripts/dev/commit-code-check.sh locally also passes.

xjm’s picture

StatusFileSize
new80.25 KB

Only other thing I can think of is to revert both commits that have been made on 9.3.x in January, in case there's some Stylelint 14-compatible changes in the more recent CKE5 commit that are somehow not being reported correctly on CI.

If this also fails with weirdness then I might just revert both commits and see what happens. Since HEAD is failing anyways it can't get worse. We can always recommit them.

  • xjm committed aa59cad on 9.3.x
    Revert "Issue #3246211 by longwave, alexpott: Update to Stylelint 14"...

  • xjm committed c791d7d on 9.3.x authored by lauriii
    Issue #3246211 by longwave, alexpott: Update to Stylelint 14
    
    (cherry...
xjm’s picture

Title: [Regression?] Update to Stylelint 14 » [Revert from 9.3.x needed] Update to Stylelint 14

OK, the "Custom commands failed" also failed in HEAD with this reverted (even with the issue after it reverted too), so I recommitted both of them. Reading over the console output, this is the only actual error message:

23:16:47 Error: No files matching the pattern "/var/www/html/core/themes/claro/css/classy/components/indented.css" were found.
23:16:47     at /var/www/html/core/node_modules/stylelint/lib/standalone.js:212:12
23:16:47     at processTicksAndRejections (internal/process/task_queues.js:97:5)
23:16:47 

I don't know why that is happening with #21 and #23 both when they are the two most recent commits on the branch and it didn't happen until I reverted them, but we need to figure out how to fix it so that this can be reverted from 9.3.x per the second paragraph of #21.

(Meanwhile, I found the actual probable source of the PHP 7.3 regressions in #3172166: Element::properties() produces notices if given an array with integer keys -- just missed it in the git log because of weird commit date ordering from cherry-picks being out of order vs. 9.4.x. Sorry for the noise about that part, but we still do need to make this 9.4.x only.) :)

lauriii’s picture

StatusFileSize
new74.16 KB
new595 bytes

We need to keep the --allow-empty-input argument in the stylelint command for the stylelint command to pass when CSS files copied from Classy are being changed in Claro and Olivero.

longwave’s picture

Should we keep the .css changes for consistency and only revert .stylelintrc.json and yarn.lock? Even the commit script changes are an improvement that can stay in 9.3.x?

xjm’s picture

@longwave Can you file a followup for that? I just want to get this reverted now so that we're not committing to it with no way to back out in a patch release today.

longwave’s picture

Status: Needs review » Reviewed & tested by the community
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Alright, committed the revert patch to 9.3.x after comparing it with a local revert. Thanks @longwave!

In the future, it might be better to split an issue like this into those sorts of separate scopes to begin with.

Finally, all dependency updates should be tagged for the release notes, especially if it's outside the normal expectations of what would get a dependency update in a given release. So even if we agreed the whole enchilada should go in 9.3.3, the issue should have had both the "9.4.0 release notes and "9.3.3 release notes") issue tags. Thanks!

xjm’s picture

Title: [Revert from 9.3.x needed] Update to Stylelint 14 » Update to Stylelint 14
Version: 9.3.x-dev » 9.4.x-dev

Restoring original title and 9.4.x branch now that the revert's in.

  • xjm committed 5e46701 on 9.3.x
    Issue #3246211 by longwave, xjm, lauriii, alexpott: [Revert from 9.3.x]...
xjm’s picture

Dependency update should also always be in the release notes. It sounds like this might want a CR too, for the improvements to linting etc.?

longwave’s picture

Issue summary: View changes
Issue tags: -Needs release note, -Needs change record

Wrote a CR, updated release note snippet in IS.

xjm’s picture

Issue tags: +10.0.0 release notes

Thanks @longwave!

This is also a change from 10.0.0-alpha1, so adding it to the alpha2 release notes list.

xjm’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.