From 7597c64d6d7b289f452ddacf116bdf91c2bb3b46 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Wed, 5 Jun 2024 15:15:37 +1200 Subject: [PATCH] ENH Update stylelint rules --- .stylelintrc.js | 44 ++++++++++++++++++++++++++++++++++++++------ package.json | 2 +- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/.stylelintrc.js b/.stylelintrc.js index 128a93b..10b9290 100644 --- a/.stylelintrc.js +++ b/.stylelintrc.js @@ -1,5 +1,4 @@ module.exports = { - 'defaultSeverity': 'warning', 'extends': [ 'stylelint-config-recommended-scss', 'stylelint-config-sass-guidelines', @@ -8,6 +7,8 @@ module.exports = { 'plugins': [ 'stylelint-scss' ], + // Ignore anything that isn't one of these file types + 'ignoreFiles': ['**/!(*.{css,scss,sass})'], 'rules': { // Line Spacing 'rule-empty-line-before': [ @@ -31,7 +32,7 @@ module.exports = { } ], 'selector-max-id': 2, - 'selector-max-compound-selectors': 5, + 'selector-max-compound-selectors': 6, 'selector-pseudo-element-colon-notation': 'single', 'no-descending-specificity': [ true, @@ -42,7 +43,7 @@ module.exports = { } ], 'max-nesting-depth': [ - 3, + 4, { 'ignore': [ 'blockless-at-rules', @@ -73,7 +74,31 @@ module.exports = { ] } ], - + 'at-rule-no-unknown': [ + true, + { + // Allow sass at-rules - see https://sass-lang.com/documentation/at-rules/ + 'ignoreAtRules': [ + 'at-root', + 'debug', + 'each', + 'else', + 'error', + 'extend', + 'for', + 'forward', + 'function', + 'if', + 'import', + 'include', + 'mixin', + 'return', + 'use', + 'warn', + 'while', + ] + } + ], 'comment-no-empty': true, 'declaration-block-no-duplicate-properties': true, 'no-irregular-whitespace': true, @@ -86,14 +111,21 @@ module.exports = { } ], 'font-family-name-quotes': 'always-unless-keyword', - // Turn off rules + // Turn off rules 'selector-class-pattern': null, + 'selector-id-pattern': null, 'function-no-unknown': null, 'property-no-vendor-prefix': null, 'value-no-vendor-prefix': null, 'font-family-no-missing-generic-family-keyword': null, 'scss/dollar-variable-colon-space-after': null, 'scss/no-global-function-names': null, - 'value-keyword-case': null + 'value-keyword-case': null, + 'media-query-no-invalid': null, + 'selector-id-pattern': null, + 'keyframes-name-pattern': null, + 'scss/dollar-variable-pattern': null, + 'scss/at-extend-no-missing-placeholder': null, + 'no-descending-specificity': null, } }; diff --git a/package.json b/package.json index 69b152c..661b658 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@silverstripe/eslint-config", - "version": "1.2.1", + "version": "1.3.0", "description": "SilverStripe config files for eslint", "engines": { "node": ">=18.x"