From 83c2b68c561b9dbf21b597d764bd52771ebfba56 Mon Sep 17 00:00:00 2001 From: Daniels Lee Date: Wed, 5 Jul 2023 12:20:56 -0700 Subject: [PATCH] fix(stylelint-config): add stylelint-order package back in In `stylelint-config-sass-guidelines@10`, one breaking change was the complete removal of the `stylelint-order` plugin due to lack of community consensus on what preferred ordering should be. https://github.com/bjankord/stylelint-config-sass-guidelines/pull/278 --- package-lock.json | 24 +++++++++++++++++++++--- packages/stylelint-config/package.json | 1 + packages/stylelint-config/src/index.js | 5 +++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index fc16b9c4..76a77fd7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12297,7 +12297,6 @@ "url": "https://github.com/sponsors/ai" } ], - "peer": true, "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -13823,7 +13822,6 @@ "url": "https://github.com/sponsors/ai" } ], - "peer": true, "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", @@ -13892,6 +13890,14 @@ "node": ">=4" } }, + "node_modules/postcss-sorting": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/postcss-sorting/-/postcss-sorting-8.0.2.tgz", + "integrity": "sha512-M9dkSrmU00t/jK7rF6BZSZauA5MAaBW4i5EnJXspMwt4iqTh/L9j6fgMnbElEOfyRyfLfVbIHj/R52zHzAPe1Q==", + "peerDependencies": { + "postcss": "^8.4.20" + } + }, "node_modules/postcss-value-parser": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", @@ -15365,7 +15371,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -15990,6 +15995,18 @@ } } }, + "node_modules/stylelint-order": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/stylelint-order/-/stylelint-order-6.0.3.tgz", + "integrity": "sha512-1j1lOb4EU/6w49qZeT2SQVJXm0Ht+Qnq9GMfUa3pMwoyojIWfuA+JUDmoR97Bht1RLn4ei0xtLGy87M7d29B1w==", + "dependencies": { + "postcss": "^8.4.21", + "postcss-sorting": "^8.0.2" + }, + "peerDependencies": { + "stylelint": "^14.0.0 || ^15.0.0" + } + }, "node_modules/stylelint-prettier": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/stylelint-prettier/-/stylelint-prettier-2.0.0.tgz", @@ -17664,6 +17681,7 @@ "stylelint-config-sass-guidelines": "^10.0.0", "stylelint-config-standard": "^29.0.0", "stylelint-config-standard-scss": "^6.1.0", + "stylelint-order": "^6.0.3", "stylelint-prettier": "^2.0.0" }, "devDependencies": { diff --git a/packages/stylelint-config/package.json b/packages/stylelint-config/package.json index 6ba1c756..7d53fbe3 100644 --- a/packages/stylelint-config/package.json +++ b/packages/stylelint-config/package.json @@ -23,6 +23,7 @@ "stylelint-config-sass-guidelines": "^10.0.0", "stylelint-config-standard": "^29.0.0", "stylelint-config-standard-scss": "^6.1.0", + "stylelint-order": "^6.0.3", "stylelint-prettier": "^2.0.0" }, "peerDependencies": { diff --git a/packages/stylelint-config/src/index.js b/packages/stylelint-config/src/index.js index defa7f6d..1b7f37b0 100644 --- a/packages/stylelint-config/src/index.js +++ b/packages/stylelint-config/src/index.js @@ -16,6 +16,10 @@ module.exports = { 'stylelint-config-prettier', 'stylelint-prettier/recommended', ], + plugins: [ + // Enable ordering rules for content within declaration blocks. + 'stylelint-order', + ], rules: { // Until we migrate *all* our repos away from legacy node-sass to dart sass, // we must continue defining alpha values with decimal numbers. Node-sass @@ -107,6 +111,7 @@ module.exports = { 'rules', ], ], + 'order/properties-alphabetical-order': true, // Custom regex of ReadMe's current BEM selector class pattern. 'selector-class-pattern': [