stylelint-config-crisp 1.0.22 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-config-crisp",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Custom Stylelint Rules for Crisp",
5
5
  "author": "Crisp IM SAS",
6
6
  "main": "index.js",
@@ -82,14 +82,22 @@ const ruleFunction = (primaryOption, secondaryOptions = {}, context) => {
82
82
  if (!isInterpolated) {
83
83
  // Skip classes elements outside of CSS file scope
84
84
  if (fileScopeClass) {
85
- if (rule.selector.startsWith(".") &&
86
- !rule.selector.startsWith(`.${fileScopeClass}`)) {
87
- return;
85
+ if (rule.selector.startsWith(".")) {
86
+ // Extract base part from BEM selector
87
+ const regex = /^(\.[\w-]+?)(?:--|__)[\w-]+$/;
88
+
89
+ const match = rule.selector.match(regex);
90
+ const base = match ? match[1] : null;
91
+
92
+ if (base && base !== `.${fileScopeClass}`) {
93
+ return;
94
+ }
88
95
  }
89
96
 
90
- if (rule.selector.startsWith("&.") &&
91
- !rule.selector.startsWith(`&.${fileScopeClass}`)) {
92
- return;
97
+ if (rule.selector.startsWith("&.")) {
98
+ if (!rule.selector.startsWith(`&.${fileScopeClass}`)) {
99
+ return;
100
+ }
93
101
  }
94
102
  }
95
103