stylelint-config-crisp 1.0.17 → 1.0.19
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/README.md +2 -1
- package/index.js +1 -0
- package/package.json +1 -1
- package/rules/selector-class-interpolation.js +15 -7
package/README.md
CHANGED
|
@@ -48,6 +48,7 @@ This is the list of configured syntaxes, plugins and rules used by Stylelint Con
|
|
|
48
48
|
* `outline: none` is disallowed (prefer `0`, for consistency)
|
|
49
49
|
- [keyframe-block-no-duplicate-selectors](https://stylelint.io/user-guide/rules/keyframe-block-no-duplicate-selectors/): Rule is **disabled**, in order to allow cascade selectors within keyframe blocks (seems they are not supported by this rule, yet)
|
|
50
50
|
- [number-max-precision](https://stylelint.io/user-guide/rules/number-max-precision/): Allows a maximum of 5 decimal places in numbers
|
|
51
|
+
- [media-feature-range-notation](https://stylelint.io/user-guide/rules/media-feature-range-notation/): Media feature ranges must use the `prefix` notation
|
|
51
52
|
- [no-descending-specificity](https://stylelint.io/user-guide/rules/no-descending-specificity/): Rule is **disabled**, as we do not want to check source order
|
|
52
53
|
- [rule-empty-line-before](https://stylelint.io/user-guide/rules/rule-empty-line-before/): Requires an empty line before multi-line rules
|
|
53
54
|
* `"first-nested"` is reversed (for rules that are nested and the first child of their parent node, we don't want any empty line)
|
|
@@ -85,7 +86,7 @@ This is the list of configured syntaxes, plugins and rules used by Stylelint Con
|
|
|
85
86
|
#### Crisp rules
|
|
86
87
|
- [at-rule-conditional-parentheses](https://github.com/crisp-oss/stylelint-config-crisp/blob/master/rules/at-rule-conditional-parentheses.js): Enforces parentheses in conditions of at-rules (`@if`, `@elseif`, `@while`)
|
|
87
88
|
- [rule-empty-line-before](https://github.com/crisp-oss/stylelint-config-crisp/blob/master/rules/rule-empty-line-before.js): Requires an empty line before multi-line rules the same way [rule-empty-line-before](https://stylelint.io/user-guide/rules/rule-empty-line-before/) does, but properly handles Sass interpolation `#{}` in selectors
|
|
88
|
-
- [selector-class-interpolation](https://github.com/crisp-oss/stylelint-config-crisp/blob/master/rules/selector-class-interpolation.js): Enforces class selectors to use Sass interpolation
|
|
89
|
+
- [selector-class-interpolation](https://github.com/crisp-oss/stylelint-config-crisp/blob/master/rules/selector-class-interpolation.js): Enforces class selectors to use Sass interpolation (this rule is only applied to Vue files)
|
|
89
90
|
|
|
90
91
|
## License
|
|
91
92
|
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -40,7 +40,20 @@ const ruleFunction = (primaryOption, secondaryOptions = {}, context) => {
|
|
|
40
40
|
|
|
41
41
|
// Determine if the resolved selector should be ignored
|
|
42
42
|
const isIgnored = ignoreSelectors.some(ignoreItem => {
|
|
43
|
-
|
|
43
|
+
if (typeof ignoreItem === "string") {
|
|
44
|
+
// Check if it's a stringified regex (e.g., "/pattern/")
|
|
45
|
+
if (ignoreItem.startsWith("/") && ignoreItem.endsWith("/")) {
|
|
46
|
+
const regexPattern = ignoreItem.slice(1, -1);
|
|
47
|
+
const regex = new RegExp(regexPattern);
|
|
48
|
+
return regex.test(resolvedSelector);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// It's a regular string
|
|
52
|
+
return ignoreItem === resolvedSelector;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// It's a real RegExp
|
|
56
|
+
return ignoreItem.test(resolvedSelector);
|
|
44
57
|
});
|
|
45
58
|
|
|
46
59
|
if (isIgnored) {
|
|
@@ -85,14 +98,9 @@ function resolveSelector(rule, parentSelector = "") {
|
|
|
85
98
|
return parentSelector ? (parentSelector + " " + rule.selector).trim() : rule.selector;
|
|
86
99
|
}
|
|
87
100
|
|
|
88
|
-
// Helper function to check if a value is a RegExp
|
|
89
|
-
function isRegExp(value) {
|
|
90
|
-
return value instanceof RegExp;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
101
|
// Helper function to check if a value is a RegExp or a string
|
|
94
102
|
function isStringOrRegExp(value) {
|
|
95
|
-
return
|
|
103
|
+
return value instanceof RegExp || typeof value === "string";
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
// Check if the rule is a top-level class selector
|