From dca7fad4a0456aed45b64fc3e7de9fea928a46d6 Mon Sep 17 00:00:00 2001 From: Fynn Becker Date: Sat, 31 Dec 2022 11:11:59 +0100 Subject: [PATCH] fix: selector-class-pattern regex for modifiers --- index.js | 2 +- test/selectors.css | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 2edc245..53fc45a 100644 --- a/index.js +++ b/index.js @@ -126,7 +126,7 @@ module.exports = { 'selector-attribute-operator-space-after': 'never', 'selector-attribute-operator-space-before': 'never', 'selector-attribute-quotes': 'always', - 'selector-class-pattern': ['^(u(-[a-z]+)?|is|has|([A-Z][a-z]+)+)(--?[a-z][A-Za-z]*)?$', { + 'selector-class-pattern': ['^(u(-[a-z]+)?|is|has|([A-Z][a-z]+)+)(-[a-z][A-Za-z]*)?(--[a-z][A-Za-z]*)?$', { message: 'Expected selector format ComponentName[-descendantName|--modifierName], u-[condition-]utilityName, {is|has}-stateName', }], 'selector-combinator-space-after': 'always', diff --git a/test/selectors.css b/test/selectors.css index 2863dc4..e36b9c8 100644 --- a/test/selectors.css +++ b/test/selectors.css @@ -42,7 +42,17 @@ .ComponentName.is-state, .ComponentName.is-stateName, .ComponentName.has-state, -.ComponentName.has-stateName { +.ComponentName.has-stateName, + +/* Subcomponent */ +.Component-sub, +.Component-sub--modifier, +.Component-subComponent, +.Component-subComponent--modifier, +.ComponentName-sub, +.ComponentName-sub--modifier, +.ComponentName-subComponent, +.ComponentName-subComponent--modifier { color: hotpink; }