linter-bundle 7.2.0 → 7.3.0
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/CHANGELOG.md +18 -2
- package/README.md +11 -11
- package/eslint/rules/enforce-logical-expression-parens.mjs +1 -1
- package/eslint/rules/enforce-ternary-parens.mjs +1 -1
- package/eslint/rules/ensure-lucide-import-consistency.mjs +1 -1
- package/eslint/rules/no-extra-spaces-in-generics.mjs +1 -1
- package/eslint/rules/no-ternary-return.mjs +1 -1
- package/eslint/rules/no-unnecessary-typeof.mjs +1 -1
- package/eslint/rules/restricted-filenames.mjs +1 -1
- package/package.json +3 -3
- package/stylelint/index.mjs +0 -2
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/index.mjs +5 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/index.mjs +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/index.mjs +12 -14
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/atRuleNameSpaceChecker.mjs +2 -7
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/index.mjs +13 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/index.mjs +22 -23
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/index.mjs +29 -30
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/index.mjs +19 -20
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/index.mjs +40 -43
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/index.mjs +19 -20
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/index.mjs +14 -17
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/index.mjs +6 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.mjs +1 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/index.mjs +42 -43
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/index.mjs +19 -20
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/index.mjs +15 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/index.mjs +27 -28
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/index.mjs +6 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/index.mjs +17 -18
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/index.mjs +17 -18
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/index.mjs +17 -18
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declarationBangSpaceChecker.mjs +2 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declarationColonSpaceChecker.mjs +2 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/index.mjs +8 -10
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/index.mjs +8 -10
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/index.mjs +9 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/index.mjs +9 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/index.mjs +23 -25
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/index.mjs +72 -57
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/index.mjs +97 -72
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/index.mjs +10 -16
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/functionCommaSpaceChecker.mjs +7 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/index.mjs +43 -49
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/index.mjs +13 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/index.mjs +2 -2
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/index.mjs +9 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/index.mjs +9 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/index.mjs +6 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/index.mjs +68 -27
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/index.mjs +23 -39
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/index.mjs +6 -12
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/index.mjs +8 -10
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/index.mjs +9 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/index.mjs +9 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/mediaFeatureColonSpaceChecker.mjs +2 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/mediaQueryListCommaWhitespaceChecker.mjs +2 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/index.mjs +14 -17
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/index.mjs +6 -7
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/index.mjs +45 -43
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/index.mjs +5 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/index.mjs +24 -58
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/index.mjs +8 -11
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/index.mjs +5 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/index.mjs +49 -45
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/index.mjs +52 -54
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/index.mjs +37 -39
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/index.mjs +12 -14
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/index.mjs +12 -14
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/index.mjs +11 -14
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/index.mjs +4 -7
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/index.mjs +7 -9
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/index.mjs +8 -10
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/index.mjs +8 -10
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/index.mjs +17 -17
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/index.mjs +39 -40
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/index.mjs +49 -44
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/index.mjs +5 -8
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorAttributeOperatorSpaceChecker.mjs +6 -7
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorCombinatorSpaceChecker.mjs +6 -7
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorListCommaWhitespaceChecker.mjs +2 -5
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/index.mjs +51 -59
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/index.mjs +19 -21
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/index.mjs +11 -13
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/index.mjs +12 -14
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/index.mjs +12 -14
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/index.mjs +12 -12
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/valueListCommaWhitespaceChecker.mjs +2 -1
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/README.md +0 -21
- package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/index.mjs +0 -133
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declarationColonSpaceChecker.mjs
CHANGED
|
@@ -39,17 +39,14 @@ export default function declarationColonSpaceChecker(opts) {
|
|
|
39
39
|
index: i,
|
|
40
40
|
lineCheckStr: decl.value,
|
|
41
41
|
err: (message) => {
|
|
42
|
-
if (opts.fix && opts.fix(decl, i)) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
42
|
report({
|
|
47
43
|
message,
|
|
48
44
|
node: decl,
|
|
49
45
|
index: decl.prop.toString().length + 1,
|
|
50
|
-
endIndex:
|
|
46
|
+
endIndex: decl.prop.toString().length + 1,
|
|
51
47
|
result: opts.result,
|
|
52
48
|
ruleName: opts.checkedRuleName,
|
|
49
|
+
fix: (opts.fix ? () => opts.fix(decl, i) : undefined)
|
|
53
50
|
});
|
|
54
51
|
},
|
|
55
52
|
});
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/index.mjs
CHANGED
|
@@ -41,16 +41,14 @@ const rule = (primary, _secondaryOptions, context) => {
|
|
|
41
41
|
result,
|
|
42
42
|
locationChecker: checker.afterOneOnly,
|
|
43
43
|
checkedRuleName: ruleName,
|
|
44
|
-
fix:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})
|
|
53
|
-
: null
|
|
44
|
+
fix: (div, index, nodes) => fixer({
|
|
45
|
+
div,
|
|
46
|
+
index,
|
|
47
|
+
nodes,
|
|
48
|
+
expectation: primary,
|
|
49
|
+
position: 'after',
|
|
50
|
+
symb: context.newline || ''
|
|
51
|
+
})
|
|
54
52
|
});
|
|
55
53
|
};
|
|
56
54
|
};
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/index.mjs
CHANGED
|
@@ -41,16 +41,14 @@ const rule = (primary, _secondaryOptions, context) => {
|
|
|
41
41
|
result,
|
|
42
42
|
locationChecker: checker.beforeAllowingIndentation,
|
|
43
43
|
checkedRuleName: ruleName,
|
|
44
|
-
fix:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})
|
|
53
|
-
: null
|
|
44
|
+
fix: (div, index, nodes) => fixer({
|
|
45
|
+
div,
|
|
46
|
+
index,
|
|
47
|
+
nodes,
|
|
48
|
+
expectation: primary,
|
|
49
|
+
position: 'before',
|
|
50
|
+
symb: context.newline || ''
|
|
51
|
+
})
|
|
54
52
|
});
|
|
55
53
|
};
|
|
56
54
|
};
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ const meta = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
/** @type {import('stylelint').Rule} */
|
|
27
|
-
const rule = (primary, _secondaryOptions
|
|
27
|
+
const rule = (primary, _secondaryOptions) => {
|
|
28
28
|
const checker = whitespaceChecker('space', primary, messages);
|
|
29
29
|
|
|
30
30
|
return (root, result) => {
|
|
@@ -42,16 +42,14 @@ const rule = (primary, _secondaryOptions, context) => {
|
|
|
42
42
|
result,
|
|
43
43
|
locationChecker: checker.after,
|
|
44
44
|
checkedRuleName: ruleName,
|
|
45
|
-
fix:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
: null
|
|
45
|
+
fix: (div, index, nodes) => fixer({
|
|
46
|
+
div,
|
|
47
|
+
index,
|
|
48
|
+
nodes,
|
|
49
|
+
expectation: primary,
|
|
50
|
+
position: 'after',
|
|
51
|
+
symb: ' '
|
|
52
|
+
})
|
|
55
53
|
});
|
|
56
54
|
};
|
|
57
55
|
};
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ const meta = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
/** @type {import('stylelint').Rule} */
|
|
27
|
-
const rule = (primary, _secondaryOptions
|
|
27
|
+
const rule = (primary, _secondaryOptions) => {
|
|
28
28
|
const checker = whitespaceChecker('space', primary, messages);
|
|
29
29
|
|
|
30
30
|
return (root, result) => {
|
|
@@ -42,16 +42,14 @@ const rule = (primary, _secondaryOptions, context) => {
|
|
|
42
42
|
result,
|
|
43
43
|
locationChecker: checker.before,
|
|
44
44
|
checkedRuleName: ruleName,
|
|
45
|
-
fix:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
: null
|
|
45
|
+
fix: (div, index, nodes) => fixer({
|
|
46
|
+
div,
|
|
47
|
+
index,
|
|
48
|
+
nodes,
|
|
49
|
+
expectation: primary,
|
|
50
|
+
position: 'before',
|
|
51
|
+
symb: ' '
|
|
52
|
+
})
|
|
55
53
|
});
|
|
56
54
|
};
|
|
57
55
|
};
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/index.mjs
CHANGED
|
@@ -31,7 +31,7 @@ function placeIndexOnValueStart (decl) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** @type {import('stylelint').Rule} */
|
|
34
|
-
const rule = (primary, _secondaryOptions
|
|
34
|
+
const rule = (primary, _secondaryOptions) => {
|
|
35
35
|
const maxAdjacentNewlines = primary + 1;
|
|
36
36
|
|
|
37
37
|
return (root, result) => {
|
|
@@ -46,8 +46,8 @@ const rule = (primary, _secondaryOptions, context) => {
|
|
|
46
46
|
|
|
47
47
|
const violatedCRLFNewLinesRegex = new RegExp(`(?:\r\n){${maxAdjacentNewlines + 1},}`);
|
|
48
48
|
const violatedLFNewLinesRegex = new RegExp(`\n{${maxAdjacentNewlines + 1},}`);
|
|
49
|
-
const allowedLFNewLinesString =
|
|
50
|
-
const allowedCRLFNewLinesString =
|
|
49
|
+
const allowedLFNewLinesString = '\n'.repeat(maxAdjacentNewlines);
|
|
50
|
+
const allowedCRLFNewLinesString = '\r\n'.repeat(maxAdjacentNewlines);
|
|
51
51
|
|
|
52
52
|
root.walkDecls((decl) => {
|
|
53
53
|
if (!decl.value.includes('(')) {
|
|
@@ -76,30 +76,28 @@ const rule = (primary, _secondaryOptions, context) => {
|
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
99
|
-
}
|
|
79
|
+
report({
|
|
80
|
+
message: messages.expected(primary),
|
|
81
|
+
node: decl,
|
|
82
|
+
index: placeIndexOnValueStart(decl) + node.sourceIndex,
|
|
83
|
+
endIndex: placeIndexOnValueStart(decl) + node.sourceIndex,
|
|
84
|
+
result,
|
|
85
|
+
ruleName,
|
|
86
|
+
fix: () => {
|
|
87
|
+
const newNodeString = stringifiedNode
|
|
88
|
+
.replace(new RegExp(violatedLFNewLinesRegex, 'gm'), allowedLFNewLinesString)
|
|
89
|
+
.replace(new RegExp(violatedCRLFNewLinesRegex, 'gm'), allowedCRLFNewLinesString);
|
|
90
|
+
|
|
91
|
+
splittedValue.push([
|
|
92
|
+
stringValue.slice(sourceIndexStart, node.sourceIndex),
|
|
93
|
+
newNodeString
|
|
94
|
+
]);
|
|
95
|
+
sourceIndexStart = node.sourceIndex + stringifiedNode.length;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
100
98
|
});
|
|
101
99
|
|
|
102
|
-
if (
|
|
100
|
+
if (splittedValue.length > 0) {
|
|
103
101
|
const updatedValue =
|
|
104
102
|
splittedValue.reduce((accumulator, current) => accumulator + current[0] + current[1], '') +
|
|
105
103
|
stringValue.slice(sourceIndexStart);
|
|
@@ -67,33 +67,48 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
|
|
|
67
67
|
const checkBefore = getCheckBefore(valueNode);
|
|
68
68
|
|
|
69
69
|
if (primary === 'always' && !containsNewline(checkBefore)) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
report({
|
|
71
|
+
ruleName,
|
|
72
|
+
result,
|
|
73
|
+
message: messages.expectedOpening,
|
|
74
|
+
node: decl,
|
|
75
|
+
index: declarationValueIndex(decl) + openingIndex,
|
|
76
|
+
endIndex: declarationValueIndex(decl) + openingIndex,
|
|
77
|
+
fix: () => {
|
|
78
|
+
hasFixed = true;
|
|
79
|
+
fixBeforeForAlways(valueNode, context.newline || '');
|
|
80
|
+
}
|
|
81
|
+
});
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
if (isMultiLine && primary === 'always-multi-line' && !containsNewline(checkBefore)) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
report({
|
|
86
|
+
ruleName,
|
|
87
|
+
result,
|
|
88
|
+
message: messages.expectedOpeningMultiLine,
|
|
89
|
+
node: decl,
|
|
90
|
+
index: declarationValueIndex(decl) + openingIndex,
|
|
91
|
+
endIndex: declarationValueIndex(decl) + openingIndex,
|
|
92
|
+
fix: () => {
|
|
93
|
+
hasFixed = true;
|
|
94
|
+
fixBeforeForAlways(valueNode, context.newline || '');
|
|
95
|
+
}
|
|
96
|
+
});
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
if (isMultiLine && primary === 'never-multi-line' && checkBefore !== '') {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
report({
|
|
101
|
+
ruleName,
|
|
102
|
+
result,
|
|
103
|
+
message: messages.rejectedOpeningMultiLine,
|
|
104
|
+
node: decl,
|
|
105
|
+
index: declarationValueIndex(decl) + openingIndex,
|
|
106
|
+
endIndex: declarationValueIndex(decl) + openingIndex,
|
|
107
|
+
fix: () => {
|
|
108
|
+
hasFixed = true;
|
|
109
|
+
fixBeforeForNever(valueNode);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
97
112
|
}
|
|
98
113
|
|
|
99
114
|
// Check closing ...
|
|
@@ -102,54 +117,54 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
|
|
|
102
117
|
const checkAfter = getCheckAfter(valueNode);
|
|
103
118
|
|
|
104
119
|
if (primary === 'always' && !containsNewline(checkAfter)) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
120
|
+
report({
|
|
121
|
+
ruleName,
|
|
122
|
+
result,
|
|
123
|
+
message: messages.expectedClosing,
|
|
124
|
+
node: decl,
|
|
125
|
+
index: declarationValueIndex(decl) + closingIndex,
|
|
126
|
+
endIndex: declarationValueIndex(decl) + closingIndex,
|
|
127
|
+
fix: () => {
|
|
128
|
+
hasFixed = true;
|
|
129
|
+
fixAfterForAlways(valueNode, context.newline || '');
|
|
130
|
+
}
|
|
131
|
+
});
|
|
112
132
|
}
|
|
113
133
|
|
|
114
134
|
if (isMultiLine && primary === 'always-multi-line' && !containsNewline(checkAfter)) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
135
|
+
report({
|
|
136
|
+
ruleName,
|
|
137
|
+
result,
|
|
138
|
+
message,
|
|
139
|
+
node: decl,
|
|
140
|
+
index: declarationValueIndex(decl) + messages.expectedClosingMultiLine,
|
|
141
|
+
endIndex: declarationValueIndex(decl) + closingIndex,
|
|
142
|
+
fix: () => {
|
|
143
|
+
hasFixed = true;
|
|
144
|
+
fixAfterForAlways(valueNode, context.newline || '');
|
|
145
|
+
}
|
|
146
|
+
});
|
|
122
147
|
}
|
|
123
148
|
|
|
124
149
|
if (isMultiLine && primary === 'never-multi-line' && checkAfter !== '') {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
150
|
+
report({
|
|
151
|
+
ruleName,
|
|
152
|
+
result,
|
|
153
|
+
message: messages.rejectedClosingMultiLine,
|
|
154
|
+
node: decl,
|
|
155
|
+
index: declarationValueIndex(decl) + closingIndex,
|
|
156
|
+
endIndex: declarationValueIndex(decl) + closingIndex,
|
|
157
|
+
fix: () => {
|
|
158
|
+
hasFixed = true;
|
|
159
|
+
fixAfterForNever(valueNode);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
132
162
|
}
|
|
133
163
|
});
|
|
134
164
|
|
|
135
165
|
if (hasFixed) {
|
|
136
166
|
setDeclarationValue(decl, parsedValue.toString());
|
|
137
167
|
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* @param {string} message
|
|
141
|
-
* @param {number} offset
|
|
142
|
-
*/
|
|
143
|
-
function complain (message, offset) {
|
|
144
|
-
report({
|
|
145
|
-
ruleName,
|
|
146
|
-
result,
|
|
147
|
-
message,
|
|
148
|
-
node: decl,
|
|
149
|
-
index: declarationValueIndex(decl) + offset,
|
|
150
|
-
endIndex: declarationValueIndex(decl) + offset
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
168
|
});
|
|
154
169
|
};
|
|
155
170
|
|
|
@@ -31,7 +31,7 @@ const meta = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/** @type {import('stylelint').Rule} */
|
|
34
|
-
const rule = (primary, _secondaryOptions
|
|
34
|
+
const rule = (primary, _secondaryOptions) => (root, result) => {
|
|
35
35
|
const validOptions = validateOptions(result, ruleName, {
|
|
36
36
|
actual: primary,
|
|
37
37
|
possible: ['always', 'never', 'always-single-line', 'never-single-line']
|
|
@@ -72,43 +72,63 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
|
|
|
72
72
|
const openingIndex = valueNode.sourceIndex + valueNode.value.length + 1;
|
|
73
73
|
|
|
74
74
|
if (primary === 'always' && valueNode.before !== ' ') {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
report({
|
|
76
|
+
ruleName,
|
|
77
|
+
result,
|
|
78
|
+
message: messages.expectedOpening,
|
|
79
|
+
node: decl,
|
|
80
|
+
index: declarationValueIndex(decl) + openingIndex,
|
|
81
|
+
endIndex: declarationValueIndex(decl) + openingIndex,
|
|
82
|
+
fix: () => {
|
|
83
|
+
hasFixed = true;
|
|
84
|
+
valueNode.before = ' ';
|
|
85
|
+
}
|
|
86
|
+
});
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
if (primary === 'never' && valueNode.before !== '') {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
report({
|
|
91
|
+
ruleName,
|
|
92
|
+
result,
|
|
93
|
+
message: messages.rejectedOpening,
|
|
94
|
+
node: decl,
|
|
95
|
+
index: declarationValueIndex(decl) + openingIndex,
|
|
96
|
+
endIndex: declarationValueIndex(decl) + openingIndex,
|
|
97
|
+
fix: () => {
|
|
98
|
+
hasFixed = true;
|
|
99
|
+
valueNode.before = '';
|
|
100
|
+
}
|
|
101
|
+
});
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
if (isSingleLine && primary === 'always-single-line' && valueNode.before !== ' ') {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
report({
|
|
106
|
+
ruleName,
|
|
107
|
+
result,
|
|
108
|
+
message: messages.expectedOpeningSingleLine,
|
|
109
|
+
node: decl,
|
|
110
|
+
index: declarationValueIndex(decl) + openingIndex,
|
|
111
|
+
endIndex: declarationValueIndex(decl) + openingIndex,
|
|
112
|
+
fix: () => {
|
|
113
|
+
hasFixed = true;
|
|
114
|
+
valueNode.before = ' ';
|
|
115
|
+
}
|
|
116
|
+
});
|
|
102
117
|
}
|
|
103
118
|
|
|
104
119
|
if (isSingleLine && primary === 'never-single-line' && valueNode.before !== '') {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
120
|
+
report({
|
|
121
|
+
ruleName,
|
|
122
|
+
result,
|
|
123
|
+
message: messages.rejectedOpeningSingleLine,
|
|
124
|
+
node: decl,
|
|
125
|
+
index: declarationValueIndex(decl) + openingIndex,
|
|
126
|
+
endIndex: declarationValueIndex(decl) + openingIndex,
|
|
127
|
+
fix: () => {
|
|
128
|
+
hasFixed = true;
|
|
129
|
+
valueNode.before = '';
|
|
130
|
+
}
|
|
131
|
+
});
|
|
112
132
|
}
|
|
113
133
|
|
|
114
134
|
// Check closing ...
|
|
@@ -116,64 +136,69 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
|
|
|
116
136
|
const closingIndex = valueNode.sourceIndex + functionString.length - 2;
|
|
117
137
|
|
|
118
138
|
if (primary === 'always' && valueNode.after !== ' ') {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
139
|
+
report({
|
|
140
|
+
ruleName,
|
|
141
|
+
result,
|
|
142
|
+
message: messages.expectedClosing,
|
|
143
|
+
node: decl,
|
|
144
|
+
index: declarationValueIndex(decl) + closingIndex,
|
|
145
|
+
endIndex: declarationValueIndex(decl) + closingIndex,
|
|
146
|
+
fix: () => {
|
|
147
|
+
hasFixed = true;
|
|
148
|
+
valueNode.after = ' ';
|
|
149
|
+
}
|
|
150
|
+
});
|
|
126
151
|
}
|
|
127
152
|
|
|
128
153
|
if (primary === 'never' && valueNode.after !== '') {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
154
|
+
report({
|
|
155
|
+
ruleName,
|
|
156
|
+
result,
|
|
157
|
+
message: messages.rejectedClosing,
|
|
158
|
+
node: decl,
|
|
159
|
+
index: declarationValueIndex(decl) + closingIndex,
|
|
160
|
+
endIndex: declarationValueIndex(decl) + closingIndex,
|
|
161
|
+
fix: () => {
|
|
162
|
+
hasFixed = true;
|
|
163
|
+
valueNode.after = '';
|
|
164
|
+
}
|
|
165
|
+
});
|
|
136
166
|
}
|
|
137
167
|
|
|
138
168
|
if (isSingleLine && primary === 'always-single-line' && valueNode.after !== ' ') {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
169
|
+
report({
|
|
170
|
+
ruleName,
|
|
171
|
+
result,
|
|
172
|
+
message: messages.expectedClosingSingleLine,
|
|
173
|
+
node: decl,
|
|
174
|
+
index: declarationValueIndex(decl) + closingIndex,
|
|
175
|
+
endIndex: declarationValueIndex(decl) + closingIndex,
|
|
176
|
+
fix: () => {
|
|
177
|
+
hasFixed = true;
|
|
178
|
+
valueNode.after = ' ';
|
|
179
|
+
}
|
|
180
|
+
});
|
|
146
181
|
}
|
|
147
182
|
|
|
148
183
|
if (isSingleLine && primary === 'never-single-line' && valueNode.after !== '') {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
184
|
+
report({
|
|
185
|
+
ruleName,
|
|
186
|
+
result,
|
|
187
|
+
message: messages.rejectedClosingSingleLine,
|
|
188
|
+
node: decl,
|
|
189
|
+
index: declarationValueIndex(decl) + closingIndex,
|
|
190
|
+
endIndex: declarationValueIndex(decl) + closingIndex,
|
|
191
|
+
fix: () => {
|
|
192
|
+
hasFixed = true;
|
|
193
|
+
valueNode.after = '';
|
|
194
|
+
}
|
|
195
|
+
});
|
|
156
196
|
}
|
|
157
197
|
});
|
|
158
198
|
|
|
159
199
|
if (hasFixed) {
|
|
160
200
|
setDeclarationValue(decl, parsedValue.toString());
|
|
161
201
|
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* @param {string} message
|
|
165
|
-
* @param {number} offset
|
|
166
|
-
*/
|
|
167
|
-
function complain (message, offset) {
|
|
168
|
-
report({
|
|
169
|
-
ruleName,
|
|
170
|
-
result,
|
|
171
|
-
message,
|
|
172
|
-
node: decl,
|
|
173
|
-
index: declarationValueIndex(decl) + offset,
|
|
174
|
-
endIndex: declarationValueIndex(decl) + offset
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
202
|
});
|
|
178
203
|
};
|
|
179
204
|
|
package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/index.mjs
CHANGED
|
@@ -87,35 +87,29 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
|
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
if (fix) {
|
|
91
|
-
fix(index);
|
|
92
|
-
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
90
|
report({
|
|
97
91
|
message: messages.expected,
|
|
98
92
|
node,
|
|
99
93
|
index: nodeIndex + index,
|
|
100
94
|
endIndex: nodeIndex + index,
|
|
101
95
|
result,
|
|
102
|
-
ruleName
|
|
96
|
+
ruleName,
|
|
97
|
+
fix: () => {
|
|
98
|
+
fix(index);
|
|
99
|
+
}
|
|
103
100
|
});
|
|
104
101
|
}
|
|
105
102
|
else if (primary === 'never' && isWhitespace(nextChar)) {
|
|
106
|
-
if (fix) {
|
|
107
|
-
fix(index);
|
|
108
|
-
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
103
|
report({
|
|
113
104
|
message: messages.rejected,
|
|
114
105
|
node,
|
|
115
106
|
index: nodeIndex + index,
|
|
116
107
|
endIndex: nodeIndex + index,
|
|
117
108
|
result,
|
|
118
|
-
ruleName
|
|
109
|
+
ruleName,
|
|
110
|
+
fix: () => {
|
|
111
|
+
fix(index);
|
|
112
|
+
}
|
|
119
113
|
});
|
|
120
114
|
}
|
|
121
115
|
}
|
|
@@ -167,7 +161,7 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
|
|
|
167
161
|
|
|
168
162
|
root.walkAtRules(/^import$/i, (atRule) => {
|
|
169
163
|
const parameter = (atRule.raws.params?.raw) || atRule.params;
|
|
170
|
-
const fixer =
|
|
164
|
+
const fixer = createFixer(parameter);
|
|
171
165
|
|
|
172
166
|
check(atRule, parameter, atRuleParamIndex(atRule), fixer ? fixer.applyFix : undefined);
|
|
173
167
|
|
|
@@ -182,7 +176,7 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
|
|
|
182
176
|
});
|
|
183
177
|
root.walkDecls((decl) => {
|
|
184
178
|
const value = getDeclarationValue(decl);
|
|
185
|
-
const fixer =
|
|
179
|
+
const fixer = createFixer(value);
|
|
186
180
|
|
|
187
181
|
check(decl, value, declarationValueIndex(decl), fixer ? fixer.applyFix : undefined);
|
|
188
182
|
|
|
@@ -97,14 +97,7 @@ export default function functionCommaSpaceChecker (options) {
|
|
|
97
97
|
source: functionArguments,
|
|
98
98
|
index: checkIndex,
|
|
99
99
|
err: (message) => {
|
|
100
|
-
const index =
|
|
101
|
-
declarationValueIndex(decl) + commaNode.sourceIndex + commaNode.before.length;
|
|
102
|
-
|
|
103
|
-
if (options.fix?.(commaNode, nodeIndex, valueNode.nodes)) {
|
|
104
|
-
hasFixed = true;
|
|
105
|
-
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
100
|
+
const index = declarationValueIndex(decl) + commaNode.sourceIndex + commaNode.before.length;
|
|
108
101
|
|
|
109
102
|
report({
|
|
110
103
|
index,
|
|
@@ -112,7 +105,12 @@ export default function functionCommaSpaceChecker (options) {
|
|
|
112
105
|
message,
|
|
113
106
|
node: decl,
|
|
114
107
|
result: options.result,
|
|
115
|
-
ruleName: options.checkedRuleName
|
|
108
|
+
ruleName: options.checkedRuleName,
|
|
109
|
+
fix: (options.fix ? () => {
|
|
110
|
+
if (options.fix(commaNode, nodeIndex, valueNode.nodes)) {
|
|
111
|
+
hasFixed = true;
|
|
112
|
+
}
|
|
113
|
+
} : undefined)
|
|
116
114
|
});
|
|
117
115
|
}
|
|
118
116
|
});
|