Issue #3246211 by longwave, alexpott: Update to Stylelint 14

merge-requests/1721/head
Lauri Eskola 2022-01-25 16:26:40 +02:00
parent 88a8d35c51
commit f1a00d1643
No known key found for this signature in database
GPG Key ID: 382FC0F5B0DF53F8
32 changed files with 300 additions and 443 deletions

View File

@ -4,19 +4,29 @@
"stylelint-order" "stylelint-order"
], ],
"rules": { "rules": {
"alpha-value-notation": "number",
"at-rule-no-vendor-prefix": null,
"color-function-notation": "legacy",
"comment-empty-line-before": null, "comment-empty-line-before": null,
"custom-property-pattern": "^[a-z][-_a-z0-9IE]*$",
"declaration-block-no-redundant-longhand-properties": null,
"function-linear-gradient-no-nonstandard-direction": null, "function-linear-gradient-no-nonstandard-direction": null,
"function-url-quotes": null,
"function-whitespace-after": null, "function-whitespace-after": null,
"hue-degree-notation": "number",
"no-descending-specificity": null, "no-descending-specificity": null,
"no-duplicate-selectors": null, "no-duplicate-selectors": null,
"no-unknown-animations": true, "no-unknown-animations": true,
"max-line-length": null,
"media-feature-name-no-unknown": [true, { "media-feature-name-no-unknown": [true, {
"ignoreMediaFeatureNames": [ "ignoreMediaFeatureNames": [
"prefers-reduced-motion", "prefers-reduced-motion",
"min--moz-device-pixel-ratio" "min--moz-device-pixel-ratio"
] ]
}], }],
"media-feature-name-no-vendor-prefix": null,
"number-leading-zero": "always", "number-leading-zero": "always",
"number-max-precision": 5,
"order/order": [ "order/order": [
"custom-properties", "custom-properties",
"dollar-variables", "dollar-variables",
@ -445,7 +455,12 @@
"line-height" "line-height"
], ],
"property-no-unknown": null, "property-no-unknown": null,
"property-no-vendor-prefix": null,
"rule-empty-line-before": null, "rule-empty-line-before": null,
"selector-attribute-quotes": null,
"selector-class-pattern": null,
"selector-id-pattern": "^[a-z][-_a-z0-9]*$",
"selector-no-vendor-prefix": null,
"selector-pseudo-element-colon-notation": null, "selector-pseudo-element-colon-notation": null,
"shorthand-property-no-redundant-values": null, "shorthand-property-no-redundant-values": null,
"string-quotes": "double", "string-quotes": "double",
@ -455,7 +470,8 @@
"--font-family", "--font-family",
"font-family" "font-family"
] ]
}] }],
"value-no-vendor-prefix": null
}, },
"ignoreFiles": [ "ignoreFiles": [
"assets/vendor/**/*.css", "assets/vendor/**/*.css",

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Base styles for dropbuttons. * Base styles for dropbuttons.

View File

@ -1,4 +1,3 @@
body { body {
margin: 1em; margin: 1em;
background-color: #fff; background-color: #fff;

View File

@ -1,4 +1,3 @@
/** /**
* Image style configuration pages. * Image style configuration pages.
*/ */

View File

@ -1,4 +1,3 @@
/** /**
* This file is for testing CSS file override in * This file is for testing CSS file override in
* CascadingStylesheetsTestCase::testRenderOverride(). * CascadingStylesheetsTestCase::testRenderOverride().

View File

@ -1,2 +1 @@
/* This file is for testing CSS file inclusion, no contents are necessary. */ /* This file is for testing CSS file inclusion, no contents are necessary. */

View File

@ -1,2 +1 @@
/* This file is for testing CSS file inclusion, no contents are necessary. */ /* This file is for testing CSS file inclusion, no contents are necessary. */

View File

@ -1,4 +1,3 @@
.taxonomy-term-preview { .taxonomy-term-preview {
background-color: #eee; background-color: #eee;
} }

View File

@ -104,10 +104,10 @@
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"shepherd.js": "^8.3.1", "shepherd.js": "^8.3.1",
"sortablejs": "^1.13.0", "sortablejs": "^1.13.0",
"stylelint": "^13.0.0", "stylelint": "^14.0.1",
"stylelint-checkstyle-formatter": "^0.1.1", "stylelint-checkstyle-formatter": "^0.1.2",
"stylelint-config-standard": "^20.0.0", "stylelint-config-standard": "^23.0.0",
"stylelint-order": "^4.0.0", "stylelint-order": "^5.0.0",
"tabbable": "^5.2.0", "tabbable": "^5.2.0",
"terser": "^5.3.4", "terser": "^5.3.4",
"terser-webpack-plugin": "^5.2.0", "terser-webpack-plugin": "^5.2.0",

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Admin styling for the Filter module. * Admin styling for the Filter module.

View File

@ -122,6 +122,12 @@ PHPSTAN_DIST_FILE_CHANGED=0
# - core/.eslintrc.jquery.json # - core/.eslintrc.jquery.json
ESLINT_CONFIG_PASSING_FILE_CHANGED=0 ESLINT_CONFIG_PASSING_FILE_CHANGED=0
# This variable will be set to one when the stylelint config file is changed.
# changed:
# - core/.stylelintignore
# - core/.stylelintrc.json
STYLELINT_CONFIG_FILE_CHANGED=0
# Build up a list of absolute file names. # Build up a list of absolute file names.
ABS_FILES= ABS_FILES=
for FILE in $FILES; do for FILE in $FILES; do
@ -140,6 +146,16 @@ for FILE in $FILES; do
if [[ $FILE == "core/.eslintrc.json" || $FILE == "core/.eslintrc.passing.json" || $FILE == "core/.eslintrc.jquery.json" ]]; then if [[ $FILE == "core/.eslintrc.json" || $FILE == "core/.eslintrc.passing.json" || $FILE == "core/.eslintrc.jquery.json" ]]; then
ESLINT_CONFIG_PASSING_FILE_CHANGED=1; ESLINT_CONFIG_PASSING_FILE_CHANGED=1;
fi; fi;
if [[ $FILE == "core/.stylelintignore" || $FILE == "core/.stylelintrc.json" ]]; then
STYLELINT_CONFIG_FILE_CHANGED=1;
fi;
# If JavaScript packages change, then rerun all JavaScript style checks.
if [[ $FILE == "core/package.json" || $FILE == "core/yarn.lock" ]]; then
ESLINT_CONFIG_PASSING_FILE_CHANGED=1;
STYLELINT_CONFIG_FILE_CHANGED=1;
fi;
done done
# Exit early if there are no files. # Exit early if there are no files.
@ -251,6 +267,24 @@ if [[ $ESLINT_CONFIG_PASSING_FILE_CHANGED == "1" ]]; then
printf "\n" printf "\n"
fi fi
# When the stylelint config has been changed, then stylelint must check all files.
if [[ $STYLELINT_CONFIG_FILE_CHANGED == "1" ]]; then
cd "$TOP_LEVEL/core"
yarn run -s lint:css
if [ "$?" -ne "0" ]; then
# If there are failures set the status to a number other than 0.
FINAL_STATUS=1
printf "\nstylelint: ${red}failed${reset}\n"
else
printf "\nstylelint: ${green}passed${reset}\n"
fi
cd $TOP_LEVEL
# Add a separator line to make the output easier to read.
printf "\n"
printf -- '-%.0s' {1..100}
printf "\n"
fi
for FILE in $FILES; do for FILE in $FILES; do
STATUS=0; STATUS=0;
# Print a line to separate spellcheck output from per file output. # Print a line to separate spellcheck output from per file output.
@ -457,7 +491,7 @@ for FILE in $FILES; do
# has a corresponding .pcss don't do stylelint. # has a corresponding .pcss don't do stylelint.
if [[ $FILE =~ \.pcss\.css$ ]] || [[ ! -f "$TOP_LEVEL/$BASENAME.pcss.css" ]]; then if [[ $FILE =~ \.pcss\.css$ ]] || [[ ! -f "$TOP_LEVEL/$BASENAME.pcss.css" ]]; then
cd "$TOP_LEVEL/core" cd "$TOP_LEVEL/core"
node_modules/.bin/stylelint "$TOP_LEVEL/$FILE" node_modules/.bin/stylelint --allow-empty-input "$TOP_LEVEL/$FILE"
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
STATUS=1 STATUS=1
else else

View File

@ -690,7 +690,7 @@ class ConfirmClassyCopiesTest extends KernelTestBase {
'forum.css' => '8aad2d86dfd29818e991757581cd7ab8', 'forum.css' => '8aad2d86dfd29818e991757581cd7ab8',
'icons.css' => '56f623bd343b9bc7e7ac3e3e95d7f3ce', 'icons.css' => '56f623bd343b9bc7e7ac3e3e95d7f3ce',
'image-widget.css' => '2da54829199f64a2c390930c3b0913a3', 'image-widget.css' => '2da54829199f64a2c390930c3b0913a3',
'indented.css' => '48e214a106d9fede1e05aa10b4796361', 'indented.css' => '3f7be76cf4b5df7dca1c96a28c76b134',
'inline-form.css' => 'cc5cbfd34511d9021a53ec693c110740', 'inline-form.css' => 'cc5cbfd34511d9021a53ec693c110740',
'item-list.css' => '1d519afe6007f4b01e00f22b0ba8bf33', 'item-list.css' => '1d519afe6007f4b01e00f22b0ba8bf33',
'link.css' => '22f42d430fe458080a7739c70a2d2ea5', 'link.css' => '22f42d430fe458080a7739c70a2d2ea5',

View File

@ -1,4 +1,3 @@
/* ---------- General Layout ---------- */ /* ---------- General Layout ---------- */
body, body,

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Admin styling for the Filter module. * Admin styling for the Filter module.

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Basic styling for comment module. * Basic styling for comment module.

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Styling for the shortcut module. * Styling for the shortcut module.

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Basic styling for comment module. * Basic styling for comment module.

View File

@ -24,7 +24,7 @@
/* Width of the entire grid maxes out. */ /* Width of the entire grid maxes out. */
@font-face { @font-face {
font-family: "metropolis"; font-family: metropolis;
src: src:
url("../../fonts/metropolis/Metropolis-Regular.woff2") format("woff2"), url("../../fonts/metropolis/Metropolis-Regular.woff2") format("woff2"),
url("../../fonts/metropolis/Metropolis-Regular.woff") format("woff"); url("../../fonts/metropolis/Metropolis-Regular.woff") format("woff");
@ -34,7 +34,7 @@
} }
@font-face { @font-face {
font-family: "metropolis"; font-family: metropolis;
src: src:
url("../../fonts/metropolis/Metropolis-Bold.woff2") format("woff2"), url("../../fonts/metropolis/Metropolis-Bold.woff2") format("woff2"),
url("../../fonts/metropolis/Metropolis-Bold.woff") format("woff"); url("../../fonts/metropolis/Metropolis-Bold.woff") format("woff");
@ -44,7 +44,7 @@
} }
@font-face { @font-face {
font-family: "metropolis"; font-family: metropolis;
src: src:
url("../../fonts/metropolis/Metropolis-SemiBold.woff2") format("woff2"), url("../../fonts/metropolis/Metropolis-SemiBold.woff2") format("woff2"),
url("../../fonts/metropolis/Metropolis-SemiBold.woff") format("woff"); url("../../fonts/metropolis/Metropolis-SemiBold.woff") format("woff");
@ -56,7 +56,7 @@
/* lora-regular - latin */ /* lora-regular - latin */
@font-face { @font-face {
font-family: "Lora"; font-family: Lora;
src: src:
local("Lora Regular"), local("Lora Regular"),
local("Lora-Regular"), local("Lora-Regular"),
@ -70,7 +70,7 @@
/* lora-italic - latin */ /* lora-italic - latin */
@font-face { @font-face {
font-family: "Lora"; font-family: Lora;
src: src:
local("Lora Italic"), local("Lora Italic"),
local("Lora-Italic"), local("Lora-Italic"),
@ -84,7 +84,7 @@
/* lora-700 - latin */ /* lora-700 - latin */
@font-face { @font-face {
font-family: "Lora"; font-family: Lora;
src: src:
local("Lora Bold"), local("Lora Bold"),
local("Lora-Bold"), local("Lora-Bold"),

View File

@ -6,7 +6,7 @@
@import "media-queries.pcss.css"; @import "media-queries.pcss.css";
@font-face { @font-face {
font-family: "metropolis"; font-family: metropolis;
src: src:
url("../../fonts/metropolis/Metropolis-Regular.woff2") format("woff2"), url("../../fonts/metropolis/Metropolis-Regular.woff2") format("woff2"),
url("../../fonts/metropolis/Metropolis-Regular.woff") format("woff"); url("../../fonts/metropolis/Metropolis-Regular.woff") format("woff");
@ -16,7 +16,7 @@
} }
@font-face { @font-face {
font-family: "metropolis"; font-family: metropolis;
src: src:
url("../../fonts/metropolis/Metropolis-Bold.woff2") format("woff2"), url("../../fonts/metropolis/Metropolis-Bold.woff2") format("woff2"),
url("../../fonts/metropolis/Metropolis-Bold.woff") format("woff"); url("../../fonts/metropolis/Metropolis-Bold.woff") format("woff");
@ -26,7 +26,7 @@
} }
@font-face { @font-face {
font-family: "metropolis"; font-family: metropolis;
src: src:
url("../../fonts/metropolis/Metropolis-SemiBold.woff2") format("woff2"), url("../../fonts/metropolis/Metropolis-SemiBold.woff2") format("woff2"),
url("../../fonts/metropolis/Metropolis-SemiBold.woff") format("woff"); url("../../fonts/metropolis/Metropolis-SemiBold.woff") format("woff");
@ -37,7 +37,7 @@
/* lora-regular - latin */ /* lora-regular - latin */
@font-face { @font-face {
font-family: "Lora"; font-family: Lora;
src: src:
local("Lora Regular"), local("Lora Regular"),
local("Lora-Regular"), local("Lora-Regular"),
@ -49,7 +49,7 @@
} }
/* lora-italic - latin */ /* lora-italic - latin */
@font-face { @font-face {
font-family: "Lora"; font-family: Lora;
src: src:
local("Lora Italic"), local("Lora Italic"),
local("Lora-Italic"), local("Lora-Italic"),
@ -61,7 +61,7 @@
} }
/* lora-700 - latin */ /* lora-700 - latin */
@font-face { @font-face {
font-family: "Lora"; font-family: Lora;
src: src:
local("Lora Bold"), local("Lora Bold"),
local("Lora-Bold"), local("Lora-Bold"),

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Basic styling for comment module. * Basic styling for comment module.

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Admin styling for the Filter module. * Admin styling for the Filter module.

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Base styles for dropbuttons. * Base styles for dropbuttons.

View File

@ -1,4 +1,3 @@
body { body {
margin: 1em; margin: 1em;
background-color: #fff; background-color: #fff;

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Admin styling for the Filter module. * Admin styling for the Filter module.

View File

@ -1,4 +1,3 @@
/** /**
* Image style configuration pages. * Image style configuration pages.
*/ */

View File

@ -1,4 +1,3 @@
.taxonomy-term-preview { .taxonomy-term-preview {
background-color: #eee; background-color: #eee;
} }

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Base styles for dropbuttons. * Base styles for dropbuttons.

View File

@ -1,4 +1,3 @@
body { body {
margin: 1em; margin: 1em;
background-color: #fff; background-color: #fff;

View File

@ -1,4 +1,3 @@
/** /**
* Image style configuration pages. * Image style configuration pages.
*/ */

View File

@ -1,4 +1,3 @@
.taxonomy-term-preview { .taxonomy-term-preview {
background-color: #eee; background-color: #eee;
} }

View File

@ -1,4 +1,3 @@
/** /**
* @file * @file
* Basic styling for comment module. * Basic styling for comment module.

File diff suppressed because it is too large Load Diff