stylelint-config-crisp 1.0.25 → 1.0.27
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
|
@@ -2,7 +2,7 @@ const stylelint = require("stylelint");
|
|
|
2
2
|
|
|
3
3
|
const ruleName = "crisp/at-rule-conditional-parentheses";
|
|
4
4
|
const messages = stylelint.utils.ruleMessages(ruleName, {
|
|
5
|
-
expected:
|
|
5
|
+
expected: (rule) => `Expected parentheses in \"@${rule}\" statement`
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
const ruleFunction = (primaryOption, secondaryOptions, context) => {
|
|
@@ -17,10 +17,12 @@ const ruleFunction = (primaryOption, secondaryOptions, context) => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
root.walkAtRules((rule) => {
|
|
20
|
+
let actualRule = rule.name;
|
|
20
21
|
let elseIf = false;
|
|
21
22
|
|
|
22
|
-
// An `@else if` is a regular `@else` with `if` in its params
|
|
23
|
+
// An `@else if` is a regular `@else` with `if ` in its params
|
|
23
24
|
if (rule.name === "else" && rule.params.startsWith("if ")) {
|
|
25
|
+
actualRule = "else-if";
|
|
24
26
|
elseIf = true;
|
|
25
27
|
}
|
|
26
28
|
|
|
@@ -36,7 +38,7 @@ const ruleFunction = (primaryOption, secondaryOptions, context) => {
|
|
|
36
38
|
ruleName,
|
|
37
39
|
result,
|
|
38
40
|
node: rule,
|
|
39
|
-
message: messages.expected
|
|
41
|
+
message: messages.expected(actualRule)
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -152,7 +152,7 @@ function isSelectorIgnored(rule, fileScopeClass) {
|
|
|
152
152
|
if (fileScopeClass) {
|
|
153
153
|
if (rule.selector.startsWith(".")) {
|
|
154
154
|
// Extract base part from BEM selector
|
|
155
|
-
const regex = /(\.[\w-]+?)(?=--|__|\s
|
|
155
|
+
const regex = /(\.[\w-]+?)(?=--|__|\s|:|$)/;
|
|
156
156
|
const match = rule.selector.match(regex);
|
|
157
157
|
|
|
158
158
|
if (match) {
|