WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.3k stars 4.11k forks source link

@wordpress/stylelint-config uses outdated stylelint (14.2) #48142

Open paulschreiber opened 1 year ago

paulschreiber commented 1 year ago

Description

The @wordpress/stylelint-config NPM modules has an outdated stylelint dependency (14.2). Current version is 15.1. This causes a dependency conflict for folks using the module.

Step-by-step reproduction instructions

n/a

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

paulschreiber commented 1 year ago

Updating to 15.1 flags three rules as deprecated:

at-rule-name-space-after
block-closing-brace-newline-after
block-opening-brace-space-before
75th commented 1 year ago

I get a large number of deprecated rules when I extend @wordpress/stylelint-config/scss with no additional rules of my own:

at-rule-name-case
at-rule-name-space-after
at-rule-semicolon-newline-after
block-closing-brace-newline-after
block-closing-brace-newline-before
block-opening-brace-newline-after
block-opening-brace-space-before
color-hex-case
declaration-bang-space-after
declaration-bang-space-before
declaration-block-semicolon-newline-after
declaration-block-semicolon-space-before
declaration-block-trailing-semicolon
declaration-colon-newline-after
declaration-colon-space-after
declaration-colon-space-before
function-comma-space-after
function-comma-space-before
function-max-empty-lines
function-parentheses-space-inside
function-whitespace-after
max-empty-lines
max-line-length
media-feature-colon-space-after
media-feature-colon-space-before
media-feature-range-operator-space-after
media-feature-range-operator-space-before
media-query-list-comma-newline-after
media-query-list-comma-space-after
media-query-list-comma-space-before
no-eol-whitespace
no-extra-semicolons
no-missing-end-of-source-newline
number-leading-zero
number-no-trailing-zeros
property-case
selector-attribute-brackets-space-inside
selector-attribute-operator-space-after
selector-attribute-operator-space-before
selector-combinator-space-after
selector-combinator-space-before
selector-list-comma-newline-after
selector-list-comma-space-before
selector-max-empty-lines
selector-pseudo-class-case
selector-pseudo-class-parentheses-space-inside
selector-pseudo-element-case
string-quotes
unit-case
value-list-comma-newline-after
value-list-comma-space-after
value-list-comma-space-before
indentation

I think it's idiotic for Stylelint to be deprecating these, but I guess if they're going to do it then this package should follow their lead and remove them.

mikeybinns commented 5 months ago

Stylelint is now on v16 so WP's config is 2 versions behind and all the open PRs connected to this seemed to have stalled. If there's anything I can do to help push this along, let me know. I'm hesitant to open another PR for this because there's already ones in progress, however I'm willing to contribute code into getting this resolved if someone can advise on the best way to assist.

I'm also not sure I agree with the "Type: Enhancement" label here, this is a dependency issue, and this outdated peer dependency makes it difficult to use the WP config in external projects / with other stylelint plugins.

vicobot-0815 commented 4 months ago

Not sure if this belongs here or in a separate issue: @wordpress/stylelint-config has two other dependencies:

"dependencies": {
    "stylelint-config-recommended": "^6.0.0",
    "stylelint-config-recommended-scss": "^5.0.2"

These two are currently on version 14.0.0. Putting

{
  "extends": "@wordpress/stylelint-config/scss"
}

into the config file for stylelint makes linting fail with TypeErrors, if current versions of stylelint and the stylelint-config-packages are installed .

mikeybinns commented 1 week ago

@gziolo I'm hoping you can help as you've been active on these PRs and you work for Automattic

This PR has been stuck for 1.5 years now, and I think it's really important we get Stylelint updated before it hit v17 and we run into issues being on an unsupported Stylelint version.

Would it be okay if I opened a new PR for this, as the others haven't been updated for so long?

There's a comment from one of the Stylelint maintainers here which provides a path to upgrade without deprecating rules in the stylelint config, we just have to pull those same rules from a different package: https://github.com/WordPress/gutenberg/pull/50336#issuecomment-2229050221

gziolo commented 1 week ago

@mikeybinns, happy to help to land it. There were several attempts in the past, and I reviewed a few of them hoping we can get updated to the latest version of stylelint. So whenever you have something to play with , let me know, and I will be happy to assist. New PR is perfectly fine as long as it addresses previous talking points.

mikeybinns commented 1 week ago

Excellent, thanks for the speedy response, I shall get to work on that right away :)

gziolo commented 1 week ago

The PR from @mikeybinns is ready for review and testing: