stylelint-config-crisp 1.0.21 → 1.0.23

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.21",
3
+ "version": "1.0.23",
4
4
  "description": "Custom Stylelint Rules for Crisp",
5
5
  "author": "Crisp IM SAS",
6
6
  "main": "index.js",
@@ -81,10 +81,24 @@ const ruleFunction = (primaryOption, secondaryOptions = {}, context) => {
81
81
 
82
82
  if (!isInterpolated) {
83
83
  // Skip classes elements outside of CSS file scope
84
- if (fileScopeClass &&
85
- rule.selector.startsWith(".") &&
86
- !rule.selector.startsWith(`.${fileScopeClass}`)) {
87
- return;
84
+ if (fileScopeClass) {
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 !== `.${fileScopeClass}`) {
93
+ return;
94
+ }
95
+ }
96
+
97
+ if (rule.selector.startsWith("&.")) {
98
+ if (!rule.selector.startsWith(`&.${fileScopeClass}`)) {
99
+ return;
100
+ }
101
+ }
88
102
  }
89
103
 
90
104
  if (context.fix) {