Skip to content

Commit

Permalink
Use @wordpress/stylelint-config in @wordpress/scripts (#27810)
Browse files Browse the repository at this point in the history
* Use @wordpress/stylelint-config in @wordpress/scripts

* Add changelog entry

* Update docs/configs to use @wordpress/stylelint-config

* Update package-lock.json

* Update snapshots

* Docs: Replace deprecated/broken links
  • Loading branch information
ocean90 committed Jan 3, 2021
1 parent 7adff91 commit 4f967d1
Show file tree
Hide file tree
Showing 15 changed files with 607 additions and 712 deletions.
2 changes: 1 addition & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "stylelint-config-wordpress",
"extends": "@wordpress/stylelint-config",
"rules": {
"at-rule-empty-line-before": null,
"at-rule-no-unknown": null,
Expand Down
1,280 changes: 585 additions & 695 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"@wordpress/prettier-config": "file:packages/prettier-config",
"@wordpress/project-management-automation": "file:packages/project-management-automation",
"@wordpress/scripts": "file:packages/scripts",
"@wordpress/stylelint-config": "file:packages/stylelint-config",
"appium": "1.18.3",
"babel-jest": "26.6.3",
"babel-loader": "8.1.0",
Expand Down Expand Up @@ -193,7 +194,6 @@
"source-map-loader": "0.2.4",
"sprintf-js": "1.1.1",
"style-loader": "1.0.0",
"stylelint-config-wordpress": "17.0.0",
"terser-webpack-plugin": "3.0.3",
"typescript": "4.0.3",
"uuid": "8.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-tests/fixtures/blocks/core__query.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"isValid": true,
"attributes": {
"query": {
"inherit": true,
"perPage": null,
"pages": 1,
"offset": 0,
Expand All @@ -17,7 +16,8 @@
"author": "",
"search": "",
"exclude": [],
"sticky": ""
"sticky": "",
"inherit": true
},
"layout": {
"type": "list"
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Breaking Changes

- The peer `jest` dependency has been updated from requiring `>=25` to requiring `>=26` (see [Breaking Changes](https://jestjs.io/blog/2020/05/05/jest-26), [#27956](https://github.com/WordPress/gutenberg/pull/27956)).
- The bundled `stylelint-config-wordpress` dependency has been replaced with `@wordpress/stylelint-config` (#27810)[https://github.com/WordPress/gutenberg/pull/27810].

### Enhancements

Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ By default, files located in `build`, `node_modules`, and `vendor` folders are i

#### Advanced information

It uses [stylelint](https://github.com/stylelint/stylelint) with the [stylelint-config-wordpress](https://github.com/WordPress-Coding-Standards/stylelint-config-wordpress) configuration per the [WordPress CSS Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/css/). You can override them with your own rules as described in [stylelint user guide](https://github.com/stylelint/stylelint/docs/user-guide.md). Learn more in the [Advanced Usage](#advanced-usage) section.
It uses [stylelint](https://github.com/stylelint/stylelint) with the [@wordpress/stylelint-config]((https://www.npmjs.com/package/@wordpress/stylelint-config) ) configuration per the [WordPress CSS Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/css/). You can override them with your own rules as described in [stylelint user guide](https://stylelint.io/user-guide/configure). Learn more in the [Advanced Usage](#advanced-usage) section.

### `packages-update`

Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/config/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "stylelint-config-wordpress/scss"
"extends": "@wordpress/stylelint-config/scss"
}
4 changes: 2 additions & 2 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@wordpress/npm-package-json-lint-config": "file:../npm-package-json-lint-config",
"@wordpress/postcss-plugins-preset": "file:../postcss-plugins-preset",
"@wordpress/prettier-config": "file:../prettier-config",
"@wordpress/stylelint-config": "file:../stylelint-config",
"babel-jest": "^26.6.3",
"babel-loader": "^8.1.0",
"chalk": "^4.0.0",
Expand All @@ -66,8 +67,7 @@
"sass": "^1.26.11",
"sass-loader": "^8.0.2",
"source-map-loader": "^0.2.4",
"stylelint": "^13.6.0",
"stylelint-config-wordpress": "^17.0.0",
"stylelint": "^13.8.0",
"terser-webpack-plugin": "^3.0.3",
"thread-loader": "^2.1.3",
"url-loader": "^3.0.0",
Expand Down
6 changes: 5 additions & 1 deletion packages/stylelint-config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

### Breaking Change

- Removed stylelint `^10.1.0`, `^11.0.0`, and `^12.0.0` as peer dependency.
- Increased minimum peer dependency of `stylelint` to `13.7.0`.

### Bug Fixes

- Fixed deprecation warning for `declaration-property-unit-whitelist`.

### Internal

Expand Down
2 changes: 1 addition & 1 deletion packages/stylelint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
'declaration-colon-newline-after': 'always-multi-line',
'declaration-colon-space-after': 'always-single-line',
'declaration-colon-space-before': 'never',
'declaration-property-unit-whitelist': {
'declaration-property-unit-allowed-list': {
'line-height': [ 'px' ],
},
'font-family-name-quotes': 'always-where-recommended',
Expand Down
2 changes: 1 addition & 1 deletion packages/stylelint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"stylelint-scss": "^3.17.2"
},
"peerDependencies": {
"stylelint": "^13.0.0"
"stylelint": "^13.7.0"
},
"npmpackagejsonlint": {
"extends": "@wordpress/npm-package-json-lint-config",
Expand Down
2 changes: 1 addition & 1 deletion packages/stylelint-config/test/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "stylelint-config-wordpress/scss",
"extends": "@wordpress/stylelint-config/scss",
"ignoreFiles": [
"*-invalid.scss"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Array [
Object {
"column": 15,
"line": 18,
"rule": "declaration-property-unit-whitelist",
"rule": "declaration-property-unit-allowed-list",
"severity": "error",
"text": "Unexpected unit \\"%\\" for property \\"line-height\\" (declaration-property-unit-whitelist)",
"text": "Unexpected unit \\"%\\" for property \\"line-height\\" (declaration-property-unit-allowed-list)",
},
Object {
"column": 1,
Expand Down
4 changes: 2 additions & 2 deletions packages/stylelint-config/test/__snapshots__/values.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Array [
Object {
"column": 15,
"line": 12,
"rule": "declaration-property-unit-whitelist",
"rule": "declaration-property-unit-allowed-list",
"severity": "error",
"text": "Unexpected unit \\"em\\" for property \\"line-height\\" (declaration-property-unit-whitelist)",
"text": "Unexpected unit \\"em\\" for property \\"line-height\\" (declaration-property-unit-allowed-list)",
},
Object {
"column": 15,
Expand Down
2 changes: 1 addition & 1 deletion packages/stylelint-config/test/scss-invalid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ p {
/* Test `stylelint-config-recommended` inherited `no-extra-semicolons` rule */
@include foo;;

/* Test `stylelint-config-wordpress` inherited `number-leading-zero` rule */
/* Test `@wordpress/stylelint-config` inherited `number-leading-zero` rule */
top: .2em;
}

0 comments on commit 4f967d1

Please sign in to comment.