stylelint-config-silverwind 35.0.3 → 35.0.4
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/dist/index.js +601 -1684
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -9152,10 +9152,6 @@ ruleFunction.meta = meta$1d;
|
|
|
9152
9152
|
const valueNoUnknownCustomProperties = stylelint.createPlugin(ruleName$1d, ruleFunction);
|
|
9153
9153
|
const isMethodEnabled = (method) => method === true;
|
|
9154
9154
|
const isMethodDisabled = (method) => method === null || method === false;
|
|
9155
|
-
let namespace$1 = `@stylistic`;
|
|
9156
|
-
function addNamespace(ruleName2) {
|
|
9157
|
-
return `${namespace$1}/${ruleName2}`;
|
|
9158
|
-
}
|
|
9159
9155
|
const rules = {
|
|
9160
9156
|
get "at-rule-name-case"() {
|
|
9161
9157
|
return Promise.resolve().then(() => index$1c).then((m2) => m2.default);
|
|
@@ -9389,6 +9385,10 @@ const rules = {
|
|
|
9389
9385
|
return Promise.resolve().then(() => index).then((m2) => m2.default);
|
|
9390
9386
|
}
|
|
9391
9387
|
};
|
|
9388
|
+
let namespace$1 = `@stylistic`;
|
|
9389
|
+
function addNamespace(ruleName2) {
|
|
9390
|
+
return `${namespace$1}/${ruleName2}`;
|
|
9391
|
+
}
|
|
9392
9392
|
let rulesPlugins = Object.keys(rules).map((name) => stylelint.createPlugin(addNamespace(name), rules[name]));
|
|
9393
9393
|
var lib$6 = {};
|
|
9394
9394
|
var Parser = {};
|
|
@@ -14523,15 +14523,9 @@ function getRuleDocUrl(shortName2) {
|
|
|
14523
14523
|
return `https://github.com/stylelint-stylistic/stylelint-stylistic/blob/main/lib/rules/${shortName2}/README.md`;
|
|
14524
14524
|
}
|
|
14525
14525
|
function isStandardSyntaxAtRule(atRule2) {
|
|
14526
|
-
if (!atRule2.nodes && atRule2.params === ``)
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
if (`mixin` in atRule2 && atRule2.mixin) {
|
|
14530
|
-
return false;
|
|
14531
|
-
}
|
|
14532
|
-
if (`variable` in atRule2 && atRule2.variable || !atRule2.nodes && atRule2.raws.afterName === `` && atRule2.params[0] === `(`) {
|
|
14533
|
-
return false;
|
|
14534
|
-
}
|
|
14526
|
+
if (!atRule2.nodes && atRule2.params === ``) return false;
|
|
14527
|
+
if (`mixin` in atRule2 && atRule2.mixin) return false;
|
|
14528
|
+
if (`variable` in atRule2 && atRule2.variable || !atRule2.nodes && atRule2.raws.afterName === `` && atRule2.params[0] === `(`) return false;
|
|
14535
14529
|
return true;
|
|
14536
14530
|
}
|
|
14537
14531
|
let { utils: { report: report$X, ruleMessages: ruleMessages$1c, validateOptions: validateOptions$1c } } = stylelint;
|
|
@@ -14550,19 +14544,13 @@ function rule$1c(primary) {
|
|
|
14550
14544
|
actual: primary,
|
|
14551
14545
|
possible: [`lower`, `upper`]
|
|
14552
14546
|
});
|
|
14553
|
-
if (!validOptions)
|
|
14554
|
-
return;
|
|
14555
|
-
}
|
|
14547
|
+
if (!validOptions) return;
|
|
14556
14548
|
let expectation = primary;
|
|
14557
14549
|
root2.walkAtRules((atRule2) => {
|
|
14558
|
-
if (!isStandardSyntaxAtRule(atRule2))
|
|
14559
|
-
return;
|
|
14560
|
-
}
|
|
14550
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14561
14551
|
let name = atRule2.name;
|
|
14562
14552
|
let expectedName = expectation === `lower` ? name.toLowerCase() : name.toUpperCase();
|
|
14563
|
-
if (name === expectedName)
|
|
14564
|
-
return;
|
|
14565
|
-
}
|
|
14553
|
+
if (name === expectedName) return;
|
|
14566
14554
|
report$X({
|
|
14567
14555
|
message: messages$1c.expected,
|
|
14568
14556
|
messageArgs: [name, expectedName],
|
|
@@ -14589,9 +14577,7 @@ const index$1c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
|
14589
14577
|
let { utils: { report: report$W } } = stylelint;
|
|
14590
14578
|
function atRuleNameSpaceChecker(options) {
|
|
14591
14579
|
options.root.walkAtRules((atRule2) => {
|
|
14592
|
-
if (!isStandardSyntaxAtRule(atRule2))
|
|
14593
|
-
return;
|
|
14594
|
-
}
|
|
14580
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14595
14581
|
checkColon(
|
|
14596
14582
|
`@${atRule2.name}${atRule2.raws.afterName || ``}${atRule2.params}`,
|
|
14597
14583
|
atRule2.name.length,
|
|
@@ -14655,11 +14641,8 @@ function isString(value) {
|
|
|
14655
14641
|
return typeof value === `string` || value instanceof String;
|
|
14656
14642
|
}
|
|
14657
14643
|
function assert(value, message = void 0) {
|
|
14658
|
-
if (message)
|
|
14659
|
-
|
|
14660
|
-
} else {
|
|
14661
|
-
console.assert(value);
|
|
14662
|
-
}
|
|
14644
|
+
if (message) console.assert(value, message);
|
|
14645
|
+
else console.assert(value);
|
|
14663
14646
|
}
|
|
14664
14647
|
function assertFunction(value) {
|
|
14665
14648
|
console.assert(isFunction(value), `"${value}" must be a function`);
|
|
@@ -14694,27 +14677,19 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14694
14677
|
rejectBefore();
|
|
14695
14678
|
break;
|
|
14696
14679
|
case `always-single-line`:
|
|
14697
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14698
|
-
return;
|
|
14699
|
-
}
|
|
14680
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14700
14681
|
expectBefore(messages2.expectedBeforeSingleLine);
|
|
14701
14682
|
break;
|
|
14702
14683
|
case `never-single-line`:
|
|
14703
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14704
|
-
return;
|
|
14705
|
-
}
|
|
14684
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14706
14685
|
rejectBefore(messages2.rejectedBeforeSingleLine);
|
|
14707
14686
|
break;
|
|
14708
14687
|
case `always-multi-line`:
|
|
14709
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14710
|
-
return;
|
|
14711
|
-
}
|
|
14688
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14712
14689
|
expectBefore(messages2.expectedBeforeMultiLine);
|
|
14713
14690
|
break;
|
|
14714
14691
|
case `never-multi-line`:
|
|
14715
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14716
|
-
return;
|
|
14717
|
-
}
|
|
14692
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14718
14693
|
rejectBefore(messages2.rejectedBeforeMultiLine);
|
|
14719
14694
|
break;
|
|
14720
14695
|
default:
|
|
@@ -14731,27 +14706,19 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14731
14706
|
rejectAfter();
|
|
14732
14707
|
break;
|
|
14733
14708
|
case `always-single-line`:
|
|
14734
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14735
|
-
return;
|
|
14736
|
-
}
|
|
14709
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14737
14710
|
expectAfter(messages2.expectedAfterSingleLine);
|
|
14738
14711
|
break;
|
|
14739
14712
|
case `never-single-line`:
|
|
14740
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14741
|
-
return;
|
|
14742
|
-
}
|
|
14713
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14743
14714
|
rejectAfter(messages2.rejectedAfterSingleLine);
|
|
14744
14715
|
break;
|
|
14745
14716
|
case `always-multi-line`:
|
|
14746
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14747
|
-
return;
|
|
14748
|
-
}
|
|
14717
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14749
14718
|
expectAfter(messages2.expectedAfterMultiLine);
|
|
14750
14719
|
break;
|
|
14751
14720
|
case `never-multi-line`:
|
|
14752
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14753
|
-
return;
|
|
14754
|
-
}
|
|
14721
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14755
14722
|
rejectAfter(messages2.rejectedAfterMultiLine);
|
|
14756
14723
|
break;
|
|
14757
14724
|
default:
|
|
@@ -14771,12 +14738,8 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14771
14738
|
let index2 = _activeArgs.index;
|
|
14772
14739
|
let oneCharBefore = source[index2 - 1];
|
|
14773
14740
|
let twoCharsBefore = source[index2 - 2];
|
|
14774
|
-
if (isNullish(oneCharBefore))
|
|
14775
|
-
|
|
14776
|
-
}
|
|
14777
|
-
if (targetWhitespace === `space` && oneCharBefore === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsBefore) || !isWhitespace$1(twoCharsBefore))) {
|
|
14778
|
-
return;
|
|
14779
|
-
}
|
|
14741
|
+
if (isNullish(oneCharBefore)) return;
|
|
14742
|
+
if (targetWhitespace === `space` && oneCharBefore === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsBefore) || !isWhitespace$1(twoCharsBefore))) return;
|
|
14780
14743
|
assertFunction(messageFunc);
|
|
14781
14744
|
activeArgs.err(messageFunc(activeArgs.errTarget || source.charAt(index2)));
|
|
14782
14745
|
}
|
|
@@ -14818,22 +14781,14 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14818
14781
|
let oneCharAfter = source[index2 + 1];
|
|
14819
14782
|
let twoCharsAfter = source[index2 + 2];
|
|
14820
14783
|
let threeCharsAfter = source[index2 + 3];
|
|
14821
|
-
if (isNullish(oneCharAfter))
|
|
14822
|
-
return;
|
|
14823
|
-
}
|
|
14784
|
+
if (isNullish(oneCharAfter)) return;
|
|
14824
14785
|
if (targetWhitespace === `newline`) {
|
|
14825
14786
|
if (oneCharAfter === `\r` && twoCharsAfter === `
|
|
14826
|
-
` && (activeArgs.onlyOneChar || isNullish(threeCharsAfter) || !isWhitespace$1(threeCharsAfter)))
|
|
14827
|
-
return;
|
|
14828
|
-
}
|
|
14787
|
+
` && (activeArgs.onlyOneChar || isNullish(threeCharsAfter) || !isWhitespace$1(threeCharsAfter))) return;
|
|
14829
14788
|
if (oneCharAfter === `
|
|
14830
|
-
` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter)))
|
|
14831
|
-
return;
|
|
14832
|
-
}
|
|
14833
|
-
}
|
|
14834
|
-
if (targetWhitespace === `space` && oneCharAfter === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter))) {
|
|
14835
|
-
return;
|
|
14789
|
+
` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter))) return;
|
|
14836
14790
|
}
|
|
14791
|
+
if (targetWhitespace === `space` && oneCharAfter === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter))) return;
|
|
14837
14792
|
assertFunction(messageFunc);
|
|
14838
14793
|
activeArgs.err(messageFunc(activeArgs.errTarget || source.charAt(index2)));
|
|
14839
14794
|
}
|
|
@@ -14870,9 +14825,7 @@ function rule$1b(primary) {
|
|
|
14870
14825
|
actual: primary,
|
|
14871
14826
|
possible: [`always`, `always-multi-line`]
|
|
14872
14827
|
});
|
|
14873
|
-
if (!validOptions)
|
|
14874
|
-
return;
|
|
14875
|
-
}
|
|
14828
|
+
if (!validOptions) return;
|
|
14876
14829
|
atRuleNameSpaceChecker({
|
|
14877
14830
|
root: root2,
|
|
14878
14831
|
result: result2,
|
|
@@ -14908,18 +14861,14 @@ function rule$1a(primary) {
|
|
|
14908
14861
|
actual: primary,
|
|
14909
14862
|
possible: [`always`, `always-single-line`]
|
|
14910
14863
|
});
|
|
14911
|
-
if (!validOptions)
|
|
14912
|
-
return;
|
|
14913
|
-
}
|
|
14864
|
+
if (!validOptions) return;
|
|
14914
14865
|
atRuleNameSpaceChecker({
|
|
14915
14866
|
root: root2,
|
|
14916
14867
|
result: result2,
|
|
14917
14868
|
locationChecker: checker.after,
|
|
14918
14869
|
checkedRuleName: ruleName$1a,
|
|
14919
14870
|
fix: (atRule2) => {
|
|
14920
|
-
if (typeof atRule2.raws.afterName === `string`)
|
|
14921
|
-
atRule2.raws.afterName = atRule2.raws.afterName.replace(/^\s*/, ` `);
|
|
14922
|
-
}
|
|
14871
|
+
if (typeof atRule2.raws.afterName === `string`) atRule2.raws.afterName = atRule2.raws.afterName.replace(/^\s*/, ` `);
|
|
14923
14872
|
}
|
|
14924
14873
|
});
|
|
14925
14874
|
};
|
|
@@ -14938,19 +14887,13 @@ function hasBlock(statement) {
|
|
|
14938
14887
|
return statement.nodes !== void 0;
|
|
14939
14888
|
}
|
|
14940
14889
|
function nextNonCommentNode(startNode) {
|
|
14941
|
-
if (!startNode || !startNode.next)
|
|
14942
|
-
|
|
14943
|
-
}
|
|
14944
|
-
if (startNode.type === `comment`) {
|
|
14945
|
-
return nextNonCommentNode(startNode.next());
|
|
14946
|
-
}
|
|
14890
|
+
if (!startNode || !startNode.next) return null;
|
|
14891
|
+
if (startNode.type === `comment`) return nextNonCommentNode(startNode.next());
|
|
14947
14892
|
return startNode;
|
|
14948
14893
|
}
|
|
14949
14894
|
function rawNodeString(node2) {
|
|
14950
14895
|
let result2 = ``;
|
|
14951
|
-
if (node2.raws.before)
|
|
14952
|
-
result2 += node2.raws.before;
|
|
14953
|
-
}
|
|
14896
|
+
if (node2.raws.before) result2 += node2.raws.before;
|
|
14954
14897
|
result2 += node2.toString();
|
|
14955
14898
|
return result2;
|
|
14956
14899
|
}
|
|
@@ -14971,24 +14914,14 @@ function rule$19(primary, _secondary, context) {
|
|
|
14971
14914
|
actual: primary,
|
|
14972
14915
|
possible: [`always`]
|
|
14973
14916
|
});
|
|
14974
|
-
if (!validOptions)
|
|
14975
|
-
return;
|
|
14976
|
-
}
|
|
14917
|
+
if (!validOptions) return;
|
|
14977
14918
|
root2.walkAtRules((atRule2) => {
|
|
14978
14919
|
let nextNode = atRule2.next();
|
|
14979
|
-
if (!nextNode)
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
if (hasBlock(atRule2)) {
|
|
14983
|
-
return;
|
|
14984
|
-
}
|
|
14985
|
-
if (!isStandardSyntaxAtRule(atRule2)) {
|
|
14986
|
-
return;
|
|
14987
|
-
}
|
|
14920
|
+
if (!nextNode) return;
|
|
14921
|
+
if (hasBlock(atRule2)) return;
|
|
14922
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14988
14923
|
let nodeToCheck = nextNonCommentNode(nextNode);
|
|
14989
|
-
if (!nodeToCheck)
|
|
14990
|
-
return;
|
|
14991
|
-
}
|
|
14924
|
+
if (!nodeToCheck) return;
|
|
14992
14925
|
const problemIndex = atRule2.toString().length + 1;
|
|
14993
14926
|
checker.afterOneOnly({
|
|
14994
14927
|
source: rawNodeString(nodeToCheck),
|
|
@@ -15037,16 +14970,10 @@ function rule$18(primary) {
|
|
|
15037
14970
|
actual: primary,
|
|
15038
14971
|
possible: [`always`, `never`]
|
|
15039
14972
|
});
|
|
15040
|
-
if (!validOptions)
|
|
15041
|
-
return;
|
|
15042
|
-
}
|
|
14973
|
+
if (!validOptions) return;
|
|
15043
14974
|
root2.walkAtRules((atRule2) => {
|
|
15044
|
-
if (hasBlock(atRule2))
|
|
15045
|
-
|
|
15046
|
-
}
|
|
15047
|
-
if (!isStandardSyntaxAtRule(atRule2)) {
|
|
15048
|
-
return;
|
|
15049
|
-
}
|
|
14975
|
+
if (hasBlock(atRule2)) return;
|
|
14976
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
15050
14977
|
const nodeString = rawNodeString(atRule2);
|
|
15051
14978
|
const problemIndex = nodeString.length - 1;
|
|
15052
14979
|
checker.before({
|
|
@@ -15078,16 +15005,11 @@ const index$18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
|
15078
15005
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
15079
15006
|
function addEmptyLineAfter(node2, newline) {
|
|
15080
15007
|
let { raws } = node2;
|
|
15081
|
-
if (typeof raws.after !== `string`)
|
|
15082
|
-
return node2;
|
|
15083
|
-
}
|
|
15008
|
+
if (typeof raws.after !== `string`) return node2;
|
|
15084
15009
|
let spaces = raws.after.split(`;`);
|
|
15085
15010
|
let after = spaces[spaces.length - 1] || ``;
|
|
15086
|
-
if (!/\r?\n/.test(after))
|
|
15087
|
-
|
|
15088
|
-
} else {
|
|
15089
|
-
raws.after = raws.after.replace(/(\r?\n)/, `${newline}$1`);
|
|
15090
|
-
}
|
|
15011
|
+
if (!/\r?\n/.test(after)) raws.after += newline.repeat(2);
|
|
15012
|
+
else raws.after = raws.after.replace(/(\r?\n)/, `${newline}$1`);
|
|
15091
15013
|
return node2;
|
|
15092
15014
|
}
|
|
15093
15015
|
function isRoot(node2) {
|
|
@@ -15108,23 +15030,15 @@ function isDeclaration(node2) {
|
|
|
15108
15030
|
function beforeBlockString(statement, { noRawBefore } = { noRawBefore: false }) {
|
|
15109
15031
|
let result2 = ``;
|
|
15110
15032
|
let before = statement.raws.before || ``;
|
|
15111
|
-
if (!noRawBefore)
|
|
15112
|
-
|
|
15113
|
-
}
|
|
15114
|
-
|
|
15115
|
-
result2 += statement.selector;
|
|
15116
|
-
} else if (isAtRule(statement)) {
|
|
15117
|
-
result2 += `@${statement.name}${statement.raws.afterName || ``}${statement.params}`;
|
|
15118
|
-
} else {
|
|
15119
|
-
return ``;
|
|
15120
|
-
}
|
|
15033
|
+
if (!noRawBefore) result2 += before;
|
|
15034
|
+
if (isRule(statement)) result2 += statement.selector;
|
|
15035
|
+
else if (isAtRule(statement)) result2 += `@${statement.name}${statement.raws.afterName || ``}${statement.params}`;
|
|
15036
|
+
else return ``;
|
|
15121
15037
|
result2 += statement.raws.between || ``;
|
|
15122
15038
|
return result2;
|
|
15123
15039
|
}
|
|
15124
15040
|
function blockString(statement) {
|
|
15125
|
-
if (!hasBlock(statement))
|
|
15126
|
-
return ``;
|
|
15127
|
-
}
|
|
15041
|
+
if (!hasBlock(statement)) return ``;
|
|
15128
15042
|
return rawNodeString(statement).slice(beforeBlockString(statement).length);
|
|
15129
15043
|
}
|
|
15130
15044
|
function hasEmptyBlock(statement) {
|
|
@@ -15132,32 +15046,22 @@ function hasEmptyBlock(statement) {
|
|
|
15132
15046
|
}
|
|
15133
15047
|
const HAS_EMPTY_LINE = /\n[\r\t ]*\n/;
|
|
15134
15048
|
function hasEmptyLine(string2) {
|
|
15135
|
-
if (string2 === `` || string2 === void 0)
|
|
15136
|
-
return false;
|
|
15137
|
-
}
|
|
15049
|
+
if (string2 === `` || string2 === void 0) return false;
|
|
15138
15050
|
return HAS_EMPTY_LINE.test(string2);
|
|
15139
15051
|
}
|
|
15140
15052
|
function matchesStringOrRegExp(input2, comparison) {
|
|
15141
|
-
if (!Array.isArray(input2))
|
|
15142
|
-
return testAgainstStringOrRegExpOrArray(input2, comparison);
|
|
15143
|
-
}
|
|
15053
|
+
if (!Array.isArray(input2)) return testAgainstStringOrRegExpOrArray(input2, comparison);
|
|
15144
15054
|
for (let inputItem of input2) {
|
|
15145
15055
|
let testResult = testAgainstStringOrRegExpOrArray(inputItem, comparison);
|
|
15146
|
-
if (testResult)
|
|
15147
|
-
return testResult;
|
|
15148
|
-
}
|
|
15056
|
+
if (testResult) return testResult;
|
|
15149
15057
|
}
|
|
15150
15058
|
return false;
|
|
15151
15059
|
}
|
|
15152
15060
|
function testAgainstStringOrRegExpOrArray(value, comparison) {
|
|
15153
|
-
if (!Array.isArray(comparison))
|
|
15154
|
-
return testAgainstStringOrRegExp(value, comparison);
|
|
15155
|
-
}
|
|
15061
|
+
if (!Array.isArray(comparison)) return testAgainstStringOrRegExp(value, comparison);
|
|
15156
15062
|
for (let comparisonItem of comparison) {
|
|
15157
15063
|
let testResult = testAgainstStringOrRegExp(value, comparisonItem);
|
|
15158
|
-
if (testResult)
|
|
15159
|
-
return testResult;
|
|
15160
|
-
}
|
|
15064
|
+
if (testResult) return testResult;
|
|
15161
15065
|
}
|
|
15162
15066
|
return false;
|
|
15163
15067
|
}
|
|
@@ -15212,32 +15116,22 @@ function rule$17(primary, secondaryOptions, context) {
|
|
|
15212
15116
|
optional: true
|
|
15213
15117
|
}
|
|
15214
15118
|
);
|
|
15215
|
-
if (!validOptions)
|
|
15216
|
-
return;
|
|
15217
|
-
}
|
|
15119
|
+
if (!validOptions) return;
|
|
15218
15120
|
root2.walkRules(check);
|
|
15219
15121
|
root2.walkAtRules(check);
|
|
15220
15122
|
function check(statement) {
|
|
15221
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15222
|
-
return;
|
|
15223
|
-
}
|
|
15123
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15224
15124
|
let before = (statement.raws.after || ``).replace(/;+/, ``);
|
|
15225
15125
|
let statementString = statement.toString();
|
|
15226
15126
|
let index2 = statementString.length - 1;
|
|
15227
|
-
if (statementString[index2 - 1] === `\r`)
|
|
15228
|
-
index2 -= 1;
|
|
15229
|
-
}
|
|
15127
|
+
if (statementString[index2 - 1] === `\r`) index2 -= 1;
|
|
15230
15128
|
let expectEmptyLineBefore = (() => {
|
|
15231
15129
|
let childNodeTypes = statement.nodes.map((item) => item.type);
|
|
15232
|
-
if (optionsMatches(secondaryOptions, `except`, `after-closing-brace`) && !childNodeTypes.includes(`decl`))
|
|
15233
|
-
return primary === `never`;
|
|
15234
|
-
}
|
|
15130
|
+
if (optionsMatches(secondaryOptions, `except`, `after-closing-brace`) && !childNodeTypes.includes(`decl`)) return primary === `never`;
|
|
15235
15131
|
return primary === `always-multi-line` && !isSingleLineString(blockString(statement));
|
|
15236
15132
|
})();
|
|
15237
15133
|
let hasEmptyLineBefore = hasEmptyLine(before);
|
|
15238
|
-
if (expectEmptyLineBefore === hasEmptyLineBefore)
|
|
15239
|
-
return;
|
|
15240
|
-
}
|
|
15134
|
+
if (expectEmptyLineBefore === hasEmptyLineBefore) return;
|
|
15241
15135
|
let message = expectEmptyLineBefore ? messages$17.expected : messages$17.rejected;
|
|
15242
15136
|
report$T({
|
|
15243
15137
|
message,
|
|
@@ -15249,11 +15143,8 @@ function rule$17(primary, secondaryOptions, context) {
|
|
|
15249
15143
|
fix() {
|
|
15250
15144
|
let { newline } = context;
|
|
15251
15145
|
if (typeof newline !== `string`) return;
|
|
15252
|
-
if (expectEmptyLineBefore)
|
|
15253
|
-
|
|
15254
|
-
} else {
|
|
15255
|
-
removeEmptyLinesAfter(statement, newline);
|
|
15256
|
-
}
|
|
15146
|
+
if (expectEmptyLineBefore) addEmptyLineAfter(statement, newline);
|
|
15147
|
+
else removeEmptyLinesAfter(statement, newline);
|
|
15257
15148
|
}
|
|
15258
15149
|
});
|
|
15259
15150
|
}
|
|
@@ -15307,28 +15198,18 @@ function rule$16(primary, secondaryOptions, context) {
|
|
|
15307
15198
|
optional: true
|
|
15308
15199
|
}
|
|
15309
15200
|
);
|
|
15310
|
-
if (!validOptions)
|
|
15311
|
-
return;
|
|
15312
|
-
}
|
|
15201
|
+
if (!validOptions) return;
|
|
15313
15202
|
root2.walkRules(check);
|
|
15314
15203
|
root2.walkAtRules(check);
|
|
15315
15204
|
function check(statement) {
|
|
15316
|
-
if (!hasBlock(statement))
|
|
15317
|
-
|
|
15318
|
-
}
|
|
15319
|
-
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) {
|
|
15320
|
-
return;
|
|
15321
|
-
}
|
|
15205
|
+
if (!hasBlock(statement)) return;
|
|
15206
|
+
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) return;
|
|
15322
15207
|
let nextNode = statement.next();
|
|
15323
|
-
if (!nextNode)
|
|
15324
|
-
return;
|
|
15325
|
-
}
|
|
15208
|
+
if (!nextNode) return;
|
|
15326
15209
|
let nextNodeIsSingleLineComment = nextNode.type === `comment` && !/[^ ]/.test(nextNode.raws.before || ``) && !nextNode.toString().includes(`
|
|
15327
15210
|
`);
|
|
15328
15211
|
let nodeToCheck = nextNodeIsSingleLineComment ? nextNode.next() : nextNode;
|
|
15329
|
-
if (!nodeToCheck)
|
|
15330
|
-
return;
|
|
15331
|
-
}
|
|
15212
|
+
if (!nodeToCheck) return;
|
|
15332
15213
|
let reportIndex = statement.toString().length;
|
|
15333
15214
|
let source = rawNodeString(nodeToCheck);
|
|
15334
15215
|
if (source && source.startsWith(`;`)) {
|
|
@@ -15353,9 +15234,7 @@ function rule$16(primary, secondaryOptions, context) {
|
|
|
15353
15234
|
if (primary.startsWith(`always`)) {
|
|
15354
15235
|
let index2 = nodeToCheckRaws.before.search(/\r?\n/);
|
|
15355
15236
|
nodeToCheckRaws.before = index2 >= 0 ? nodeToCheckRaws.before.slice(index2) : context.newline + nodeToCheckRaws.before;
|
|
15356
|
-
} else if (primary.startsWith(`never`))
|
|
15357
|
-
nodeToCheckRaws.before = ``;
|
|
15358
|
-
}
|
|
15237
|
+
} else if (primary.startsWith(`never`)) nodeToCheckRaws.before = ``;
|
|
15359
15238
|
}
|
|
15360
15239
|
});
|
|
15361
15240
|
}
|
|
@@ -15391,37 +15270,24 @@ function rule$15(primary, _secondaryOptions, context) {
|
|
|
15391
15270
|
actual: primary,
|
|
15392
15271
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
15393
15272
|
});
|
|
15394
|
-
if (!validOptions)
|
|
15395
|
-
return;
|
|
15396
|
-
}
|
|
15273
|
+
if (!validOptions) return;
|
|
15397
15274
|
root2.walkRules(check);
|
|
15398
15275
|
root2.walkAtRules(check);
|
|
15399
15276
|
function check(statement) {
|
|
15400
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15401
|
-
return;
|
|
15402
|
-
}
|
|
15277
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15403
15278
|
let after = (statement.raws.after || ``).replace(/;+/, ``);
|
|
15404
|
-
if (after === void 0)
|
|
15405
|
-
return;
|
|
15406
|
-
}
|
|
15279
|
+
if (after === void 0) return;
|
|
15407
15280
|
let blockIsMultiLine = !isSingleLineString(blockString(statement));
|
|
15408
15281
|
let statementString = statement.toString();
|
|
15409
15282
|
let index2 = statementString.length - 2;
|
|
15410
|
-
if (statementString[index2 - 1] === `\r`)
|
|
15411
|
-
index2 -= 1;
|
|
15412
|
-
}
|
|
15283
|
+
if (statementString[index2 - 1] === `\r`) index2 -= 1;
|
|
15413
15284
|
if (!after.startsWith(`
|
|
15414
15285
|
`) && !after.startsWith(`\r
|
|
15415
15286
|
`)) {
|
|
15416
|
-
if (primary === `always`)
|
|
15417
|
-
|
|
15418
|
-
} else if (blockIsMultiLine && primary === `always-multi-line`) {
|
|
15419
|
-
complain(messages$15.expectedBeforeMultiLine);
|
|
15420
|
-
}
|
|
15421
|
-
}
|
|
15422
|
-
if (after !== `` && blockIsMultiLine && primary === `never-multi-line`) {
|
|
15423
|
-
complain(messages$15.rejectedBeforeMultiLine);
|
|
15287
|
+
if (primary === `always`) complain(messages$15.expectedBefore);
|
|
15288
|
+
else if (blockIsMultiLine && primary === `always-multi-line`) complain(messages$15.expectedBeforeMultiLine);
|
|
15424
15289
|
}
|
|
15290
|
+
if (after !== `` && blockIsMultiLine && primary === `never-multi-line`) complain(messages$15.rejectedBeforeMultiLine);
|
|
15425
15291
|
function complain(message) {
|
|
15426
15292
|
report$R({
|
|
15427
15293
|
message,
|
|
@@ -15439,9 +15305,7 @@ function rule$15(primary, _secondaryOptions, context) {
|
|
|
15439
15305
|
let newlineAfter = firstWhitespaceIndex >= 0 ? statementRaws.after.slice(firstWhitespaceIndex) : ``;
|
|
15440
15306
|
let newlineIndex = newlineAfter.search(/\r?\n/);
|
|
15441
15307
|
statementRaws.after = newlineIndex >= 0 ? newlineBefore + newlineAfter.slice(newlineIndex) : newlineBefore + context.newline + newlineAfter;
|
|
15442
|
-
} else if (primary === `never-multi-line`)
|
|
15443
|
-
statementRaws.after = statementRaws.after.replace(/\s/g, ``);
|
|
15444
|
-
}
|
|
15308
|
+
} else if (primary === `never-multi-line`) statementRaws.after = statementRaws.after.replace(/\s/g, ``);
|
|
15445
15309
|
}
|
|
15446
15310
|
});
|
|
15447
15311
|
}
|
|
@@ -15486,19 +15350,13 @@ function rule$14(primary) {
|
|
|
15486
15350
|
`never-multi-line`
|
|
15487
15351
|
]
|
|
15488
15352
|
});
|
|
15489
|
-
if (!validOptions)
|
|
15490
|
-
return;
|
|
15491
|
-
}
|
|
15353
|
+
if (!validOptions) return;
|
|
15492
15354
|
root2.walkRules(check);
|
|
15493
15355
|
root2.walkAtRules(check);
|
|
15494
15356
|
function check(statement) {
|
|
15495
15357
|
let nextNode = statement.next();
|
|
15496
|
-
if (!nextNode)
|
|
15497
|
-
|
|
15498
|
-
}
|
|
15499
|
-
if (!hasBlock(statement)) {
|
|
15500
|
-
return;
|
|
15501
|
-
}
|
|
15358
|
+
if (!nextNode) return;
|
|
15359
|
+
if (!hasBlock(statement)) return;
|
|
15502
15360
|
let reportIndex = statement.toString().length;
|
|
15503
15361
|
let source = rawNodeString(nextNode);
|
|
15504
15362
|
if (source && source.startsWith(`;`)) {
|
|
@@ -15562,21 +15420,15 @@ function rule$13(primary) {
|
|
|
15562
15420
|
`never-multi-line`
|
|
15563
15421
|
]
|
|
15564
15422
|
});
|
|
15565
|
-
if (!validOptions)
|
|
15566
|
-
return;
|
|
15567
|
-
}
|
|
15423
|
+
if (!validOptions) return;
|
|
15568
15424
|
root2.walkRules(check);
|
|
15569
15425
|
root2.walkAtRules(check);
|
|
15570
15426
|
function check(statement) {
|
|
15571
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15572
|
-
return;
|
|
15573
|
-
}
|
|
15427
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15574
15428
|
let source = blockString(statement);
|
|
15575
15429
|
let statementString = statement.toString();
|
|
15576
15430
|
let index2 = statementString.length - 2;
|
|
15577
|
-
if (statementString[index2 - 1] === `\r`)
|
|
15578
|
-
index2 -= 1;
|
|
15579
|
-
}
|
|
15431
|
+
if (statementString[index2 - 1] === `\r`) index2 -= 1;
|
|
15580
15432
|
checker.before({
|
|
15581
15433
|
source,
|
|
15582
15434
|
index: source.length - 1,
|
|
@@ -15591,11 +15443,8 @@ function rule$13(primary) {
|
|
|
15591
15443
|
fix() {
|
|
15592
15444
|
let statementRaws = statement.raws;
|
|
15593
15445
|
if (typeof statementRaws.after !== `string`) return;
|
|
15594
|
-
if (primary.startsWith(`always`))
|
|
15595
|
-
|
|
15596
|
-
} else if (primary.startsWith(`never`)) {
|
|
15597
|
-
statementRaws.after = statementRaws.after.replace(/\s*$/, ``);
|
|
15598
|
-
}
|
|
15446
|
+
if (primary.startsWith(`always`)) statementRaws.after = statementRaws.after.replace(/\s*$/, ` `);
|
|
15447
|
+
else if (primary.startsWith(`never`)) statementRaws.after = statementRaws.after.replace(/\s*$/, ``);
|
|
15599
15448
|
}
|
|
15600
15449
|
});
|
|
15601
15450
|
}
|
|
@@ -15643,22 +15492,14 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15643
15492
|
optional: true
|
|
15644
15493
|
}
|
|
15645
15494
|
);
|
|
15646
|
-
if (!validOptions)
|
|
15647
|
-
|
|
15648
|
-
}
|
|
15649
|
-
if (!optionsMatches(secondaryOptions, `ignore`, `rules`)) {
|
|
15650
|
-
root2.walkRules(check);
|
|
15651
|
-
}
|
|
15495
|
+
if (!validOptions) return;
|
|
15496
|
+
if (!optionsMatches(secondaryOptions, `ignore`, `rules`)) root2.walkRules(check);
|
|
15652
15497
|
root2.walkAtRules(check);
|
|
15653
15498
|
function check(statement) {
|
|
15654
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15655
|
-
return;
|
|
15656
|
-
}
|
|
15499
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15657
15500
|
let backupCommentNextBefores = /* @__PURE__ */ new Map();
|
|
15658
15501
|
function nextNode(startNode) {
|
|
15659
|
-
if (!startNode || !startNode.next)
|
|
15660
|
-
return;
|
|
15661
|
-
}
|
|
15502
|
+
if (!startNode || !startNode.next) return;
|
|
15662
15503
|
if (startNode.type === `comment`) {
|
|
15663
15504
|
let reNewLine = /\r?\n/;
|
|
15664
15505
|
let newLineMatch = reNewLine.test(startNode.raws.before || ``);
|
|
@@ -15672,9 +15513,7 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15672
15513
|
return startNode;
|
|
15673
15514
|
}
|
|
15674
15515
|
let nodeToCheck = nextNode(statement.first);
|
|
15675
|
-
if (!nodeToCheck)
|
|
15676
|
-
return;
|
|
15677
|
-
}
|
|
15516
|
+
if (!nodeToCheck) return;
|
|
15678
15517
|
const problemIndex = beforeBlockString(statement, { noRawBefore: true }).length + 1;
|
|
15679
15518
|
checker.afterOneOnly({
|
|
15680
15519
|
source: rawNodeString(nodeToCheck),
|
|
@@ -15690,9 +15529,7 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15690
15529
|
ruleName: ruleName$12,
|
|
15691
15530
|
fix() {
|
|
15692
15531
|
let nodeToCheckRaws = nodeToCheck.raws;
|
|
15693
|
-
if (typeof nodeToCheckRaws.before !== `string`)
|
|
15694
|
-
return;
|
|
15695
|
-
}
|
|
15532
|
+
if (typeof nodeToCheckRaws.before !== `string`) return;
|
|
15696
15533
|
if (primary.startsWith(`always`)) {
|
|
15697
15534
|
let index2 = nodeToCheckRaws.before.search(/\r?\n/);
|
|
15698
15535
|
nodeToCheckRaws.before = index2 >= 0 ? nodeToCheckRaws.before.slice(index2) : context.newline + nodeToCheckRaws.before;
|
|
@@ -15700,23 +15537,15 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15700
15537
|
return;
|
|
15701
15538
|
}
|
|
15702
15539
|
if (primary === `never-multi-line`) {
|
|
15703
|
-
for (let [node2, before] of backupCommentNextBefores.entries())
|
|
15704
|
-
node2.raws.before = before;
|
|
15705
|
-
}
|
|
15540
|
+
for (let [node2, before] of backupCommentNextBefores.entries()) node2.raws.before = before;
|
|
15706
15541
|
backupCommentNextBefores.clear();
|
|
15707
15542
|
let reNewLine = /\r?\n/;
|
|
15708
15543
|
let fixTarget = statement.first;
|
|
15709
15544
|
while (fixTarget) {
|
|
15710
15545
|
let fixTargetRaws = fixTarget.raws;
|
|
15711
|
-
if (typeof fixTargetRaws.before !== `string`)
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
if (reNewLine.test(fixTargetRaws.before || ``)) {
|
|
15715
|
-
fixTargetRaws.before = fixTargetRaws.before.replace(/\r?\n/g, ``);
|
|
15716
|
-
}
|
|
15717
|
-
if (fixTarget.type !== `comment`) {
|
|
15718
|
-
break;
|
|
15719
|
-
}
|
|
15546
|
+
if (typeof fixTargetRaws.before !== `string`) continue;
|
|
15547
|
+
if (reNewLine.test(fixTargetRaws.before || ``)) fixTargetRaws.before = fixTargetRaws.before.replace(/\r?\n/g, ``);
|
|
15548
|
+
if (fixTarget.type !== `comment`) break;
|
|
15720
15549
|
fixTarget = fixTarget.next();
|
|
15721
15550
|
}
|
|
15722
15551
|
nodeToCheckRaws.before = ``;
|
|
@@ -15725,9 +15554,7 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15725
15554
|
});
|
|
15726
15555
|
}
|
|
15727
15556
|
});
|
|
15728
|
-
for (let [node2, before] of backupCommentNextBefores.entries())
|
|
15729
|
-
node2.raws.before = before;
|
|
15730
|
-
}
|
|
15557
|
+
for (let [node2, before] of backupCommentNextBefores.entries()) node2.raws.before = before;
|
|
15731
15558
|
}
|
|
15732
15559
|
};
|
|
15733
15560
|
}
|
|
@@ -15768,23 +15595,17 @@ function rule$11(primary, _secondaryOptions, context) {
|
|
|
15768
15595
|
`never-multi-line`
|
|
15769
15596
|
]
|
|
15770
15597
|
});
|
|
15771
|
-
if (!validOptions)
|
|
15772
|
-
return;
|
|
15773
|
-
}
|
|
15598
|
+
if (!validOptions) return;
|
|
15774
15599
|
root2.walkRules(check);
|
|
15775
15600
|
root2.walkAtRules(check);
|
|
15776
15601
|
function check(statement) {
|
|
15777
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15778
|
-
return;
|
|
15779
|
-
}
|
|
15602
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15780
15603
|
let source = beforeBlockString(statement);
|
|
15781
15604
|
let beforeBraceNoRaw = beforeBlockString(statement, {
|
|
15782
15605
|
noRawBefore: true
|
|
15783
15606
|
});
|
|
15784
15607
|
let index2 = beforeBraceNoRaw.length - 1;
|
|
15785
|
-
if (beforeBraceNoRaw[index2 - 1] === `\r`)
|
|
15786
|
-
index2 -= 1;
|
|
15787
|
-
}
|
|
15608
|
+
if (beforeBraceNoRaw[index2 - 1] === `\r`) index2 -= 1;
|
|
15788
15609
|
checker.beforeAllowingIndentation({
|
|
15789
15610
|
lineCheckStr: blockString(statement),
|
|
15790
15611
|
source,
|
|
@@ -15801,14 +15622,9 @@ function rule$11(primary, _secondaryOptions, context) {
|
|
|
15801
15622
|
if (typeof statement.raws.between !== `string`) return;
|
|
15802
15623
|
if (primary.startsWith(`always`)) {
|
|
15803
15624
|
let spaceIndex = statement.raws.between.search(/\s+$/);
|
|
15804
|
-
if (spaceIndex >= 0)
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
statement.raws.between += context.newline;
|
|
15808
|
-
}
|
|
15809
|
-
} else if (primary.startsWith(`never`)) {
|
|
15810
|
-
statement.raws.between = statement.raws.between.replace(/\s*$/, ``);
|
|
15811
|
-
}
|
|
15625
|
+
if (spaceIndex >= 0) statement.raws.between = statement.raws.between.slice(0, spaceIndex) + context.newline + statement.raws.between.slice(spaceIndex);
|
|
15626
|
+
else statement.raws.between += context.newline;
|
|
15627
|
+
} else if (primary.startsWith(`never`)) statement.raws.between = statement.raws.between.replace(/\s*$/, ``);
|
|
15812
15628
|
}
|
|
15813
15629
|
});
|
|
15814
15630
|
}
|
|
@@ -15866,17 +15682,11 @@ function rule$10(primary, secondaryOptions) {
|
|
|
15866
15682
|
optional: true
|
|
15867
15683
|
}
|
|
15868
15684
|
);
|
|
15869
|
-
if (!validOptions)
|
|
15870
|
-
return;
|
|
15871
|
-
}
|
|
15685
|
+
if (!validOptions) return;
|
|
15872
15686
|
root2.walkRules(check);
|
|
15873
|
-
if (!optionsMatches(secondaryOptions, `ignore`, `at-rules`))
|
|
15874
|
-
root2.walkAtRules(check);
|
|
15875
|
-
}
|
|
15687
|
+
if (!optionsMatches(secondaryOptions, `ignore`, `at-rules`)) root2.walkAtRules(check);
|
|
15876
15688
|
function check(statement) {
|
|
15877
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15878
|
-
return;
|
|
15879
|
-
}
|
|
15689
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15880
15690
|
const problemIndex = beforeBlockString(statement, { noRawBefore: true }).length + 1;
|
|
15881
15691
|
checker.after({
|
|
15882
15692
|
source: blockString(statement),
|
|
@@ -15892,11 +15702,8 @@ function rule$10(primary, secondaryOptions) {
|
|
|
15892
15702
|
fix() {
|
|
15893
15703
|
let statementFirst = statement.first;
|
|
15894
15704
|
if (statementFirst === null) return;
|
|
15895
|
-
if (primary.startsWith(`always`))
|
|
15896
|
-
|
|
15897
|
-
} else if (primary.startsWith(`never`)) {
|
|
15898
|
-
statementFirst.raws.before = ``;
|
|
15899
|
-
}
|
|
15705
|
+
if (primary.startsWith(`always`)) statementFirst.raws.before = ` `;
|
|
15706
|
+
else if (primary.startsWith(`never`)) statementFirst.raws.before = ``;
|
|
15900
15707
|
}
|
|
15901
15708
|
});
|
|
15902
15709
|
}
|
|
@@ -15955,29 +15762,19 @@ function rule$$(primary, secondaryOptions) {
|
|
|
15955
15762
|
optional: true
|
|
15956
15763
|
}
|
|
15957
15764
|
);
|
|
15958
|
-
if (!validOptions)
|
|
15959
|
-
return;
|
|
15960
|
-
}
|
|
15765
|
+
if (!validOptions) return;
|
|
15961
15766
|
root2.walkRules(check);
|
|
15962
15767
|
root2.walkAtRules(check);
|
|
15963
15768
|
function check(statement) {
|
|
15964
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) {
|
|
15968
|
-
return;
|
|
15969
|
-
}
|
|
15970
|
-
if (statement.type === `rule` && optionsMatches(secondaryOptions, `ignoreSelectors`, statement.selector)) {
|
|
15971
|
-
return;
|
|
15972
|
-
}
|
|
15769
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15770
|
+
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) return;
|
|
15771
|
+
if (statement.type === `rule` && optionsMatches(secondaryOptions, `ignoreSelectors`, statement.selector)) return;
|
|
15973
15772
|
let source = beforeBlockString(statement);
|
|
15974
15773
|
let beforeBraceNoRaw = beforeBlockString(statement, {
|
|
15975
15774
|
noRawBefore: true
|
|
15976
15775
|
});
|
|
15977
15776
|
let index2 = beforeBraceNoRaw.length - 1;
|
|
15978
|
-
if (beforeBraceNoRaw[index2 - 1] === `\r`)
|
|
15979
|
-
index2 -= 1;
|
|
15980
|
-
}
|
|
15777
|
+
if (beforeBraceNoRaw[index2 - 1] === `\r`) index2 -= 1;
|
|
15981
15778
|
checker.before({
|
|
15982
15779
|
source,
|
|
15983
15780
|
index: source.length,
|
|
@@ -15995,9 +15792,7 @@ function rule$$(primary, secondaryOptions) {
|
|
|
15995
15792
|
statement.raws.between = ` `;
|
|
15996
15793
|
return;
|
|
15997
15794
|
}
|
|
15998
|
-
if (primary.startsWith(`never`))
|
|
15999
|
-
statement.raws.between = ``;
|
|
16000
|
-
}
|
|
15795
|
+
if (primary.startsWith(`never`)) statement.raws.between = ``;
|
|
16001
15796
|
}
|
|
16002
15797
|
});
|
|
16003
15798
|
}
|
|
@@ -16025,9 +15820,7 @@ function declarationValueIndex(decl) {
|
|
|
16025
15820
|
raws.between || `:`,
|
|
16026
15821
|
raws.value && `prefix` in raws.value && raws.value.prefix
|
|
16027
15822
|
].reduce((count, str) => {
|
|
16028
|
-
if (isString(str))
|
|
16029
|
-
return count + str.length;
|
|
16030
|
-
}
|
|
15823
|
+
if (isString(str)) return count + str.length;
|
|
16031
15824
|
return count;
|
|
16032
15825
|
}, 0);
|
|
16033
15826
|
}
|
|
@@ -16037,11 +15830,8 @@ function getDeclarationValue(decl) {
|
|
|
16037
15830
|
}
|
|
16038
15831
|
function setDeclarationValue(decl, value) {
|
|
16039
15832
|
let raws = decl.raws;
|
|
16040
|
-
if (raws.value)
|
|
16041
|
-
|
|
16042
|
-
} else {
|
|
16043
|
-
decl.value = value;
|
|
16044
|
-
}
|
|
15833
|
+
if (raws.value) raws.value.raw = value;
|
|
15834
|
+
else decl.value = value;
|
|
16045
15835
|
return decl;
|
|
16046
15836
|
}
|
|
16047
15837
|
let { utils: { report: report$K, ruleMessages: ruleMessages$_, validateOptions: validateOptions$_ } } = stylelint;
|
|
@@ -16063,27 +15853,17 @@ function rule$_(primary) {
|
|
|
16063
15853
|
actual: primary,
|
|
16064
15854
|
possible: [`lower`, `upper`]
|
|
16065
15855
|
});
|
|
16066
|
-
if (!validOptions)
|
|
16067
|
-
return;
|
|
16068
|
-
}
|
|
15856
|
+
if (!validOptions) return;
|
|
16069
15857
|
root2.walkDecls((decl) => {
|
|
16070
|
-
if (!CONTAINS_HEX.test(decl.value))
|
|
16071
|
-
return;
|
|
16072
|
-
}
|
|
15858
|
+
if (!CONTAINS_HEX.test(decl.value)) return;
|
|
16073
15859
|
let parsedValue = valueParser(getDeclarationValue(decl));
|
|
16074
15860
|
let needsFix = false;
|
|
16075
15861
|
parsedValue.walk((node2) => {
|
|
16076
15862
|
let { value } = node2;
|
|
16077
|
-
if (isIgnoredFunction(node2))
|
|
16078
|
-
|
|
16079
|
-
}
|
|
16080
|
-
if (!isHexColor(node2)) {
|
|
16081
|
-
return;
|
|
16082
|
-
}
|
|
15863
|
+
if (isIgnoredFunction(node2)) return false;
|
|
15864
|
+
if (!isHexColor(node2)) return;
|
|
16083
15865
|
let expected = primary === `lower` ? value.toLowerCase() : value.toUpperCase();
|
|
16084
|
-
if (value === expected)
|
|
16085
|
-
return;
|
|
16086
|
-
}
|
|
15866
|
+
if (value === expected) return;
|
|
16087
15867
|
const problemIndex = declarationValueIndex(decl) + node2.sourceIndex;
|
|
16088
15868
|
report$K({
|
|
16089
15869
|
message: messages$_.expected,
|
|
@@ -16099,9 +15879,7 @@ function rule$_(primary) {
|
|
|
16099
15879
|
}
|
|
16100
15880
|
});
|
|
16101
15881
|
});
|
|
16102
|
-
if (needsFix)
|
|
16103
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
16104
|
-
}
|
|
15882
|
+
if (needsFix) setDeclarationValue(decl, parsedValue.toString());
|
|
16105
15883
|
});
|
|
16106
15884
|
};
|
|
16107
15885
|
}
|
|
@@ -16273,9 +16051,7 @@ function declarationBangSpaceChecker(opts) {
|
|
|
16273
16051
|
let indexOffset = declarationValueIndex(decl);
|
|
16274
16052
|
let declString = decl.toString();
|
|
16275
16053
|
let valueString = decl.toString().slice(indexOffset);
|
|
16276
|
-
if (!valueString.includes(`!`))
|
|
16277
|
-
return;
|
|
16278
|
-
}
|
|
16054
|
+
if (!valueString.includes(`!`)) return;
|
|
16279
16055
|
styleSearch({ source: valueString, target: `!` }, (match) => {
|
|
16280
16056
|
check(declString, match.startIndex + indexOffset, decl);
|
|
16281
16057
|
});
|
|
@@ -16316,9 +16092,7 @@ function rule$Z(primary) {
|
|
|
16316
16092
|
actual: primary,
|
|
16317
16093
|
possible: [`always`, `never`]
|
|
16318
16094
|
});
|
|
16319
|
-
if (!validOptions)
|
|
16320
|
-
return;
|
|
16321
|
-
}
|
|
16095
|
+
if (!validOptions) return;
|
|
16322
16096
|
declarationBangSpaceChecker({
|
|
16323
16097
|
root: root2,
|
|
16324
16098
|
result: result2,
|
|
@@ -16340,9 +16114,7 @@ function rule$Z(primary) {
|
|
|
16340
16114
|
setFixed = (value) => {
|
|
16341
16115
|
decl.raws.important = value;
|
|
16342
16116
|
};
|
|
16343
|
-
} else
|
|
16344
|
-
return false;
|
|
16345
|
-
}
|
|
16117
|
+
} else return false;
|
|
16346
16118
|
let targetBefore = target.slice(0, bangIndex + 1);
|
|
16347
16119
|
let targetAfter = target.slice(bangIndex + 1);
|
|
16348
16120
|
if (primary === `always`) {
|
|
@@ -16386,9 +16158,7 @@ function rule$Y(primary) {
|
|
|
16386
16158
|
actual: primary,
|
|
16387
16159
|
possible: [`always`, `never`]
|
|
16388
16160
|
});
|
|
16389
|
-
if (!validOptions)
|
|
16390
|
-
return;
|
|
16391
|
-
}
|
|
16161
|
+
if (!validOptions) return;
|
|
16392
16162
|
declarationBangSpaceChecker({
|
|
16393
16163
|
root: root2,
|
|
16394
16164
|
result: result2,
|
|
@@ -16410,9 +16180,7 @@ function rule$Y(primary) {
|
|
|
16410
16180
|
setFixed = (val) => {
|
|
16411
16181
|
decl.raws.important = val;
|
|
16412
16182
|
};
|
|
16413
|
-
} else
|
|
16414
|
-
return false;
|
|
16415
|
-
}
|
|
16183
|
+
} else return false;
|
|
16416
16184
|
let targetBefore = target.slice(0, bangIndex);
|
|
16417
16185
|
let targetAfter = target.slice(bangIndex);
|
|
16418
16186
|
if (primary === `always`) {
|
|
@@ -16457,28 +16225,16 @@ function rule$X(primary, _secondaryOptions, context) {
|
|
|
16457
16225
|
actual: primary,
|
|
16458
16226
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
16459
16227
|
});
|
|
16460
|
-
if (!validOptions)
|
|
16461
|
-
return;
|
|
16462
|
-
}
|
|
16228
|
+
if (!validOptions) return;
|
|
16463
16229
|
root2.walkDecls((decl) => {
|
|
16464
16230
|
let parentRule = decl.parent;
|
|
16465
|
-
if (!parentRule)
|
|
16466
|
-
|
|
16467
|
-
|
|
16468
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16469
|
-
return;
|
|
16470
|
-
}
|
|
16471
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16472
|
-
return;
|
|
16473
|
-
}
|
|
16231
|
+
if (!parentRule) throw new Error(`A parent node must be present`);
|
|
16232
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) return;
|
|
16233
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) return;
|
|
16474
16234
|
let nextNode = decl.next();
|
|
16475
|
-
if (!nextNode)
|
|
16476
|
-
return;
|
|
16477
|
-
}
|
|
16235
|
+
if (!nextNode) return;
|
|
16478
16236
|
let nodeToCheck = nextNonCommentNode(nextNode);
|
|
16479
|
-
if (!nodeToCheck)
|
|
16480
|
-
return;
|
|
16481
|
-
}
|
|
16237
|
+
if (!nodeToCheck) return;
|
|
16482
16238
|
const problemIndex = decl.toString().length + 1;
|
|
16483
16239
|
checker.afterOneOnly({
|
|
16484
16240
|
source: rawNodeString(nodeToCheck),
|
|
@@ -16498,9 +16254,7 @@ function rule$X(primary, _secondaryOptions, context) {
|
|
|
16498
16254
|
nodeToCheck.raws.before = index2 >= 0 ? nodeToCheck.raws.before.slice(index2) : context.newline + nodeToCheck.raws.before;
|
|
16499
16255
|
return;
|
|
16500
16256
|
}
|
|
16501
|
-
if (primary === `never-multi-line`)
|
|
16502
|
-
nodeToCheck.raws.before = ``;
|
|
16503
|
-
}
|
|
16257
|
+
if (primary === `never-multi-line`) nodeToCheck.raws.before = ``;
|
|
16504
16258
|
}
|
|
16505
16259
|
});
|
|
16506
16260
|
}
|
|
@@ -16536,20 +16290,12 @@ function rule$W(primary) {
|
|
|
16536
16290
|
actual: primary,
|
|
16537
16291
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
16538
16292
|
});
|
|
16539
|
-
if (!validOptions)
|
|
16540
|
-
return;
|
|
16541
|
-
}
|
|
16293
|
+
if (!validOptions) return;
|
|
16542
16294
|
root2.walkDecls((decl) => {
|
|
16543
16295
|
let parentRule = decl.parent;
|
|
16544
|
-
if (!parentRule)
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16548
|
-
return;
|
|
16549
|
-
}
|
|
16550
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16551
|
-
return;
|
|
16552
|
-
}
|
|
16296
|
+
if (!parentRule) throw new Error(`A parent node must be present`);
|
|
16297
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) return;
|
|
16298
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) return;
|
|
16553
16299
|
const declString = decl.toString();
|
|
16554
16300
|
const problemIndex = decl.toString().length - 1;
|
|
16555
16301
|
checker.beforeAllowingIndentation({
|
|
@@ -16600,24 +16346,14 @@ function rule$V(primary) {
|
|
|
16600
16346
|
actual: primary,
|
|
16601
16347
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
16602
16348
|
});
|
|
16603
|
-
if (!validOptions)
|
|
16604
|
-
return;
|
|
16605
|
-
}
|
|
16349
|
+
if (!validOptions) return;
|
|
16606
16350
|
root2.walkDecls((decl) => {
|
|
16607
16351
|
let parentRule = decl.parent;
|
|
16608
|
-
if (!parentRule)
|
|
16609
|
-
|
|
16610
|
-
|
|
16611
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16612
|
-
return;
|
|
16613
|
-
}
|
|
16614
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16615
|
-
return;
|
|
16616
|
-
}
|
|
16352
|
+
if (!parentRule) throw new Error(`A parent node must be present`);
|
|
16353
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) return;
|
|
16354
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) return;
|
|
16617
16355
|
let nextDecl = decl.next();
|
|
16618
|
-
if (!nextDecl)
|
|
16619
|
-
return;
|
|
16620
|
-
}
|
|
16356
|
+
if (!nextDecl) return;
|
|
16621
16357
|
const problemIndex = decl.toString().length + 1;
|
|
16622
16358
|
checker.after({
|
|
16623
16359
|
source: rawNodeString(nextDecl),
|
|
@@ -16636,9 +16372,7 @@ function rule$V(primary) {
|
|
|
16636
16372
|
nextDecl.raws.before = ` `;
|
|
16637
16373
|
return;
|
|
16638
16374
|
}
|
|
16639
|
-
if (primary.startsWith(`never`))
|
|
16640
|
-
nextDecl.raws.before = ``;
|
|
16641
|
-
}
|
|
16375
|
+
if (primary.startsWith(`never`)) nextDecl.raws.before = ``;
|
|
16642
16376
|
}
|
|
16643
16377
|
});
|
|
16644
16378
|
}
|
|
@@ -16679,27 +16413,17 @@ function rule$U(primary) {
|
|
|
16679
16413
|
actual: primary,
|
|
16680
16414
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
16681
16415
|
});
|
|
16682
|
-
if (!validOptions)
|
|
16683
|
-
return;
|
|
16684
|
-
}
|
|
16416
|
+
if (!validOptions) return;
|
|
16685
16417
|
root2.walkDecls((decl) => {
|
|
16686
16418
|
let parentRule = decl.parent;
|
|
16687
|
-
if (!parentRule)
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16691
|
-
return;
|
|
16692
|
-
}
|
|
16693
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16694
|
-
return;
|
|
16695
|
-
}
|
|
16419
|
+
if (!parentRule) throw new Error(`A parent node must be present`);
|
|
16420
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) return;
|
|
16421
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) return;
|
|
16696
16422
|
const value = getDeclarationValue(decl);
|
|
16697
16423
|
let isCustomPropertyWithOnlySpaces = false;
|
|
16698
16424
|
if (isCustomProperty(decl.prop)) {
|
|
16699
16425
|
isCustomPropertyWithOnlySpaces = /^\s+$/.test(value);
|
|
16700
|
-
if (primary.startsWith(`never`) && value === ` `)
|
|
16701
|
-
return;
|
|
16702
|
-
}
|
|
16426
|
+
if (primary.startsWith(`never`) && value === ` `) return;
|
|
16703
16427
|
}
|
|
16704
16428
|
const declString = decl.toString();
|
|
16705
16429
|
const problemIndex = decl.toString().length - 1;
|
|
@@ -16717,17 +16441,13 @@ function rule$U(primary) {
|
|
|
16717
16441
|
ruleName: ruleName$U,
|
|
16718
16442
|
fix() {
|
|
16719
16443
|
if (primary.startsWith(`always`)) {
|
|
16720
|
-
if (decl.important)
|
|
16721
|
-
|
|
16722
|
-
} else {
|
|
16723
|
-
setDeclarationValue(decl, value.replace(/\s*$/, ` `));
|
|
16724
|
-
}
|
|
16444
|
+
if (decl.important) decl.raws.important = ` !important `;
|
|
16445
|
+
else setDeclarationValue(decl, value.replace(/\s*$/, ` `));
|
|
16725
16446
|
return;
|
|
16726
16447
|
}
|
|
16727
16448
|
if (primary.startsWith(`never`)) {
|
|
16728
|
-
if (decl.raws.important)
|
|
16729
|
-
|
|
16730
|
-
} else {
|
|
16449
|
+
if (decl.raws.important) decl.raws.important = decl.raws.important.replace(/\s*$/, ``);
|
|
16450
|
+
else {
|
|
16731
16451
|
const newValue = isCustomPropertyWithOnlySpaces ? ` ` : value.replace(/\s*$/, ``);
|
|
16732
16452
|
setDeclarationValue(decl, newValue);
|
|
16733
16453
|
}
|
|
@@ -16777,9 +16497,7 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16777
16497
|
optional: true
|
|
16778
16498
|
}
|
|
16779
16499
|
);
|
|
16780
|
-
if (!validOptions)
|
|
16781
|
-
return;
|
|
16782
|
-
}
|
|
16500
|
+
if (!validOptions) return;
|
|
16783
16501
|
root2.walkAtRules((atRule2) => {
|
|
16784
16502
|
if (!atRule2.parent) throw new Error(`A parent node must be present`);
|
|
16785
16503
|
if (atRule2.parent === root2 || atRule2 !== atRule2.parent.last || hasBlock(atRule2)) return;
|
|
@@ -16791,9 +16509,7 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16791
16509
|
checkLastNode(decl);
|
|
16792
16510
|
});
|
|
16793
16511
|
function checkLastNode(node2) {
|
|
16794
|
-
if (!node2.parent)
|
|
16795
|
-
throw new Error(`A parent node must be present`);
|
|
16796
|
-
}
|
|
16512
|
+
if (!node2.parent) throw new Error(`A parent node must be present`);
|
|
16797
16513
|
let hasSemicolon = node2.parent.raws.semicolon;
|
|
16798
16514
|
let ignoreSingleDeclaration = optionsMatches(
|
|
16799
16515
|
secondaryOptions,
|
|
@@ -16803,11 +16519,8 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16803
16519
|
if (ignoreSingleDeclaration && node2.parent.first === node2) return;
|
|
16804
16520
|
if (primary === `always` && primary === `never`) throw new Error(`Unexpected primary option: "${primary}"`);
|
|
16805
16521
|
let message;
|
|
16806
|
-
if (primary === `always` && !hasSemicolon)
|
|
16807
|
-
|
|
16808
|
-
} else if (primary === `never` && hasSemicolon) {
|
|
16809
|
-
message = messages$T.rejected;
|
|
16810
|
-
}
|
|
16522
|
+
if (primary === `always` && !hasSemicolon) message = messages$T.expected;
|
|
16523
|
+
else if (primary === `never` && hasSemicolon) message = messages$T.rejected;
|
|
16811
16524
|
const problemIndex = node2.toString().trim().length - 1;
|
|
16812
16525
|
if (message) {
|
|
16813
16526
|
report$E({
|
|
@@ -16824,9 +16537,7 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16824
16537
|
node2.raws.between = ``;
|
|
16825
16538
|
node2.parent.raws.after = ` `;
|
|
16826
16539
|
}
|
|
16827
|
-
} else if (primary === `never` && hasSemicolon)
|
|
16828
|
-
node2.parent.raws.semicolon = false;
|
|
16829
|
-
}
|
|
16540
|
+
} else if (primary === `never` && hasSemicolon) node2.parent.raws.semicolon = false;
|
|
16830
16541
|
}
|
|
16831
16542
|
});
|
|
16832
16543
|
}
|
|
@@ -16844,35 +16555,19 @@ const index$T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
16844
16555
|
ruleName: ruleName$T
|
|
16845
16556
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
16846
16557
|
function isScssVariable(property) {
|
|
16847
|
-
if (property.startsWith(`$`))
|
|
16848
|
-
|
|
16849
|
-
}
|
|
16850
|
-
if (property.includes(`.$`)) {
|
|
16851
|
-
return true;
|
|
16852
|
-
}
|
|
16558
|
+
if (property.startsWith(`$`)) return true;
|
|
16559
|
+
if (property.includes(`.$`)) return true;
|
|
16853
16560
|
return false;
|
|
16854
16561
|
}
|
|
16855
16562
|
function isStandardSyntaxDeclaration(decl) {
|
|
16856
16563
|
let prop = decl.prop;
|
|
16857
16564
|
let parent = decl.parent;
|
|
16858
|
-
if (isScssVariable(prop))
|
|
16859
|
-
|
|
16860
|
-
|
|
16861
|
-
if (
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
if (parent && parent.type === `atrule` && parent.raws.afterName === `:`) {
|
|
16865
|
-
return false;
|
|
16866
|
-
}
|
|
16867
|
-
if (parent && isRule(parent) && parent.selector && parent.selector.startsWith(`#`) && parent.selector.endsWith(`()`)) {
|
|
16868
|
-
return false;
|
|
16869
|
-
}
|
|
16870
|
-
if (parent && isRule(parent) && parent.selector && parent.selector[parent.selector.length - 1] === `:` && parent.selector.substring(0, 2) !== `--`) {
|
|
16871
|
-
return false;
|
|
16872
|
-
}
|
|
16873
|
-
if (`extend` in decl && decl.extend) {
|
|
16874
|
-
return false;
|
|
16875
|
-
}
|
|
16565
|
+
if (isScssVariable(prop)) return false;
|
|
16566
|
+
if (prop[0] === `@` && prop[1] !== `{`) return false;
|
|
16567
|
+
if (parent && parent.type === `atrule` && parent.raws.afterName === `:`) return false;
|
|
16568
|
+
if (parent && isRule(parent) && parent.selector && parent.selector.startsWith(`#`) && parent.selector.endsWith(`()`)) return false;
|
|
16569
|
+
if (parent && isRule(parent) && parent.selector && parent.selector[parent.selector.length - 1] === `:` && parent.selector.substring(0, 2) !== `--`) return false;
|
|
16570
|
+
if (`extend` in decl && decl.extend) return false;
|
|
16876
16571
|
return true;
|
|
16877
16572
|
}
|
|
16878
16573
|
let { utils: { report: report$D, ruleMessages: ruleMessages$S, validateOptions: validateOptions$S } } = stylelint;
|
|
@@ -16893,19 +16588,13 @@ function rule$S(primary, _secondaryOptions, context) {
|
|
|
16893
16588
|
actual: primary,
|
|
16894
16589
|
possible: [`always`, `always-multi-line`]
|
|
16895
16590
|
});
|
|
16896
|
-
if (!validOptions)
|
|
16897
|
-
return;
|
|
16898
|
-
}
|
|
16591
|
+
if (!validOptions) return;
|
|
16899
16592
|
root2.walkDecls((decl) => {
|
|
16900
|
-
if (!isStandardSyntaxDeclaration(decl))
|
|
16901
|
-
return;
|
|
16902
|
-
}
|
|
16593
|
+
if (!isStandardSyntaxDeclaration(decl)) return;
|
|
16903
16594
|
let endOfPropIndex = declarationValueIndex(decl) + (decl.raws.between || ``).length - 1;
|
|
16904
16595
|
let propPlusColon = `${decl.toString().slice(0, endOfPropIndex)}xxx`;
|
|
16905
16596
|
for (let i2 = 0, l2 = propPlusColon.length; i2 < l2; i2++) {
|
|
16906
|
-
if (propPlusColon[i2] !== `:`)
|
|
16907
|
-
continue;
|
|
16908
|
-
}
|
|
16597
|
+
if (propPlusColon[i2] !== `:`) continue;
|
|
16909
16598
|
let indexToCheck = /^[^\S\r\n]*\/\*/.test(propPlusColon.slice(i2 + 1)) ? propPlusColon.indexOf(`*/`, i2) + 1 : i2;
|
|
16910
16599
|
checker.afterOneOnly({
|
|
16911
16600
|
source: propPlusColon,
|
|
@@ -16921,9 +16610,7 @@ function rule$S(primary, _secondaryOptions, context) {
|
|
|
16921
16610
|
ruleName: ruleName$S,
|
|
16922
16611
|
fix() {
|
|
16923
16612
|
let between = decl.raws.between;
|
|
16924
|
-
if (between === null)
|
|
16925
|
-
throw new Error(`\`between\` must be present`);
|
|
16926
|
-
}
|
|
16613
|
+
if (between === null) throw new Error(`\`between\` must be present`);
|
|
16927
16614
|
let betweenStart = declarationValueIndex(decl) - between.length;
|
|
16928
16615
|
let sliceIndex = indexToCheck - betweenStart + 1;
|
|
16929
16616
|
let betweenBefore = between.slice(0, sliceIndex);
|
|
@@ -16950,15 +16637,11 @@ const index$S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
16950
16637
|
let { utils: { report: report$C } } = stylelint;
|
|
16951
16638
|
function declarationColonSpaceChecker(opts) {
|
|
16952
16639
|
opts.root.walkDecls((decl) => {
|
|
16953
|
-
if (!isStandardSyntaxDeclaration(decl))
|
|
16954
|
-
return;
|
|
16955
|
-
}
|
|
16640
|
+
if (!isStandardSyntaxDeclaration(decl)) return;
|
|
16956
16641
|
let endOfPropIndex = declarationValueIndex(decl) + (decl.raws.between || ``).length - 1;
|
|
16957
16642
|
let propPlusColon = `${decl.toString().slice(0, endOfPropIndex)}xxx`;
|
|
16958
16643
|
for (let i2 = 0, l2 = propPlusColon.length; i2 < l2; i2++) {
|
|
16959
|
-
if (propPlusColon[i2] !== `:`)
|
|
16960
|
-
continue;
|
|
16961
|
-
}
|
|
16644
|
+
if (propPlusColon[i2] !== `:`) continue;
|
|
16962
16645
|
const problemIndex = decl.prop.toString().length + 1;
|
|
16963
16646
|
opts.locationChecker({
|
|
16964
16647
|
source: propPlusColon,
|
|
@@ -16999,9 +16682,7 @@ function rule$R(primary) {
|
|
|
16999
16682
|
actual: primary,
|
|
17000
16683
|
possible: [`always`, `never`, `always-single-line`]
|
|
17001
16684
|
});
|
|
17002
|
-
if (!validOptions)
|
|
17003
|
-
return;
|
|
17004
|
-
}
|
|
16685
|
+
if (!validOptions) return;
|
|
17005
16686
|
declarationColonSpaceChecker({
|
|
17006
16687
|
root: root2,
|
|
17007
16688
|
result: result2,
|
|
@@ -17010,9 +16691,7 @@ function rule$R(primary) {
|
|
|
17010
16691
|
fix: (decl, index2) => {
|
|
17011
16692
|
let colonIndex = index2 - declarationValueIndex(decl);
|
|
17012
16693
|
let between = decl.raws.between;
|
|
17013
|
-
if (between === null)
|
|
17014
|
-
throw new Error(`\`between\` must be present`);
|
|
17015
|
-
}
|
|
16694
|
+
if (between === null) throw new Error(`\`between\` must be present`);
|
|
17016
16695
|
if (primary.startsWith(`always`)) {
|
|
17017
16696
|
decl.raws.between = between.slice(0, colonIndex) + between.slice(colonIndex).replace(/^:\s*/, `: `);
|
|
17018
16697
|
return true;
|
|
@@ -17054,9 +16733,7 @@ function rule$Q(primary) {
|
|
|
17054
16733
|
actual: primary,
|
|
17055
16734
|
possible: [`always`, `never`]
|
|
17056
16735
|
});
|
|
17057
|
-
if (!validOptions)
|
|
17058
|
-
return;
|
|
17059
|
-
}
|
|
16736
|
+
if (!validOptions) return;
|
|
17060
16737
|
declarationColonSpaceChecker({
|
|
17061
16738
|
root: root2,
|
|
17062
16739
|
result: result2,
|
|
@@ -17065,9 +16742,7 @@ function rule$Q(primary) {
|
|
|
17065
16742
|
fix: (decl, index2) => {
|
|
17066
16743
|
let colonIndex = index2 - declarationValueIndex(decl);
|
|
17067
16744
|
let between = decl.raws.between;
|
|
17068
|
-
if (between === null)
|
|
17069
|
-
throw new Error(`\`between\` must be present`);
|
|
17070
|
-
}
|
|
16745
|
+
if (between === null) throw new Error(`\`between\` must be present`);
|
|
17071
16746
|
if (primary === `always`) {
|
|
17072
16747
|
decl.raws.between = between.slice(0, colonIndex).replace(/\s*$/, ` `) + between.slice(colonIndex);
|
|
17073
16748
|
return true;
|
|
@@ -17091,45 +16766,11 @@ const index$Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17091
16766
|
meta: meta$Q,
|
|
17092
16767
|
ruleName: ruleName$Q
|
|
17093
16768
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
17094
|
-
function functionCommaSpaceFix(params) {
|
|
17095
|
-
let { div, index: index2, nodes, expectation, position, symb } = params;
|
|
17096
|
-
if (expectation.startsWith(`always`)) {
|
|
17097
|
-
div[position] = symb;
|
|
17098
|
-
return true;
|
|
17099
|
-
}
|
|
17100
|
-
if (expectation.startsWith(`never`)) {
|
|
17101
|
-
div[position] = ``;
|
|
17102
|
-
for (let i2 = index2 + 1; i2 < nodes.length; i2++) {
|
|
17103
|
-
let node2 = nodes[i2];
|
|
17104
|
-
if (node2 === void 0) {
|
|
17105
|
-
continue;
|
|
17106
|
-
}
|
|
17107
|
-
if (node2.type === `comment`) {
|
|
17108
|
-
continue;
|
|
17109
|
-
}
|
|
17110
|
-
if (node2.type === `space`) {
|
|
17111
|
-
node2.value = ``;
|
|
17112
|
-
continue;
|
|
17113
|
-
}
|
|
17114
|
-
break;
|
|
17115
|
-
}
|
|
17116
|
-
return true;
|
|
17117
|
-
}
|
|
17118
|
-
return false;
|
|
17119
|
-
}
|
|
17120
16769
|
function isStandardSyntaxFunction(node2) {
|
|
17121
|
-
if (!node2.value)
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
if (node2.value.startsWith(
|
|
17125
|
-
return false;
|
|
17126
|
-
}
|
|
17127
|
-
if (node2.value.startsWith(`\${`)) {
|
|
17128
|
-
return false;
|
|
17129
|
-
}
|
|
17130
|
-
if (node2.value.startsWith(`\``)) {
|
|
17131
|
-
return false;
|
|
17132
|
-
}
|
|
16770
|
+
if (!node2.value) return false;
|
|
16771
|
+
if (node2.value.startsWith(`#{`)) return false;
|
|
16772
|
+
if (node2.value.startsWith(`\${`)) return false;
|
|
16773
|
+
if (node2.value.startsWith(`\``)) return false;
|
|
17133
16774
|
return true;
|
|
17134
16775
|
}
|
|
17135
16776
|
let { utils: { report: report$B } } = stylelint;
|
|
@@ -17139,15 +16780,9 @@ function functionCommaSpaceChecker(opts) {
|
|
|
17139
16780
|
let hasFixed;
|
|
17140
16781
|
let parsedValue = valueParser(declValue);
|
|
17141
16782
|
parsedValue.walk((valueNode) => {
|
|
17142
|
-
if (valueNode.type !== `function`)
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
if (!isStandardSyntaxFunction(valueNode)) {
|
|
17146
|
-
return;
|
|
17147
|
-
}
|
|
17148
|
-
if (valueNode.value.toLowerCase() === `url`) {
|
|
17149
|
-
return;
|
|
17150
|
-
}
|
|
16783
|
+
if (valueNode.type !== `function`) return;
|
|
16784
|
+
if (!isStandardSyntaxFunction(valueNode)) return;
|
|
16785
|
+
if (valueNode.value.toLowerCase() === `url`) return;
|
|
17151
16786
|
let argumentStrings = valueNode.nodes.map((node2) => valueParser.stringify(node2));
|
|
17152
16787
|
let functionArguments = (() => {
|
|
17153
16788
|
let result2 = valueNode.before + argumentStrings.join(``) + valueNode.after;
|
|
@@ -17161,9 +16796,7 @@ function functionCommaSpaceChecker(opts) {
|
|
|
17161
16796
|
}
|
|
17162
16797
|
let commaDataList = [];
|
|
17163
16798
|
for (let [nodeIndex, node2] of valueNode.nodes.entries()) {
|
|
17164
|
-
if (node2.type !== `div` || node2.value !== `,`)
|
|
17165
|
-
continue;
|
|
17166
|
-
}
|
|
16799
|
+
if (node2.type !== `div` || node2.value !== `,`) continue;
|
|
17167
16800
|
let checkIndex = getCommaCheckIndex(node2, nodeIndex);
|
|
17168
16801
|
commaDataList.push({
|
|
17169
16802
|
commaNode: node2,
|
|
@@ -17193,11 +16826,31 @@ function functionCommaSpaceChecker(opts) {
|
|
|
17193
16826
|
});
|
|
17194
16827
|
}
|
|
17195
16828
|
});
|
|
17196
|
-
if (hasFixed)
|
|
17197
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
17198
|
-
}
|
|
16829
|
+
if (hasFixed) setDeclarationValue(decl, parsedValue.toString());
|
|
17199
16830
|
});
|
|
17200
16831
|
}
|
|
16832
|
+
function functionCommaSpaceFix(params) {
|
|
16833
|
+
let { div, index: index2, nodes, expectation, position, symb } = params;
|
|
16834
|
+
if (expectation.startsWith(`always`)) {
|
|
16835
|
+
div[position] = symb;
|
|
16836
|
+
return true;
|
|
16837
|
+
}
|
|
16838
|
+
if (expectation.startsWith(`never`)) {
|
|
16839
|
+
div[position] = ``;
|
|
16840
|
+
for (let i2 = index2 + 1; i2 < nodes.length; i2++) {
|
|
16841
|
+
let node2 = nodes[i2];
|
|
16842
|
+
if (node2 === void 0) continue;
|
|
16843
|
+
if (node2.type === `comment`) continue;
|
|
16844
|
+
if (node2.type === `space`) {
|
|
16845
|
+
node2.value = ``;
|
|
16846
|
+
continue;
|
|
16847
|
+
}
|
|
16848
|
+
break;
|
|
16849
|
+
}
|
|
16850
|
+
return true;
|
|
16851
|
+
}
|
|
16852
|
+
return false;
|
|
16853
|
+
}
|
|
17201
16854
|
let { utils: { ruleMessages: ruleMessages$P, validateOptions: validateOptions$P } } = stylelint;
|
|
17202
16855
|
let shortName$P = `function-comma-newline-after`;
|
|
17203
16856
|
let ruleName$P = addNamespace(shortName$P);
|
|
@@ -17217,9 +16870,7 @@ function rule$P(primary, _secondaryOptions, context) {
|
|
|
17217
16870
|
actual: primary,
|
|
17218
16871
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
17219
16872
|
});
|
|
17220
|
-
if (!validOptions)
|
|
17221
|
-
return;
|
|
17222
|
-
}
|
|
16873
|
+
if (!validOptions) return;
|
|
17223
16874
|
functionCommaSpaceChecker({
|
|
17224
16875
|
root: root2,
|
|
17225
16876
|
result: result2,
|
|
@@ -17265,9 +16916,7 @@ function rule$O(primary, _secondaryOptions, context) {
|
|
|
17265
16916
|
actual: primary,
|
|
17266
16917
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
17267
16918
|
});
|
|
17268
|
-
if (!validOptions)
|
|
17269
|
-
return;
|
|
17270
|
-
}
|
|
16919
|
+
if (!validOptions) return;
|
|
17271
16920
|
functionCommaSpaceChecker({
|
|
17272
16921
|
root: root2,
|
|
17273
16922
|
result: result2,
|
|
@@ -17314,9 +16963,7 @@ function rule$N(primary) {
|
|
|
17314
16963
|
actual: primary,
|
|
17315
16964
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
17316
16965
|
});
|
|
17317
|
-
if (!validOptions)
|
|
17318
|
-
return;
|
|
17319
|
-
}
|
|
16966
|
+
if (!validOptions) return;
|
|
17320
16967
|
functionCommaSpaceChecker({
|
|
17321
16968
|
root: root2,
|
|
17322
16969
|
result: result2,
|
|
@@ -17363,9 +17010,7 @@ function rule$M(primary) {
|
|
|
17363
17010
|
actual: primary,
|
|
17364
17011
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
17365
17012
|
});
|
|
17366
|
-
if (!validOptions)
|
|
17367
|
-
return;
|
|
17368
|
-
}
|
|
17013
|
+
if (!validOptions) return;
|
|
17369
17014
|
functionCommaSpaceChecker({
|
|
17370
17015
|
root: root2,
|
|
17371
17016
|
result: result2,
|
|
@@ -17403,9 +17048,7 @@ let meta$L = {
|
|
|
17403
17048
|
fixable: true
|
|
17404
17049
|
};
|
|
17405
17050
|
function placeIndexOnValueStart(decl) {
|
|
17406
|
-
if (decl.raws.between === null)
|
|
17407
|
-
throw new Error(`\`between\` must be present`);
|
|
17408
|
-
}
|
|
17051
|
+
if (decl.raws.between === null) throw new Error(`\`between\` must be present`);
|
|
17409
17052
|
return decl.prop.length + decl.raws.between.length - 1;
|
|
17410
17053
|
}
|
|
17411
17054
|
function rule$L(primary) {
|
|
@@ -17415,9 +17058,7 @@ function rule$L(primary) {
|
|
|
17415
17058
|
actual: primary,
|
|
17416
17059
|
possible: isNumber$1
|
|
17417
17060
|
});
|
|
17418
|
-
if (!validOptions)
|
|
17419
|
-
return;
|
|
17420
|
-
}
|
|
17061
|
+
if (!validOptions) return;
|
|
17421
17062
|
let violatedCRLFNewLinesRegex = new RegExp(`(?:\r
|
|
17422
17063
|
){${maxAdjacentNewlines + 1},}`);
|
|
17423
17064
|
let violatedLFNewLinesRegex = new RegExp(`
|
|
@@ -17427,20 +17068,14 @@ function rule$L(primary) {
|
|
|
17427
17068
|
let allowedCRLFNewLinesString = `\r
|
|
17428
17069
|
`.repeat(maxAdjacentNewlines);
|
|
17429
17070
|
root2.walkDecls((decl) => {
|
|
17430
|
-
if (!decl.value.includes(`(`))
|
|
17431
|
-
return;
|
|
17432
|
-
}
|
|
17071
|
+
if (!decl.value.includes(`(`)) return;
|
|
17433
17072
|
let stringValue = getDeclarationValue(decl);
|
|
17434
17073
|
let splittedValue = [];
|
|
17435
17074
|
let sourceIndexStart = 0;
|
|
17436
17075
|
valueParser(stringValue).walk((node2) => {
|
|
17437
|
-
if (node2.type !== `function` || node2.value.length === 0)
|
|
17438
|
-
return;
|
|
17439
|
-
}
|
|
17076
|
+
if (node2.type !== `function` || node2.value.length === 0) return;
|
|
17440
17077
|
let stringifiedNode = valueParser.stringify(node2);
|
|
17441
|
-
if (!violatedLFNewLinesRegex.test(stringifiedNode) && !violatedCRLFNewLinesRegex.test(stringifiedNode))
|
|
17442
|
-
return;
|
|
17443
|
-
}
|
|
17078
|
+
if (!violatedLFNewLinesRegex.test(stringifiedNode) && !violatedCRLFNewLinesRegex.test(stringifiedNode)) return;
|
|
17444
17079
|
const problemIndex = placeIndexOnValueStart(decl) + node2.sourceIndex;
|
|
17445
17080
|
report$A({
|
|
17446
17081
|
message: messages$L.expected,
|
|
@@ -17498,24 +17133,16 @@ function rule$K(primary, _secondaryOptions, context) {
|
|
|
17498
17133
|
actual: primary,
|
|
17499
17134
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
17500
17135
|
});
|
|
17501
|
-
if (!validOptions)
|
|
17502
|
-
return;
|
|
17503
|
-
}
|
|
17136
|
+
if (!validOptions) return;
|
|
17504
17137
|
root2.walkDecls((decl) => {
|
|
17505
|
-
if (!decl.value.includes(`(`))
|
|
17506
|
-
return;
|
|
17507
|
-
}
|
|
17138
|
+
if (!decl.value.includes(`(`)) return;
|
|
17508
17139
|
let fix = null;
|
|
17509
17140
|
let hasFixed = false;
|
|
17510
17141
|
let declValue = getDeclarationValue(decl);
|
|
17511
17142
|
let parsedValue = valueParser(declValue);
|
|
17512
17143
|
parsedValue.walk((valueNode) => {
|
|
17513
|
-
if (valueNode.type !== `function`)
|
|
17514
|
-
|
|
17515
|
-
}
|
|
17516
|
-
if (!isStandardSyntaxFunction(valueNode)) {
|
|
17517
|
-
return;
|
|
17518
|
-
}
|
|
17144
|
+
if (valueNode.type !== `function`) return;
|
|
17145
|
+
if (!isStandardSyntaxFunction(valueNode)) return;
|
|
17519
17146
|
let functionString = valueParser.stringify(valueNode);
|
|
17520
17147
|
let isMultiLine = !isSingleLineString(functionString);
|
|
17521
17148
|
function containsNewline(str) {
|
|
@@ -17569,9 +17196,7 @@ function rule$K(primary, _secondaryOptions, context) {
|
|
|
17569
17196
|
complain(messages$K.rejectedClosingMultiLine, closingIndex);
|
|
17570
17197
|
}
|
|
17571
17198
|
});
|
|
17572
|
-
if (hasFixed)
|
|
17573
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
17574
|
-
}
|
|
17199
|
+
if (hasFixed) setDeclarationValue(decl, parsedValue.toString());
|
|
17575
17200
|
function complain(message, offset) {
|
|
17576
17201
|
const problemIndex = declarationValueIndex(decl) + offset;
|
|
17577
17202
|
report$z({
|
|
@@ -17590,9 +17215,7 @@ function rule$K(primary, _secondaryOptions, context) {
|
|
|
17590
17215
|
function getCheckBefore(valueNode) {
|
|
17591
17216
|
let before = valueNode.before;
|
|
17592
17217
|
for (let node2 of valueNode.nodes) {
|
|
17593
|
-
if (node2.type === `comment`)
|
|
17594
|
-
continue;
|
|
17595
|
-
}
|
|
17218
|
+
if (node2.type === `comment`) continue;
|
|
17596
17219
|
if (node2.type === `space`) {
|
|
17597
17220
|
before += node2.value;
|
|
17598
17221
|
continue;
|
|
@@ -17604,9 +17227,7 @@ function getCheckBefore(valueNode) {
|
|
|
17604
17227
|
function getCheckAfter(valueNode) {
|
|
17605
17228
|
let after = ``;
|
|
17606
17229
|
for (let node2 of [...valueNode.nodes].reverse()) {
|
|
17607
|
-
if (node2.type === `comment`)
|
|
17608
|
-
continue;
|
|
17609
|
-
}
|
|
17230
|
+
if (node2.type === `comment`) continue;
|
|
17610
17231
|
if (node2.type === `space`) {
|
|
17611
17232
|
after = node2.value + after;
|
|
17612
17233
|
continue;
|
|
@@ -17619,27 +17240,20 @@ function getCheckAfter(valueNode) {
|
|
|
17619
17240
|
function fixBeforeForAlways(valueNode, newline) {
|
|
17620
17241
|
let target;
|
|
17621
17242
|
for (let node2 of valueNode.nodes) {
|
|
17622
|
-
if (node2.type === `comment`)
|
|
17623
|
-
continue;
|
|
17624
|
-
}
|
|
17243
|
+
if (node2.type === `comment`) continue;
|
|
17625
17244
|
if (node2.type === `space`) {
|
|
17626
17245
|
target = node2;
|
|
17627
17246
|
continue;
|
|
17628
17247
|
}
|
|
17629
17248
|
break;
|
|
17630
17249
|
}
|
|
17631
|
-
if (target)
|
|
17632
|
-
|
|
17633
|
-
} else {
|
|
17634
|
-
valueNode.before = newline + valueNode.before;
|
|
17635
|
-
}
|
|
17250
|
+
if (target) target.value = newline + target.value;
|
|
17251
|
+
else valueNode.before = newline + valueNode.before;
|
|
17636
17252
|
}
|
|
17637
17253
|
function fixBeforeForNever(valueNode) {
|
|
17638
17254
|
valueNode.before = ``;
|
|
17639
17255
|
for (let node2 of valueNode.nodes) {
|
|
17640
|
-
if (node2.type === `comment`)
|
|
17641
|
-
continue;
|
|
17642
|
-
}
|
|
17256
|
+
if (node2.type === `comment`) continue;
|
|
17643
17257
|
if (node2.type === `space`) {
|
|
17644
17258
|
node2.value = ``;
|
|
17645
17259
|
continue;
|
|
@@ -17653,9 +17267,7 @@ function fixAfterForAlways(valueNode, newline) {
|
|
|
17653
17267
|
function fixAfterForNever(valueNode) {
|
|
17654
17268
|
valueNode.after = ``;
|
|
17655
17269
|
for (let node2 of [...valueNode.nodes].reverse()) {
|
|
17656
|
-
if (node2.type === `comment`)
|
|
17657
|
-
continue;
|
|
17658
|
-
}
|
|
17270
|
+
if (node2.type === `comment`) continue;
|
|
17659
17271
|
if (node2.type === `space`) {
|
|
17660
17272
|
node2.value = ``;
|
|
17661
17273
|
continue;
|
|
@@ -17696,27 +17308,17 @@ function rule$J(primary) {
|
|
|
17696
17308
|
actual: primary,
|
|
17697
17309
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
17698
17310
|
});
|
|
17699
|
-
if (!validOptions)
|
|
17700
|
-
return;
|
|
17701
|
-
}
|
|
17311
|
+
if (!validOptions) return;
|
|
17702
17312
|
root2.walkDecls((decl) => {
|
|
17703
|
-
if (!decl.value.includes(`(`))
|
|
17704
|
-
return;
|
|
17705
|
-
}
|
|
17313
|
+
if (!decl.value.includes(`(`)) return;
|
|
17706
17314
|
let fix = null;
|
|
17707
17315
|
let hasFixed = false;
|
|
17708
17316
|
let declValue = getDeclarationValue(decl);
|
|
17709
17317
|
let parsedValue = valueParser(declValue);
|
|
17710
17318
|
parsedValue.walk((valueNode) => {
|
|
17711
|
-
if (valueNode.type !== `function`)
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
if (!isStandardSyntaxFunction(valueNode)) {
|
|
17715
|
-
return;
|
|
17716
|
-
}
|
|
17717
|
-
if (!valueNode.nodes.length) {
|
|
17718
|
-
return;
|
|
17719
|
-
}
|
|
17319
|
+
if (valueNode.type !== `function`) return;
|
|
17320
|
+
if (!isStandardSyntaxFunction(valueNode)) return;
|
|
17321
|
+
if (!valueNode.nodes.length) return;
|
|
17720
17322
|
let functionString = valueParser.stringify(valueNode);
|
|
17721
17323
|
let isSingleLine = isSingleLineString(functionString);
|
|
17722
17324
|
let openingIndex = valueNode.sourceIndex + valueNode.value.length + 1;
|
|
@@ -17778,9 +17380,7 @@ function rule$J(primary) {
|
|
|
17778
17380
|
complain(messages$J.rejectedClosingSingleLine, closingIndex);
|
|
17779
17381
|
}
|
|
17780
17382
|
});
|
|
17781
|
-
if (hasFixed)
|
|
17782
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
17783
|
-
}
|
|
17383
|
+
if (hasFixed) setDeclarationValue(decl, parsedValue.toString());
|
|
17784
17384
|
function complain(message, offset) {
|
|
17785
17385
|
const problemIndex = declarationValueIndex(decl) + offset;
|
|
17786
17386
|
report$y({
|
|
@@ -17808,9 +17408,7 @@ const index$J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17808
17408
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
17809
17409
|
function atRuleParamIndex(atRule2) {
|
|
17810
17410
|
let index2 = 1 + atRule2.name.length;
|
|
17811
|
-
if (atRule2.raws.afterName)
|
|
17812
|
-
index2 += atRule2.raws.afterName.length;
|
|
17813
|
-
}
|
|
17411
|
+
if (atRule2.raws.afterName) index2 += atRule2.raws.afterName.length;
|
|
17814
17412
|
return index2;
|
|
17815
17413
|
}
|
|
17816
17414
|
let { utils: { report: report$x, ruleMessages: ruleMessages$I, validateOptions: validateOptions$I } } = stylelint;
|
|
@@ -17831,9 +17429,7 @@ function rule$I(primary) {
|
|
|
17831
17429
|
actual: primary,
|
|
17832
17430
|
possible: [`always`, `never`]
|
|
17833
17431
|
});
|
|
17834
|
-
if (!validOptions)
|
|
17835
|
-
return;
|
|
17836
|
-
}
|
|
17432
|
+
if (!validOptions) return;
|
|
17837
17433
|
function check(node2, value, nodeIndex, fix) {
|
|
17838
17434
|
styleSearch(
|
|
17839
17435
|
{
|
|
@@ -17848,25 +17444,15 @@ function rule$I(primary) {
|
|
|
17848
17444
|
}
|
|
17849
17445
|
function checkClosingParen(source, index2, node2, nodeIndex, fix) {
|
|
17850
17446
|
let nextChar = source.charAt(index2);
|
|
17851
|
-
if (!nextChar)
|
|
17852
|
-
return;
|
|
17853
|
-
}
|
|
17447
|
+
if (!nextChar) return;
|
|
17854
17448
|
const problemIndex = nodeIndex + index2;
|
|
17855
17449
|
if (primary === `always`) {
|
|
17856
|
-
if (nextChar === ` `)
|
|
17857
|
-
return;
|
|
17858
|
-
}
|
|
17450
|
+
if (nextChar === ` `) return;
|
|
17859
17451
|
if (nextChar === `
|
|
17860
|
-
`)
|
|
17861
|
-
return;
|
|
17862
|
-
}
|
|
17452
|
+
`) return;
|
|
17863
17453
|
if (source.slice(index2, index2 + 2) === `\r
|
|
17864
|
-
`)
|
|
17865
|
-
|
|
17866
|
-
}
|
|
17867
|
-
if (ACCEPTABLE_AFTER_CLOSING_PAREN.has(nextChar)) {
|
|
17868
|
-
return;
|
|
17869
|
-
}
|
|
17454
|
+
`) return;
|
|
17455
|
+
if (ACCEPTABLE_AFTER_CLOSING_PAREN.has(nextChar)) return;
|
|
17870
17456
|
report$x({
|
|
17871
17457
|
message: messages$I.expected,
|
|
17872
17458
|
node: node2,
|
|
@@ -17904,15 +17490,11 @@ function rule$I(primary) {
|
|
|
17904
17490
|
} else if (primary === `never`) {
|
|
17905
17491
|
applyFix = (index2) => {
|
|
17906
17492
|
let whitespaceEndIndex = index2 + 1;
|
|
17907
|
-
while (whitespaceEndIndex < value.length && isWhitespace$1(value.charAt(whitespaceEndIndex)))
|
|
17908
|
-
whitespaceEndIndex++;
|
|
17909
|
-
}
|
|
17493
|
+
while (whitespaceEndIndex < value.length && isWhitespace$1(value.charAt(whitespaceEndIndex))) whitespaceEndIndex++;
|
|
17910
17494
|
fixed += value.slice(lastIndex, index2);
|
|
17911
17495
|
lastIndex = whitespaceEndIndex;
|
|
17912
17496
|
};
|
|
17913
|
-
} else {
|
|
17914
|
-
throw new Error(`Unexpected option: "${primary}"`);
|
|
17915
|
-
}
|
|
17497
|
+
} else throw new Error(`Unexpected option: "${primary}"`);
|
|
17916
17498
|
return {
|
|
17917
17499
|
applyFix,
|
|
17918
17500
|
get hasFixed() {
|
|
@@ -17928,20 +17510,15 @@ function rule$I(primary) {
|
|
|
17928
17510
|
let fixer = createFixer(param);
|
|
17929
17511
|
check(atRule2, param, atRuleParamIndex(atRule2), fixer ? fixer.applyFix : void 0);
|
|
17930
17512
|
if (fixer && fixer.hasFixed) {
|
|
17931
|
-
if (atRule2.raws.params)
|
|
17932
|
-
|
|
17933
|
-
} else {
|
|
17934
|
-
atRule2.params = fixer.fixed;
|
|
17935
|
-
}
|
|
17513
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = fixer.fixed;
|
|
17514
|
+
else atRule2.params = fixer.fixed;
|
|
17936
17515
|
}
|
|
17937
17516
|
});
|
|
17938
17517
|
root2.walkDecls((decl) => {
|
|
17939
17518
|
let value = getDeclarationValue(decl);
|
|
17940
17519
|
let fixer = createFixer(value);
|
|
17941
17520
|
check(decl, value, declarationValueIndex(decl), fixer ? fixer.applyFix : void 0);
|
|
17942
|
-
if (fixer && fixer.hasFixed)
|
|
17943
|
-
setDeclarationValue(decl, fixer.fixed);
|
|
17944
|
-
}
|
|
17521
|
+
if (fixer && fixer.hasFixed) setDeclarationValue(decl, fixer.fixed);
|
|
17945
17522
|
});
|
|
17946
17523
|
};
|
|
17947
17524
|
}
|
|
@@ -17958,9 +17535,7 @@ const index$I = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17958
17535
|
function isStyledSyntaxDeclaration(declaration2) {
|
|
17959
17536
|
let parent = declaration2.parent;
|
|
17960
17537
|
while (parent) {
|
|
17961
|
-
if (parent.raws.styledSyntaxRangeStart !== void 0)
|
|
17962
|
-
return true;
|
|
17963
|
-
}
|
|
17538
|
+
if (parent.raws.styledSyntaxRangeStart !== void 0) return true;
|
|
17964
17539
|
parent = parent.parent;
|
|
17965
17540
|
}
|
|
17966
17541
|
return false;
|
|
@@ -17999,9 +17574,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
17999
17574
|
optional: true
|
|
18000
17575
|
}
|
|
18001
17576
|
);
|
|
18002
|
-
if (!validOptions)
|
|
18003
|
-
return;
|
|
18004
|
-
}
|
|
17577
|
+
if (!validOptions) return;
|
|
18005
17578
|
let spaceCount = isNumber$1(primary) ? primary : null;
|
|
18006
17579
|
let indentChar = spaceCount === null ? ` ` : ` `.repeat(spaceCount);
|
|
18007
17580
|
let warningWord = primary === `tab` ? `tab` : `space`;
|
|
@@ -18021,9 +17594,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18021
17594
|
let before = (node2.raws.before || ``).replace(/[*_]$/, ``);
|
|
18022
17595
|
let after = typeof node2.raws.after === `string` ? node2.raws.after : ``;
|
|
18023
17596
|
let parent = node2.parent;
|
|
18024
|
-
if (!parent)
|
|
18025
|
-
throw new Error(`A parent node must be present`);
|
|
18026
|
-
}
|
|
17597
|
+
if (!parent) throw new Error(`A parent node must be present`);
|
|
18027
17598
|
let expectedOpeningBraceIndentation = indentChar.repeat(nodeLevel);
|
|
18028
17599
|
let isFirstChild = parent.type === `root` && parent.first === node2;
|
|
18029
17600
|
let lastIndexOfNewline = before.lastIndexOf(`
|
|
@@ -18037,9 +17608,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18037
17608
|
result: result2,
|
|
18038
17609
|
ruleName: ruleName$H,
|
|
18039
17610
|
fix() {
|
|
18040
|
-
if (isFirstChild && isString(node2.raws.before))
|
|
18041
|
-
node2.raws.before = node2.raws.before.replace(/^[ \t]*(?=\S|$)/, expectedOpeningBraceIndentation);
|
|
18042
|
-
}
|
|
17611
|
+
if (isFirstChild && isString(node2.raws.before)) node2.raws.before = node2.raws.before.replace(/^[ \t]*(?=\S|$)/, expectedOpeningBraceIndentation);
|
|
18043
17612
|
node2.raws.before = fixIndentation(node2.raws.before, expectedOpeningBraceIndentation);
|
|
18044
17613
|
}
|
|
18045
17614
|
});
|
|
@@ -18063,15 +17632,9 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18063
17632
|
}
|
|
18064
17633
|
});
|
|
18065
17634
|
}
|
|
18066
|
-
if (isDeclaration(node2))
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
if (isRule(node2)) {
|
|
18070
|
-
checkSelector(node2, nodeLevel);
|
|
18071
|
-
}
|
|
18072
|
-
if (isAtRule(node2)) {
|
|
18073
|
-
checkAtRuleParams(node2, nodeLevel);
|
|
18074
|
-
}
|
|
17635
|
+
if (isDeclaration(node2)) checkValue(node2, nodeLevel);
|
|
17636
|
+
if (isRule(node2)) checkSelector(node2, nodeLevel);
|
|
17637
|
+
if (isAtRule(node2)) checkAtRuleParams(node2, nodeLevel);
|
|
18075
17638
|
});
|
|
18076
17639
|
function getStyledDeclarationLevel(node2) {
|
|
18077
17640
|
const expressionStartLine = node2.parent.parent.source.input.css.split(`
|
|
@@ -18080,62 +17643,42 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18080
17643
|
return Math.ceil(indentCharacters.length / indentChar.length);
|
|
18081
17644
|
}
|
|
18082
17645
|
function indentationLevel(node2, level = 0) {
|
|
18083
|
-
if (!node2.parent)
|
|
18084
|
-
throw new Error(`A parent node must be present`);
|
|
18085
|
-
}
|
|
17646
|
+
if (!node2.parent) throw new Error(`A parent node must be present`);
|
|
18086
17647
|
if (isStyledSyntaxNode(node2)) {
|
|
18087
17648
|
const isMultilineDeclaration = !!node2.parent.source?.input.css.includes(`
|
|
18088
17649
|
`);
|
|
18089
17650
|
if (isMultilineDeclaration) level++;
|
|
18090
17651
|
level += getStyledDeclarationLevel(node2);
|
|
18091
17652
|
}
|
|
18092
|
-
if (isRoot(node2.parent))
|
|
18093
|
-
return level + getRootBaseIndentLevel(node2.parent, baseIndentLevel, primary);
|
|
18094
|
-
}
|
|
17653
|
+
if (isRoot(node2.parent)) return level + getRootBaseIndentLevel(node2.parent, baseIndentLevel, primary);
|
|
18095
17654
|
let calculatedLevel;
|
|
18096
17655
|
calculatedLevel = indentationLevel(node2.parent, level + 1);
|
|
18097
|
-
if (optionsMatches(secondaryOptions, `except`, `block`) && (isRule(node2) || isAtRule(node2)) && hasBlock(node2))
|
|
18098
|
-
calculatedLevel--;
|
|
18099
|
-
}
|
|
17656
|
+
if (optionsMatches(secondaryOptions, `except`, `block`) && (isRule(node2) || isAtRule(node2)) && hasBlock(node2)) calculatedLevel--;
|
|
18100
17657
|
return calculatedLevel;
|
|
18101
17658
|
}
|
|
18102
17659
|
function checkValue(decl, declLevel) {
|
|
18103
17660
|
if (!decl.value.includes(`
|
|
18104
|
-
`))
|
|
18105
|
-
|
|
18106
|
-
|
|
18107
|
-
if (isStyledSyntaxDeclaration(decl) && decl.value.includes(`\${`)) {
|
|
18108
|
-
return;
|
|
18109
|
-
}
|
|
18110
|
-
if (optionsMatches(secondaryOptions, `ignore`, `value`)) {
|
|
18111
|
-
return;
|
|
18112
|
-
}
|
|
17661
|
+
`)) return;
|
|
17662
|
+
if (isStyledSyntaxDeclaration(decl) && decl.value.includes(`\${`)) return;
|
|
17663
|
+
if (optionsMatches(secondaryOptions, `ignore`, `value`)) return;
|
|
18113
17664
|
let declString = decl.toString();
|
|
18114
17665
|
let valueLevel = optionsMatches(secondaryOptions, `except`, `value`) ? declLevel : declLevel + 1;
|
|
18115
17666
|
checkMultilineBit(declString, valueLevel, decl);
|
|
18116
17667
|
}
|
|
18117
17668
|
function checkSelector(ruleNode, ruleLevel) {
|
|
18118
17669
|
let selector2 = ruleNode.selector;
|
|
18119
|
-
if (ruleNode.params)
|
|
18120
|
-
|
|
18121
|
-
}
|
|
18122
|
-
if (selector2.match(/:\w+\(\s*\r?\n/)) {
|
|
18123
|
-
ruleLevel += 1;
|
|
18124
|
-
}
|
|
17670
|
+
if (ruleNode.params) ruleLevel += 1;
|
|
17671
|
+
if (selector2.match(/:\w+\(\s*\r?\n/)) ruleLevel += 1;
|
|
18125
17672
|
checkMultilineBit(selector2, ruleLevel, ruleNode);
|
|
18126
17673
|
}
|
|
18127
17674
|
function checkAtRuleParams(atRule2, ruleLevel) {
|
|
18128
|
-
if (optionsMatches(secondaryOptions, `ignore`, `param`))
|
|
18129
|
-
return;
|
|
18130
|
-
}
|
|
17675
|
+
if (optionsMatches(secondaryOptions, `ignore`, `param`)) return;
|
|
18131
17676
|
let paramLevel = optionsMatches(secondaryOptions, `except`, `param`) || atRule2.name === `nest` || atRule2.name === `at-root` ? ruleLevel : ruleLevel + 1;
|
|
18132
17677
|
checkMultilineBit(beforeBlockString(atRule2).trim(), paramLevel, atRule2);
|
|
18133
17678
|
}
|
|
18134
17679
|
function checkMultilineBit(source, newlineIndentLevel, node2) {
|
|
18135
17680
|
if (!source.includes(`
|
|
18136
|
-
`))
|
|
18137
|
-
return;
|
|
18138
|
-
}
|
|
17681
|
+
`)) return;
|
|
18139
17682
|
let fixPositions = [];
|
|
18140
17683
|
let parentheticalDepth = 0;
|
|
18141
17684
|
let ignoreInsideParans = optionsMatches(secondaryOptions, `ignore`, `inside-parens`);
|
|
@@ -18149,61 +17692,37 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18149
17692
|
},
|
|
18150
17693
|
(match, matchCount) => {
|
|
18151
17694
|
let precedesClosingParenthesis = /^[ \t]*\)/.test(source.slice(match.startIndex + 1));
|
|
18152
|
-
if (ignoreInsideParans && (precedesClosingParenthesis || match.insideParens))
|
|
18153
|
-
return;
|
|
18154
|
-
}
|
|
17695
|
+
if (ignoreInsideParans && (precedesClosingParenthesis || match.insideParens)) return;
|
|
18155
17696
|
let expectedIndentLevel = newlineIndentLevel;
|
|
18156
17697
|
if (!ignoreInsideParans && match.insideParens) {
|
|
18157
|
-
if (matchCount === 1)
|
|
18158
|
-
parentheticalDepth -= 1;
|
|
18159
|
-
}
|
|
17698
|
+
if (matchCount === 1) parentheticalDepth -= 1;
|
|
18160
17699
|
let newlineIndex = match.startIndex;
|
|
18161
|
-
if (source[match.startIndex - 1] === `\r`)
|
|
18162
|
-
newlineIndex--;
|
|
18163
|
-
}
|
|
17700
|
+
if (source[match.startIndex - 1] === `\r`) newlineIndex--;
|
|
18164
17701
|
let followsOpeningParenthesis = /\([ \t]*$/.test(source.slice(0, newlineIndex));
|
|
18165
|
-
if (followsOpeningParenthesis)
|
|
18166
|
-
parentheticalDepth += 1;
|
|
18167
|
-
}
|
|
17702
|
+
if (followsOpeningParenthesis) parentheticalDepth += 1;
|
|
18168
17703
|
let followsOpeningBrace = /\{[ \t]*$/.test(source.slice(0, newlineIndex));
|
|
18169
|
-
if (followsOpeningBrace)
|
|
18170
|
-
parentheticalDepth += 1;
|
|
18171
|
-
}
|
|
17704
|
+
if (followsOpeningBrace) parentheticalDepth += 1;
|
|
18172
17705
|
let startingClosingBrace = /^[ \t]*\}/.test(source.slice(match.startIndex + 1));
|
|
18173
|
-
if (startingClosingBrace)
|
|
18174
|
-
parentheticalDepth -= 1;
|
|
18175
|
-
}
|
|
17706
|
+
if (startingClosingBrace) parentheticalDepth -= 1;
|
|
18176
17707
|
expectedIndentLevel += parentheticalDepth;
|
|
18177
|
-
if (precedesClosingParenthesis)
|
|
18178
|
-
parentheticalDepth -= 1;
|
|
18179
|
-
}
|
|
17708
|
+
if (precedesClosingParenthesis) parentheticalDepth -= 1;
|
|
18180
17709
|
switch (secondaryOptions.indentInsideParens) {
|
|
18181
17710
|
case `twice`:
|
|
18182
|
-
if (!precedesClosingParenthesis || indentClosingBrace)
|
|
18183
|
-
expectedIndentLevel += 1;
|
|
18184
|
-
}
|
|
17711
|
+
if (!precedesClosingParenthesis || indentClosingBrace) expectedIndentLevel += 1;
|
|
18185
17712
|
break;
|
|
18186
17713
|
case `once-at-root-twice-in-block`:
|
|
18187
17714
|
if (node2.parent === node2.root()) {
|
|
18188
|
-
if (precedesClosingParenthesis && !indentClosingBrace)
|
|
18189
|
-
expectedIndentLevel -= 1;
|
|
18190
|
-
}
|
|
17715
|
+
if (precedesClosingParenthesis && !indentClosingBrace) expectedIndentLevel -= 1;
|
|
18191
17716
|
break;
|
|
18192
17717
|
}
|
|
18193
|
-
if (!precedesClosingParenthesis || indentClosingBrace)
|
|
18194
|
-
expectedIndentLevel += 1;
|
|
18195
|
-
}
|
|
17718
|
+
if (!precedesClosingParenthesis || indentClosingBrace) expectedIndentLevel += 1;
|
|
18196
17719
|
break;
|
|
18197
17720
|
default:
|
|
18198
|
-
if (precedesClosingParenthesis && !indentClosingBrace)
|
|
18199
|
-
expectedIndentLevel -= 1;
|
|
18200
|
-
}
|
|
17721
|
+
if (precedesClosingParenthesis && !indentClosingBrace) expectedIndentLevel -= 1;
|
|
18201
17722
|
}
|
|
18202
17723
|
}
|
|
18203
17724
|
let afterNewlineSpaceMatches = /^([ \t]*)\S/.exec(source.slice(match.startIndex + 1));
|
|
18204
|
-
if (!afterNewlineSpaceMatches)
|
|
18205
|
-
return;
|
|
18206
|
-
}
|
|
17725
|
+
if (!afterNewlineSpaceMatches) return;
|
|
18207
17726
|
let afterNewlineSpace = afterNewlineSpaceMatches[1] || ``;
|
|
18208
17727
|
let expectedIndentation = indentChar.repeat(
|
|
18209
17728
|
expectedIndentLevel > 0 ? expectedIndentLevel : 0
|
|
@@ -18243,9 +17762,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18243
17762
|
if (isDeclaration(node2)) {
|
|
18244
17763
|
let declProp = node2.prop;
|
|
18245
17764
|
let declBetween = node2.raws.between;
|
|
18246
|
-
if (!isString(declBetween))
|
|
18247
|
-
throw new TypeError(`The \`between\` property must be a string`);
|
|
18248
|
-
}
|
|
17765
|
+
if (!isString(declBetween)) throw new TypeError(`The \`between\` property must be a string`);
|
|
18249
17766
|
for (let fixPosition of fixPositions) {
|
|
18250
17767
|
if (fixPosition.startIndex < declProp.length + declBetween.length) {
|
|
18251
17768
|
node2.raws.between = replaceIndentation(
|
|
@@ -18268,9 +17785,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18268
17785
|
let atRuleName = node2.name;
|
|
18269
17786
|
let atRuleAfterName = node2.raws.afterName;
|
|
18270
17787
|
let atRuleParams = node2.params;
|
|
18271
|
-
if (!isString(atRuleAfterName))
|
|
18272
|
-
throw new TypeError(`The \`afterName\` property must be a string`);
|
|
18273
|
-
}
|
|
17788
|
+
if (!isString(atRuleAfterName)) throw new TypeError(`The \`afterName\` property must be a string`);
|
|
18274
17789
|
for (let fixPosition of fixPositions) {
|
|
18275
17790
|
if (fixPosition.startIndex < 1 + atRuleName.length + atRuleAfterName.length) {
|
|
18276
17791
|
node2.raws.afterName = replaceIndentation(
|
|
@@ -18295,38 +17810,26 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18295
17810
|
}
|
|
18296
17811
|
function getRootBaseIndentLevel(root2, baseIndentLevel, space) {
|
|
18297
17812
|
let document2 = getDocument(root2);
|
|
18298
|
-
if (!document2)
|
|
18299
|
-
|
|
18300
|
-
}
|
|
18301
|
-
if (!root2.source) {
|
|
18302
|
-
throw new Error(`The root node must have a source`);
|
|
18303
|
-
}
|
|
17813
|
+
if (!document2) return 0;
|
|
17814
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
18304
17815
|
let source = root2.source;
|
|
18305
17816
|
let indentLevel = source.baseIndentLevel;
|
|
18306
|
-
if (isNumber$1(indentLevel) && Number.isSafeInteger(indentLevel))
|
|
18307
|
-
return indentLevel;
|
|
18308
|
-
}
|
|
17817
|
+
if (isNumber$1(indentLevel) && Number.isSafeInteger(indentLevel)) return indentLevel;
|
|
18309
17818
|
let newIndentLevel = inferRootIndentLevel(root2, baseIndentLevel, () => inferDocIndentSize(document2, space));
|
|
18310
17819
|
source.baseIndentLevel = newIndentLevel;
|
|
18311
17820
|
return newIndentLevel;
|
|
18312
17821
|
}
|
|
18313
17822
|
function getDocument(node2) {
|
|
18314
17823
|
let document2 = node2.document;
|
|
18315
|
-
if (document2)
|
|
18316
|
-
return document2;
|
|
18317
|
-
}
|
|
17824
|
+
if (document2) return document2;
|
|
18318
17825
|
let root2 = node2.root();
|
|
18319
17826
|
return root2 && root2.document;
|
|
18320
17827
|
}
|
|
18321
17828
|
function inferDocIndentSize(document2, space) {
|
|
18322
|
-
if (!document2.source)
|
|
18323
|
-
throw new Error(`The document node must have a source`);
|
|
18324
|
-
}
|
|
17829
|
+
if (!document2.source) throw new Error(`The document node must have a source`);
|
|
18325
17830
|
let docSource = document2.source;
|
|
18326
17831
|
let indentSize = docSource.indentSize;
|
|
18327
|
-
if (isNumber$1(indentSize) && Number.isSafeInteger(indentSize))
|
|
18328
|
-
return indentSize;
|
|
18329
|
-
}
|
|
17832
|
+
if (isNumber$1(indentSize) && Number.isSafeInteger(indentSize)) return indentSize;
|
|
18330
17833
|
let source = document2.source.input.css;
|
|
18331
17834
|
let indents = source.match(/^ *(?=\S)/gm);
|
|
18332
17835
|
if (indents) {
|
|
@@ -18335,23 +17838,16 @@ function inferDocIndentSize(document2, space) {
|
|
|
18335
17838
|
lastIndentSize = Math.abs(leadingSpacesLength - lastLeadingSpacesLength) || lastIndentSize;
|
|
18336
17839
|
if (lastIndentSize > 1) {
|
|
18337
17840
|
let score = scores.get(lastIndentSize);
|
|
18338
|
-
if (score)
|
|
18339
|
-
|
|
18340
|
-
} else {
|
|
18341
|
-
scores.set(lastIndentSize, 1);
|
|
18342
|
-
}
|
|
17841
|
+
if (score) scores.set(lastIndentSize, score + 1);
|
|
17842
|
+
else scores.set(lastIndentSize, 1);
|
|
18343
17843
|
}
|
|
18344
|
-
} else
|
|
18345
|
-
lastIndentSize = 0;
|
|
18346
|
-
}
|
|
17844
|
+
} else lastIndentSize = 0;
|
|
18347
17845
|
lastLeadingSpacesLength = leadingSpacesLength;
|
|
18348
17846
|
};
|
|
18349
17847
|
let scores = /* @__PURE__ */ new Map();
|
|
18350
17848
|
let lastIndentSize = 0;
|
|
18351
17849
|
let lastLeadingSpacesLength = 0;
|
|
18352
|
-
for (let leadingSpaces of indents)
|
|
18353
|
-
vote(leadingSpaces.length);
|
|
18354
|
-
}
|
|
17850
|
+
for (let leadingSpaces of indents) vote(leadingSpaces.length);
|
|
18355
17851
|
let bestScore = 0;
|
|
18356
17852
|
for (let [indentSizeDate, score] of scores.entries()) {
|
|
18357
17853
|
if (score > bestScore) {
|
|
@@ -18374,25 +17870,17 @@ function inferRootIndentLevel(root2, baseIndentLevel, indentSize) {
|
|
|
18374
17870
|
}
|
|
18375
17871
|
let newBaseIndentLevel = 0;
|
|
18376
17872
|
if (!isNumber$1(baseIndentLevel) || !Number.isSafeInteger(baseIndentLevel)) {
|
|
18377
|
-
if (!root2.source)
|
|
18378
|
-
throw new Error(`The root node must have a source`);
|
|
18379
|
-
}
|
|
17873
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
18380
17874
|
let source = root2.source.input.css;
|
|
18381
17875
|
source = source.replace(/^[^\r\n]+/, (firstLine) => {
|
|
18382
17876
|
let match = root2.raws.codeBefore && /(?:^|\n)([ \t]*)$/.exec(root2.raws.codeBefore);
|
|
18383
|
-
if (match)
|
|
18384
|
-
return match[1] + firstLine;
|
|
18385
|
-
}
|
|
17877
|
+
if (match) return match[1] + firstLine;
|
|
18386
17878
|
return ``;
|
|
18387
17879
|
});
|
|
18388
17880
|
let indentions = source.match(/^[ \t]*(?=\S)/gm);
|
|
18389
|
-
if (indentions)
|
|
18390
|
-
return Math.min(...indentions.map((indent) => getIndentLevel(indent)));
|
|
18391
|
-
}
|
|
17881
|
+
if (indentions) return Math.min(...indentions.map((indent) => getIndentLevel(indent)));
|
|
18392
17882
|
newBaseIndentLevel = 1;
|
|
18393
|
-
} else
|
|
18394
|
-
newBaseIndentLevel = baseIndentLevel;
|
|
18395
|
-
}
|
|
17883
|
+
} else newBaseIndentLevel = baseIndentLevel;
|
|
18396
17884
|
let indents = [];
|
|
18397
17885
|
let foundIndents = root2.raws.codeBefore?.match(/(?:^|\n)([\t ]*)\S/gm);
|
|
18398
17886
|
if (foundIndents) {
|
|
@@ -18419,28 +17907,18 @@ function inferRootIndentLevel(root2, baseIndentLevel, indentSize) {
|
|
|
18419
17907
|
afterEnd = nextRoot ? nextRoot.raws.codeBefore : document2.raws.codeAfter;
|
|
18420
17908
|
} else {
|
|
18421
17909
|
let parent = root2.parent;
|
|
18422
|
-
if (!parent)
|
|
18423
|
-
throw new Error(`The root node must have a parent`);
|
|
18424
|
-
}
|
|
17910
|
+
if (!parent) throw new Error(`The root node must have a parent`);
|
|
18425
17911
|
let nextRoot = parent.nodes[parent.nodes.indexOf(root2) + 1];
|
|
18426
17912
|
afterEnd = nextRoot ? nextRoot.raws.codeBefore : root2.raws.codeAfter;
|
|
18427
17913
|
}
|
|
18428
|
-
} else
|
|
18429
|
-
|
|
18430
|
-
}
|
|
18431
|
-
if (afterEnd) {
|
|
18432
|
-
indents.push(afterEnd.match(/^[ \t]*/)[0]);
|
|
18433
|
-
}
|
|
18434
|
-
}
|
|
18435
|
-
if (indents.length) {
|
|
18436
|
-
return Math.max(...indents.map((indent) => getIndentLevel(indent))) + newBaseIndentLevel;
|
|
17914
|
+
} else afterEnd = after;
|
|
17915
|
+
if (afterEnd) indents.push(afterEnd.match(/^[ \t]*/)[0]);
|
|
18437
17916
|
}
|
|
17917
|
+
if (indents.length) return Math.max(...indents.map((indent) => getIndentLevel(indent))) + newBaseIndentLevel;
|
|
18438
17918
|
return newBaseIndentLevel;
|
|
18439
17919
|
}
|
|
18440
17920
|
function fixIndentation(str, whitespace) {
|
|
18441
|
-
if (!isString(str))
|
|
18442
|
-
return str;
|
|
18443
|
-
}
|
|
17921
|
+
if (!isString(str)) return str;
|
|
18444
17922
|
return str.replace(/\n[ \t]*(?=\S|$)/g, `
|
|
18445
17923
|
${whitespace}`);
|
|
18446
17924
|
}
|
|
@@ -18476,42 +17954,24 @@ function rule$G(primary) {
|
|
|
18476
17954
|
actual: primary,
|
|
18477
17955
|
possible: [`unix`, `windows`]
|
|
18478
17956
|
});
|
|
18479
|
-
if (!validOptions)
|
|
18480
|
-
return;
|
|
18481
|
-
}
|
|
17957
|
+
if (!validOptions) return;
|
|
18482
17958
|
let shouldHaveCR = primary === `windows`;
|
|
18483
17959
|
function fix() {
|
|
18484
17960
|
root2.walk((node2) => {
|
|
18485
|
-
if (`selector` in node2)
|
|
18486
|
-
|
|
18487
|
-
|
|
18488
|
-
if (
|
|
18489
|
-
|
|
18490
|
-
}
|
|
18491
|
-
if (`text` in node2) {
|
|
18492
|
-
node2.text = fixData(node2.text);
|
|
18493
|
-
}
|
|
18494
|
-
if (node2.raws.before) {
|
|
18495
|
-
node2.raws.before = fixData(node2.raws.before);
|
|
18496
|
-
}
|
|
18497
|
-
if (typeof node2.raws.after === `string`) {
|
|
18498
|
-
node2.raws.after = fixData(node2.raws.after);
|
|
18499
|
-
}
|
|
17961
|
+
if (`selector` in node2) node2.selector = fixData(node2.selector);
|
|
17962
|
+
if (`value` in node2) node2.value = fixData(node2.value);
|
|
17963
|
+
if (`text` in node2) node2.text = fixData(node2.text);
|
|
17964
|
+
if (node2.raws.before) node2.raws.before = fixData(node2.raws.before);
|
|
17965
|
+
if (typeof node2.raws.after === `string`) node2.raws.after = fixData(node2.raws.after);
|
|
18500
17966
|
});
|
|
18501
|
-
if (typeof root2.raws.after === `string`)
|
|
18502
|
-
root2.raws.after = fixData(root2.raws.after);
|
|
18503
|
-
}
|
|
18504
|
-
}
|
|
18505
|
-
if (root2.source === null) {
|
|
18506
|
-
throw new Error(`The root node must have a source`);
|
|
17967
|
+
if (typeof root2.raws.after === `string`) root2.raws.after = fixData(root2.raws.after);
|
|
18507
17968
|
}
|
|
17969
|
+
if (root2.source === null) throw new Error(`The root node must have a source`);
|
|
18508
17970
|
let lines = root2.source.input.css.split(`
|
|
18509
17971
|
`);
|
|
18510
17972
|
for (let [i2, line] of lines.entries()) {
|
|
18511
|
-
if (i2 < lines.length - 1 && !line.includes(`\r`))
|
|
18512
|
-
line += `
|
|
17973
|
+
if (i2 < lines.length - 1 && !line.includes(`\r`)) line += `
|
|
18513
17974
|
`;
|
|
18514
|
-
}
|
|
18515
17975
|
if (hasError(line)) {
|
|
18516
17976
|
let lineNum = i2 + 1;
|
|
18517
17977
|
let colNum = line.length;
|
|
@@ -18526,10 +17986,8 @@ function rule$G(primary) {
|
|
|
18526
17986
|
function fixData(data) {
|
|
18527
17987
|
if (data) {
|
|
18528
17988
|
let res = data.replace(/\r/g, ``);
|
|
18529
|
-
if (shouldHaveCR)
|
|
18530
|
-
res = res.replace(/\n/g, `\r
|
|
17989
|
+
if (shouldHaveCR) res = res.replace(/\n/g, `\r
|
|
18531
17990
|
`);
|
|
18532
|
-
}
|
|
18533
17991
|
return res;
|
|
18534
17992
|
}
|
|
18535
17993
|
return data;
|
|
@@ -18591,9 +18049,7 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18591
18049
|
optional: true
|
|
18592
18050
|
}
|
|
18593
18051
|
);
|
|
18594
|
-
if (!validOptions)
|
|
18595
|
-
return;
|
|
18596
|
-
}
|
|
18052
|
+
if (!validOptions) return;
|
|
18597
18053
|
let ignoreComments = optionsMatches(secondaryOptions, `ignore`, `comments`);
|
|
18598
18054
|
let getChars = replaceEmptyLines.bind(null, primary);
|
|
18599
18055
|
function fix() {
|
|
@@ -18602,16 +18058,12 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18602
18058
|
node2.raws.left = getChars(node2.raws.left);
|
|
18603
18059
|
node2.raws.right = getChars(node2.raws.right);
|
|
18604
18060
|
}
|
|
18605
|
-
if (node2.raws.before)
|
|
18606
|
-
node2.raws.before = getChars(node2.raws.before);
|
|
18607
|
-
}
|
|
18061
|
+
if (node2.raws.before) node2.raws.before = getChars(node2.raws.before);
|
|
18608
18062
|
});
|
|
18609
18063
|
let firstNodeRawsBefore = root2.first && root2.first.raws.before;
|
|
18610
18064
|
let rootRawsAfter = root2.raws.after;
|
|
18611
18065
|
if ((root2.document && root2.document.constructor.name) !== `Document`) {
|
|
18612
|
-
if (firstNodeRawsBefore)
|
|
18613
|
-
root2.first.raws.before = getChars(firstNodeRawsBefore, true);
|
|
18614
|
-
}
|
|
18066
|
+
if (firstNodeRawsBefore) root2.first.raws.before = getChars(firstNodeRawsBefore, true);
|
|
18615
18067
|
if (rootRawsAfter) {
|
|
18616
18068
|
root2.raws.after = replaceEmptyLines(primary === 0 ? 1 : primary, rootRawsAfter, true);
|
|
18617
18069
|
}
|
|
@@ -18637,18 +18089,11 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18637
18089
|
function checkMatch(source, matchStartIndex, matchEndIndex, node2) {
|
|
18638
18090
|
let eof = matchEndIndex === source.length;
|
|
18639
18091
|
let problem = false;
|
|
18640
|
-
if (!matchStartIndex || lastIndex === matchStartIndex)
|
|
18641
|
-
|
|
18642
|
-
} else {
|
|
18643
|
-
emptyLines = 0;
|
|
18644
|
-
}
|
|
18092
|
+
if (!matchStartIndex || lastIndex === matchStartIndex) emptyLines++;
|
|
18093
|
+
else emptyLines = 0;
|
|
18645
18094
|
lastIndex = matchEndIndex;
|
|
18646
|
-
if (emptyLines > primary)
|
|
18647
|
-
|
|
18648
|
-
}
|
|
18649
|
-
if (!eof && !problem) {
|
|
18650
|
-
return;
|
|
18651
|
-
}
|
|
18095
|
+
if (emptyLines > primary) problem = true;
|
|
18096
|
+
if (!eof && !problem) return;
|
|
18652
18097
|
if (problem) {
|
|
18653
18098
|
report$u({
|
|
18654
18099
|
message: messages$F.expected,
|
|
@@ -18679,35 +18124,26 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18679
18124
|
}
|
|
18680
18125
|
function replaceEmptyLines(maxLines, str, isSpecialCase = false) {
|
|
18681
18126
|
let repeatTimes = isSpecialCase ? maxLines : maxLines + 1;
|
|
18682
|
-
if (repeatTimes === 0 || typeof str !== `string`)
|
|
18683
|
-
return ``;
|
|
18684
|
-
}
|
|
18127
|
+
if (repeatTimes === 0 || typeof str !== `string`) return ``;
|
|
18685
18128
|
let emptyLFLines = `
|
|
18686
18129
|
`.repeat(repeatTimes);
|
|
18687
18130
|
let emptyCRLFLines = `\r
|
|
18688
18131
|
`.repeat(repeatTimes);
|
|
18689
18132
|
return /(?:\r\n)+/.test(str) ? str.replace(/(\r\n)+/g, ($1) => {
|
|
18690
|
-
if ($1.length / 2 > repeatTimes)
|
|
18691
|
-
return emptyCRLFLines;
|
|
18692
|
-
}
|
|
18133
|
+
if ($1.length / 2 > repeatTimes) return emptyCRLFLines;
|
|
18693
18134
|
return $1;
|
|
18694
18135
|
}) : str.replace(/(\n)+/g, ($1) => {
|
|
18695
|
-
if ($1.length > repeatTimes)
|
|
18696
|
-
return emptyLFLines;
|
|
18697
|
-
}
|
|
18136
|
+
if ($1.length > repeatTimes) return emptyLFLines;
|
|
18698
18137
|
return $1;
|
|
18699
18138
|
});
|
|
18700
18139
|
}
|
|
18701
18140
|
};
|
|
18702
18141
|
}
|
|
18703
18142
|
function isEofNode(document2, root2) {
|
|
18704
|
-
if (!document2 || document2.constructor.name !== `Document` || !(`type` in document2))
|
|
18705
|
-
return true;
|
|
18706
|
-
}
|
|
18143
|
+
if (!document2 || document2.constructor.name !== `Document` || !(`type` in document2)) return true;
|
|
18707
18144
|
let after;
|
|
18708
|
-
if (root2 === document2.last)
|
|
18709
|
-
|
|
18710
|
-
} else {
|
|
18145
|
+
if (root2 === document2.last) after = document2.raws && document2.raws.codeAfter;
|
|
18146
|
+
else {
|
|
18711
18147
|
let rootIndex = document2.index(root2);
|
|
18712
18148
|
let nextNode = document2.nodes[rootIndex + 1];
|
|
18713
18149
|
after = nextNode && nextNode.raws && nextNode.raws.codeBefore;
|
|
@@ -18751,12 +18187,8 @@ function rule$E(primary, secondaryOptions) {
|
|
|
18751
18187
|
optional: true
|
|
18752
18188
|
}
|
|
18753
18189
|
);
|
|
18754
|
-
if (!validOptions)
|
|
18755
|
-
|
|
18756
|
-
}
|
|
18757
|
-
if (root2.source === null) {
|
|
18758
|
-
throw new Error(`The root node must have a source`);
|
|
18759
|
-
}
|
|
18190
|
+
if (!validOptions) return;
|
|
18191
|
+
if (root2.source === null) throw new Error(`The root node must have a source`);
|
|
18760
18192
|
let EXCLUDED_PATTERNS = [
|
|
18761
18193
|
/url\(\s*(\S.*\S)\s*\)/gi,
|
|
18762
18194
|
// allow tab, whitespace in url content
|
|
@@ -18793,57 +18225,35 @@ function rule$E(primary, secondaryOptions) {
|
|
|
18793
18225
|
let skippedSubString = skippedSubStrings[skippedSubStringsIndex];
|
|
18794
18226
|
assert(skippedSubString);
|
|
18795
18227
|
let [startSubString, endSubString] = skippedSubString;
|
|
18796
|
-
if (end < startSubString)
|
|
18797
|
-
return 0;
|
|
18798
|
-
}
|
|
18228
|
+
if (end < startSubString) return 0;
|
|
18799
18229
|
let excluded = Math.min(end, endSubString) - Math.max(start, startSubString);
|
|
18800
|
-
if (endSubString <= end)
|
|
18801
|
-
skippedSubStringsIndex++;
|
|
18802
|
-
}
|
|
18230
|
+
if (endSubString <= end) skippedSubStringsIndex++;
|
|
18803
18231
|
return excluded;
|
|
18804
18232
|
}
|
|
18805
18233
|
function checkNewline(match) {
|
|
18806
18234
|
let nextNewlineIndex = rootString.indexOf(`
|
|
18807
18235
|
`, match.endIndex);
|
|
18808
|
-
if (rootString[nextNewlineIndex - 1] === `\r`)
|
|
18809
|
-
|
|
18810
|
-
}
|
|
18811
|
-
if (nextNewlineIndex === -1) {
|
|
18812
|
-
nextNewlineIndex = rootString.length;
|
|
18813
|
-
}
|
|
18236
|
+
if (rootString[nextNewlineIndex - 1] === `\r`) nextNewlineIndex -= 1;
|
|
18237
|
+
if (nextNewlineIndex === -1) nextNewlineIndex = rootString.length;
|
|
18814
18238
|
let rawLineLength = nextNewlineIndex - match.endIndex;
|
|
18815
18239
|
let excludedLength = skippedSubStrings[skippedSubStringsIndex] ? tryToPopSubString(match.endIndex, nextNewlineIndex) : 0;
|
|
18816
18240
|
let lineText = rootString.slice(match.endIndex, nextNewlineIndex);
|
|
18817
|
-
if (optionsMatches(secondaryOptions, `ignorePattern`, lineText))
|
|
18818
|
-
|
|
18819
|
-
}
|
|
18820
|
-
if (rawLineLength - excludedLength <= primary) {
|
|
18821
|
-
return;
|
|
18822
|
-
}
|
|
18241
|
+
if (optionsMatches(secondaryOptions, `ignorePattern`, lineText)) return;
|
|
18242
|
+
if (rawLineLength - excludedLength <= primary) return;
|
|
18823
18243
|
let complaintIndex = nextNewlineIndex - 1;
|
|
18824
18244
|
if (ignoreComments) {
|
|
18825
|
-
if (`insideComment` in match && match.insideComment)
|
|
18826
|
-
return;
|
|
18827
|
-
}
|
|
18245
|
+
if (`insideComment` in match && match.insideComment) return;
|
|
18828
18246
|
let nextTwoChars = rootString.slice(match.endIndex).trim().slice(0, 2);
|
|
18829
|
-
if (nextTwoChars === `/*` || nextTwoChars === `//`)
|
|
18830
|
-
return;
|
|
18831
|
-
}
|
|
18247
|
+
if (nextTwoChars === `/*` || nextTwoChars === `//`) return;
|
|
18832
18248
|
}
|
|
18833
18249
|
if (ignoreNonComments) {
|
|
18834
|
-
if (`insideComment` in match && match.insideComment)
|
|
18835
|
-
return complain(complaintIndex);
|
|
18836
|
-
}
|
|
18250
|
+
if (`insideComment` in match && match.insideComment) return complain(complaintIndex);
|
|
18837
18251
|
let nextTwoChars = rootString.slice(match.endIndex).trim().slice(0, 2);
|
|
18838
|
-
if (nextTwoChars !== `/*` && nextTwoChars !== `//`)
|
|
18839
|
-
return;
|
|
18840
|
-
}
|
|
18252
|
+
if (nextTwoChars !== `/*` && nextTwoChars !== `//`) return;
|
|
18841
18253
|
return complain(complaintIndex);
|
|
18842
18254
|
}
|
|
18843
18255
|
let lineString = rootString.slice(match.endIndex, nextNewlineIndex);
|
|
18844
|
-
if (!lineString.replace(/^\s+/, ``).includes(` `))
|
|
18845
|
-
return;
|
|
18846
|
-
}
|
|
18256
|
+
if (!lineString.replace(/^\s+/, ``).includes(` `)) return;
|
|
18847
18257
|
return complain(complaintIndex);
|
|
18848
18258
|
}
|
|
18849
18259
|
};
|
|
@@ -18903,9 +18313,7 @@ function rule$D(primary) {
|
|
|
18903
18313
|
actual: primary,
|
|
18904
18314
|
possible: [`always`, `never`]
|
|
18905
18315
|
});
|
|
18906
|
-
if (!validOptions)
|
|
18907
|
-
return;
|
|
18908
|
-
}
|
|
18316
|
+
if (!validOptions) return;
|
|
18909
18317
|
let fixData;
|
|
18910
18318
|
mediaFeatureColonSpaceChecker({
|
|
18911
18319
|
root: root2,
|
|
@@ -18927,17 +18335,11 @@ function rule$D(primary) {
|
|
|
18927
18335
|
for (let index2 of colonIndices.sort((a2, b2) => b2 - a2)) {
|
|
18928
18336
|
let beforeColon = params.slice(0, index2 + 1);
|
|
18929
18337
|
let afterColon = params.slice(index2 + 1);
|
|
18930
|
-
if (primary === `always`)
|
|
18931
|
-
|
|
18932
|
-
} else if (primary === `never`) {
|
|
18933
|
-
params = beforeColon + afterColon.replace(/^\s*/, ``);
|
|
18934
|
-
}
|
|
18935
|
-
}
|
|
18936
|
-
if (atRule2.raws.params) {
|
|
18937
|
-
atRule2.raws.params.raw = params;
|
|
18938
|
-
} else {
|
|
18939
|
-
atRule2.params = params;
|
|
18338
|
+
if (primary === `always`) params = beforeColon + afterColon.replace(/^\s*/, ` `);
|
|
18339
|
+
else if (primary === `never`) params = beforeColon + afterColon.replace(/^\s*/, ``);
|
|
18940
18340
|
}
|
|
18341
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
18342
|
+
else atRule2.params = params;
|
|
18941
18343
|
}
|
|
18942
18344
|
}
|
|
18943
18345
|
};
|
|
@@ -18970,9 +18372,7 @@ function rule$C(primary) {
|
|
|
18970
18372
|
actual: primary,
|
|
18971
18373
|
possible: [`always`, `never`]
|
|
18972
18374
|
});
|
|
18973
|
-
if (!validOptions)
|
|
18974
|
-
return;
|
|
18975
|
-
}
|
|
18375
|
+
if (!validOptions) return;
|
|
18976
18376
|
let fixData;
|
|
18977
18377
|
mediaFeatureColonSpaceChecker({
|
|
18978
18378
|
root: root2,
|
|
@@ -18994,17 +18394,11 @@ function rule$C(primary) {
|
|
|
18994
18394
|
for (let index2 of colonIndices.sort((a2, b2) => b2 - a2)) {
|
|
18995
18395
|
let beforeColon = params.slice(0, index2);
|
|
18996
18396
|
let afterColon = params.slice(index2);
|
|
18997
|
-
if (primary === `always`)
|
|
18998
|
-
|
|
18999
|
-
} else if (primary === `never`) {
|
|
19000
|
-
params = beforeColon.replace(/\s*$/, ``) + afterColon;
|
|
19001
|
-
}
|
|
19002
|
-
}
|
|
19003
|
-
if (atRule2.raws.params) {
|
|
19004
|
-
atRule2.raws.params.raw = params;
|
|
19005
|
-
} else {
|
|
19006
|
-
atRule2.params = params;
|
|
18397
|
+
if (primary === `always`) params = beforeColon.replace(/\s*$/, ` `) + afterColon;
|
|
18398
|
+
else if (primary === `never`) params = beforeColon.replace(/\s*$/, ``) + afterColon;
|
|
19007
18399
|
}
|
|
18400
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
18401
|
+
else atRule2.params = params;
|
|
19008
18402
|
}
|
|
19009
18403
|
}
|
|
19010
18404
|
};
|
|
@@ -21010,9 +20404,7 @@ function findMediaFeatureNames(mediaQueryParams, callback) {
|
|
|
21010
20404
|
let tokens = tokenize$1({ css: mediaQueryParams });
|
|
21011
20405
|
let list = parseCommaSeparatedListOfComponentValues(tokens);
|
|
21012
20406
|
let mediaQueryConditions = list.flatMap((listItem) => listItem.flatMap((componentValue) => {
|
|
21013
|
-
if (!isSimpleBlockNode(componentValue) || componentValue.startToken[0] !== c.OpenParen)
|
|
21014
|
-
return [];
|
|
21015
|
-
}
|
|
20407
|
+
if (!isSimpleBlockNode(componentValue) || componentValue.startToken[0] !== c.OpenParen) return [];
|
|
21016
20408
|
let blockTokens = componentValue.tokens();
|
|
21017
20409
|
let mediaQueryList = parseFromTokens(blockTokens, {
|
|
21018
20410
|
preserveInvalidMediaQueries: true
|
|
@@ -21023,24 +20415,18 @@ function findMediaFeatureNames(mediaQueryParams, callback) {
|
|
|
21023
20415
|
mediaQuery.walk(({ node: node2 }) => {
|
|
21024
20416
|
if (isMediaFeature(node2)) {
|
|
21025
20417
|
let token = node2.getNameToken();
|
|
21026
|
-
if (token[0] !== c.Ident)
|
|
21027
|
-
return;
|
|
21028
|
-
}
|
|
20418
|
+
if (token[0] !== c.Ident) return;
|
|
21029
20419
|
callback(token);
|
|
21030
20420
|
}
|
|
21031
20421
|
if (isGeneralEnclosed(node2)) {
|
|
21032
20422
|
topLevelTokenNodes(node2).forEach((token, i2, topLevelTokens) => {
|
|
21033
|
-
if (token[0] !== c.Ident)
|
|
21034
|
-
return;
|
|
21035
|
-
}
|
|
20423
|
+
if (token[0] !== c.Ident) return;
|
|
21036
20424
|
let nextToken = topLevelTokens[i2 + 1];
|
|
21037
20425
|
let prevToken = topLevelTokens[i2 - 1];
|
|
21038
20426
|
if (
|
|
21039
20427
|
// Media Feature
|
|
21040
20428
|
!prevToken && nextToken && nextToken[0] === c.Colon || nextToken && nextToken[0] === c.Delim && rangeFeatureOperator.test(nextToken[4].value) || prevToken && prevToken[0] === c.Delim && rangeFeatureOperator.test(prevToken[4].value)
|
|
21041
|
-
)
|
|
21042
|
-
callback(token);
|
|
21043
|
-
}
|
|
20429
|
+
) callback(token);
|
|
21044
20430
|
});
|
|
21045
20431
|
}
|
|
21046
20432
|
});
|
|
@@ -21053,9 +20439,7 @@ function findMediaFeatureNames(mediaQueryParams, callback) {
|
|
|
21053
20439
|
}
|
|
21054
20440
|
function topLevelTokenNodes(node2) {
|
|
21055
20441
|
let components = node2.value.value;
|
|
21056
|
-
if (isToken(components) || components.length === 0 || isToken(components[0]))
|
|
21057
|
-
return [];
|
|
21058
|
-
}
|
|
20442
|
+
if (isToken(components) || components.length === 0 || isToken(components[0])) return [];
|
|
21059
20443
|
let relevantTokens = [];
|
|
21060
20444
|
let lastWasDollarSign = false;
|
|
21061
20445
|
components.forEach((component) => {
|
|
@@ -21092,22 +20476,16 @@ function rule$B(primary) {
|
|
|
21092
20476
|
actual: primary,
|
|
21093
20477
|
possible: [`lower`, `upper`]
|
|
21094
20478
|
});
|
|
21095
|
-
if (!validOptions)
|
|
21096
|
-
return;
|
|
21097
|
-
}
|
|
20479
|
+
if (!validOptions) return;
|
|
21098
20480
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21099
20481
|
let hasComments = atRule2.raws.params?.raw;
|
|
21100
20482
|
let mediaRule = hasComments ? hasComments : atRule2.params;
|
|
21101
20483
|
let hasFixes = false;
|
|
21102
20484
|
mediaRule = findMediaFeatureNames(mediaRule, (mediaFeatureNameToken) => {
|
|
21103
20485
|
let [, , startIndex, endIndex, { value: featureName }] = mediaFeatureNameToken;
|
|
21104
|
-
if (isCustomMediaQuery(featureName))
|
|
21105
|
-
return;
|
|
21106
|
-
}
|
|
20486
|
+
if (isCustomMediaQuery(featureName)) return;
|
|
21107
20487
|
let expectedFeatureName = primary === `lower` ? featureName.toLowerCase() : featureName.toUpperCase();
|
|
21108
|
-
if (featureName === expectedFeatureName)
|
|
21109
|
-
return;
|
|
21110
|
-
}
|
|
20488
|
+
if (featureName === expectedFeatureName) return;
|
|
21111
20489
|
let atRuleIndex = atRuleParamIndex(atRule2);
|
|
21112
20490
|
report$r({
|
|
21113
20491
|
message: messages$B.expected,
|
|
@@ -21125,13 +20503,9 @@ function rule$B(primary) {
|
|
|
21125
20503
|
}).stringify();
|
|
21126
20504
|
if (hasFixes) {
|
|
21127
20505
|
if (hasComments) {
|
|
21128
|
-
if (atRule2.raws.params === null)
|
|
21129
|
-
throw new Error(`The \`AtRuleRaws\` node must have a \`params\` property`);
|
|
21130
|
-
}
|
|
20506
|
+
if (atRule2.raws.params === null) throw new Error(`The \`AtRuleRaws\` node must have a \`params\` property`);
|
|
21131
20507
|
atRule2.raws.params.raw = mediaRule;
|
|
21132
|
-
} else
|
|
21133
|
-
atRule2.params = mediaRule;
|
|
21134
|
-
}
|
|
20508
|
+
} else atRule2.params = mediaRule;
|
|
21135
20509
|
}
|
|
21136
20510
|
});
|
|
21137
20511
|
};
|
|
@@ -21165,9 +20539,7 @@ function rule$A(primary) {
|
|
|
21165
20539
|
actual: primary,
|
|
21166
20540
|
possible: [`always`, `never`]
|
|
21167
20541
|
});
|
|
21168
|
-
if (!validOptions)
|
|
21169
|
-
return;
|
|
21170
|
-
}
|
|
20542
|
+
if (!validOptions) return;
|
|
21171
20543
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21172
20544
|
let params = atRule2.raws.params && atRule2.raws.params.raw || atRule2.params;
|
|
21173
20545
|
let indexBoost = atRuleParamIndex(atRule2);
|
|
@@ -21228,9 +20600,7 @@ function rule$A(primary) {
|
|
|
21228
20600
|
fix: err.fix
|
|
21229
20601
|
});
|
|
21230
20602
|
}
|
|
21231
|
-
if (problems.some((problem) => problem.fix))
|
|
21232
|
-
atRule2.params = parsedParams.toString();
|
|
21233
|
-
}
|
|
20603
|
+
if (problems.some((problem) => problem.fix)) atRule2.params = parsedParams.toString();
|
|
21234
20604
|
}
|
|
21235
20605
|
});
|
|
21236
20606
|
};
|
|
@@ -21247,15 +20617,11 @@ const index$A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
21247
20617
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
21248
20618
|
let rangeOperators = [`>=`, `<=`, `>`, `<`, `=`];
|
|
21249
20619
|
function findMediaOperator(atRule2, cb) {
|
|
21250
|
-
if (atRule2.name.toLowerCase() !== `media`)
|
|
21251
|
-
return;
|
|
21252
|
-
}
|
|
20620
|
+
if (atRule2.name.toLowerCase() !== `media`) return;
|
|
21253
20621
|
let params = atRule2.raws.params ? atRule2.raws.params.raw : atRule2.params;
|
|
21254
20622
|
styleSearch({ source: params, target: rangeOperators }, (match) => {
|
|
21255
20623
|
let before = params[match.startIndex - 1];
|
|
21256
|
-
if (before === `>` || before === `<`)
|
|
21257
|
-
return;
|
|
21258
|
-
}
|
|
20624
|
+
if (before === `>` || before === `<`) return;
|
|
21259
20625
|
cb(match, params, atRule2);
|
|
21260
20626
|
});
|
|
21261
20627
|
}
|
|
@@ -21277,9 +20643,7 @@ function rule$z(primary) {
|
|
|
21277
20643
|
actual: primary,
|
|
21278
20644
|
possible: [`always`, `never`]
|
|
21279
20645
|
});
|
|
21280
|
-
if (!validOptions)
|
|
21281
|
-
return;
|
|
21282
|
-
}
|
|
20646
|
+
if (!validOptions) return;
|
|
21283
20647
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21284
20648
|
let fixOperatorIndices = [];
|
|
21285
20649
|
findMediaOperator(atRule2, (match, params, node2) => {
|
|
@@ -21308,17 +20672,11 @@ function rule$z(primary) {
|
|
|
21308
20672
|
for (let index2 of fixOperatorIndices.sort((a2, b2) => b2 - a2)) {
|
|
21309
20673
|
let beforeOperator = params.slice(0, index2 + 1);
|
|
21310
20674
|
let afterOperator = params.slice(index2 + 1);
|
|
21311
|
-
if (primary === `always`)
|
|
21312
|
-
|
|
21313
|
-
} else if (primary === `never`) {
|
|
21314
|
-
params = beforeOperator + afterOperator.replace(/^\s*/, ``);
|
|
21315
|
-
}
|
|
21316
|
-
}
|
|
21317
|
-
if (atRule2.raws.params) {
|
|
21318
|
-
atRule2.raws.params.raw = params;
|
|
21319
|
-
} else {
|
|
21320
|
-
atRule2.params = params;
|
|
20675
|
+
if (primary === `always`) params = beforeOperator + afterOperator.replace(/^\s*/, ` `);
|
|
20676
|
+
else if (primary === `never`) params = beforeOperator + afterOperator.replace(/^\s*/, ``);
|
|
21321
20677
|
}
|
|
20678
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20679
|
+
else atRule2.params = params;
|
|
21322
20680
|
}
|
|
21323
20681
|
});
|
|
21324
20682
|
};
|
|
@@ -21351,9 +20709,7 @@ function rule$y(primary) {
|
|
|
21351
20709
|
actual: primary,
|
|
21352
20710
|
possible: [`always`, `never`]
|
|
21353
20711
|
});
|
|
21354
|
-
if (!validOptions)
|
|
21355
|
-
return;
|
|
21356
|
-
}
|
|
20712
|
+
if (!validOptions) return;
|
|
21357
20713
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21358
20714
|
let fixOperatorIndices = [];
|
|
21359
20715
|
findMediaOperator(atRule2, (match, params, node2) => {
|
|
@@ -21381,17 +20737,11 @@ function rule$y(primary) {
|
|
|
21381
20737
|
for (let index2 of fixOperatorIndices.sort((a2, b2) => b2 - a2)) {
|
|
21382
20738
|
let beforeOperator = params.slice(0, index2);
|
|
21383
20739
|
let afterOperator = params.slice(index2);
|
|
21384
|
-
if (primary === `always`)
|
|
21385
|
-
|
|
21386
|
-
} else if (primary === `never`) {
|
|
21387
|
-
params = beforeOperator.replace(/\s*$/, ``) + afterOperator;
|
|
21388
|
-
}
|
|
21389
|
-
}
|
|
21390
|
-
if (atRule2.raws.params) {
|
|
21391
|
-
atRule2.raws.params.raw = params;
|
|
21392
|
-
} else {
|
|
21393
|
-
atRule2.params = params;
|
|
20740
|
+
if (primary === `always`) params = beforeOperator.replace(/\s*$/, ` `) + afterOperator;
|
|
20741
|
+
else if (primary === `never`) params = beforeOperator.replace(/\s*$/, ``) + afterOperator;
|
|
21394
20742
|
}
|
|
20743
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20744
|
+
else atRule2.params = params;
|
|
21395
20745
|
}
|
|
21396
20746
|
});
|
|
21397
20747
|
};
|
|
@@ -21466,9 +20816,7 @@ function rule$x(primary, _secondaryOptions, context) {
|
|
|
21466
20816
|
actual: primary,
|
|
21467
20817
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
21468
20818
|
});
|
|
21469
|
-
if (!validOptions)
|
|
21470
|
-
return;
|
|
21471
|
-
}
|
|
20819
|
+
if (!validOptions) return;
|
|
21472
20820
|
let fixData;
|
|
21473
20821
|
mediaQueryListCommaWhitespaceChecker({
|
|
21474
20822
|
root: root2,
|
|
@@ -21491,17 +20839,11 @@ function rule$x(primary, _secondaryOptions, context) {
|
|
|
21491
20839
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
21492
20840
|
let beforeComma = params.slice(0, index2 + 1);
|
|
21493
20841
|
let afterComma = params.slice(index2 + 1);
|
|
21494
|
-
if (primary.startsWith(`always`))
|
|
21495
|
-
|
|
21496
|
-
} else if (primary.startsWith(`never`)) {
|
|
21497
|
-
params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21498
|
-
}
|
|
21499
|
-
}
|
|
21500
|
-
if (atRule2.raws.params) {
|
|
21501
|
-
atRule2.raws.params.raw = params;
|
|
21502
|
-
} else {
|
|
21503
|
-
atRule2.params = params;
|
|
20842
|
+
if (primary.startsWith(`always`)) params = /^\s*\n/.test(afterComma) ? beforeComma + afterComma.replace(/^[^\S\r\n]*/, ``) : beforeComma + context.newline + afterComma;
|
|
20843
|
+
else if (primary.startsWith(`never`)) params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21504
20844
|
}
|
|
20845
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20846
|
+
else atRule2.params = params;
|
|
21505
20847
|
}
|
|
21506
20848
|
}
|
|
21507
20849
|
};
|
|
@@ -21534,9 +20876,7 @@ function rule$w(primary) {
|
|
|
21534
20876
|
actual: primary,
|
|
21535
20877
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
21536
20878
|
});
|
|
21537
|
-
if (!validOptions)
|
|
21538
|
-
return;
|
|
21539
|
-
}
|
|
20879
|
+
if (!validOptions) return;
|
|
21540
20880
|
mediaQueryListCommaWhitespaceChecker({
|
|
21541
20881
|
root: root2,
|
|
21542
20882
|
result: result2,
|
|
@@ -21575,9 +20915,7 @@ function rule$v(primary) {
|
|
|
21575
20915
|
actual: primary,
|
|
21576
20916
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
21577
20917
|
});
|
|
21578
|
-
if (!validOptions)
|
|
21579
|
-
return;
|
|
21580
|
-
}
|
|
20918
|
+
if (!validOptions) return;
|
|
21581
20919
|
let fixData;
|
|
21582
20920
|
mediaQueryListCommaWhitespaceChecker({
|
|
21583
20921
|
root: root2,
|
|
@@ -21599,17 +20937,11 @@ function rule$v(primary) {
|
|
|
21599
20937
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
21600
20938
|
let beforeComma = params.slice(0, index2 + 1);
|
|
21601
20939
|
let afterComma = params.slice(index2 + 1);
|
|
21602
|
-
if (primary.startsWith(`always`))
|
|
21603
|
-
|
|
21604
|
-
} else if (primary.startsWith(`never`)) {
|
|
21605
|
-
params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21606
|
-
}
|
|
21607
|
-
}
|
|
21608
|
-
if (atRule2.raws.params) {
|
|
21609
|
-
atRule2.raws.params.raw = params;
|
|
21610
|
-
} else {
|
|
21611
|
-
atRule2.params = params;
|
|
20940
|
+
if (primary.startsWith(`always`)) params = beforeComma + afterComma.replace(/^\s*/, ` `);
|
|
20941
|
+
else if (primary.startsWith(`never`)) params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21612
20942
|
}
|
|
20943
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20944
|
+
else atRule2.params = params;
|
|
21613
20945
|
}
|
|
21614
20946
|
}
|
|
21615
20947
|
};
|
|
@@ -21644,9 +20976,7 @@ function rule$u(primary) {
|
|
|
21644
20976
|
actual: primary,
|
|
21645
20977
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
21646
20978
|
});
|
|
21647
|
-
if (!validOptions)
|
|
21648
|
-
return;
|
|
21649
|
-
}
|
|
20979
|
+
if (!validOptions) return;
|
|
21650
20980
|
let fixData;
|
|
21651
20981
|
mediaQueryListCommaWhitespaceChecker({
|
|
21652
20982
|
root: root2,
|
|
@@ -21668,17 +20998,11 @@ function rule$u(primary) {
|
|
|
21668
20998
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
21669
20999
|
let beforeComma = params.slice(0, index2);
|
|
21670
21000
|
let afterComma = params.slice(index2);
|
|
21671
|
-
if (primary.startsWith(`always`))
|
|
21672
|
-
|
|
21673
|
-
} else if (primary.startsWith(`never`)) {
|
|
21674
|
-
params = beforeComma.replace(/\s*$/, ``) + afterComma;
|
|
21675
|
-
}
|
|
21676
|
-
}
|
|
21677
|
-
if (atRule2.raws.params) {
|
|
21678
|
-
atRule2.raws.params.raw = params;
|
|
21679
|
-
} else {
|
|
21680
|
-
atRule2.params = params;
|
|
21001
|
+
if (primary.startsWith(`always`)) params = beforeComma.replace(/\s*$/, ` `) + afterComma;
|
|
21002
|
+
else if (primary.startsWith(`never`)) params = beforeComma.replace(/\s*$/, ``) + afterComma;
|
|
21681
21003
|
}
|
|
21004
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
21005
|
+
else atRule2.params = params;
|
|
21682
21006
|
}
|
|
21683
21007
|
}
|
|
21684
21008
|
};
|
|
@@ -21718,9 +21042,7 @@ function rule$t(primary, secondaryOptions = {}) {
|
|
|
21718
21042
|
optional: true
|
|
21719
21043
|
}
|
|
21720
21044
|
);
|
|
21721
|
-
if (!validOptions)
|
|
21722
|
-
return;
|
|
21723
|
-
}
|
|
21045
|
+
if (!validOptions) return;
|
|
21724
21046
|
let gap = secondaryOptions.gap ?? 1;
|
|
21725
21047
|
let alignQuotes = secondaryOptions.alignQuotes ?? false;
|
|
21726
21048
|
let referenceGap = ` `.repeat(gap);
|
|
@@ -21752,17 +21074,13 @@ function rule$t(primary, secondaryOptions = {}) {
|
|
|
21752
21074
|
});
|
|
21753
21075
|
if (alignQuotes && isMultilineDeclaration) {
|
|
21754
21076
|
formatted = formatted.map((row) => {
|
|
21755
|
-
if (row.length === maxRowLength)
|
|
21756
|
-
return row;
|
|
21757
|
-
}
|
|
21077
|
+
if (row.length === maxRowLength) return row;
|
|
21758
21078
|
let cleanRowValue = row.trimEnd();
|
|
21759
21079
|
return `${cleanRowValue}${` `.repeat(maxRowLength - cleanRowValue.length)}`;
|
|
21760
21080
|
});
|
|
21761
21081
|
}
|
|
21762
21082
|
let isValid = originalRows.every((row, index2) => row === formatted[index2]);
|
|
21763
|
-
if (isValid)
|
|
21764
|
-
return;
|
|
21765
|
-
}
|
|
21083
|
+
if (isValid) return;
|
|
21766
21084
|
let extraStartLines = declaration2.raws.between.match(/[\r\n?|\n]*/g)?.reduce((acc, newLineBlock) => acc + newLineBlock.length, 0);
|
|
21767
21085
|
let extraStartColumns = extraStartLines === 0 ? declarationValueIndex(declaration2) + declaration2.source.start.column : declaration2.raws.between.match(/[^\r\n?|\n]+$/)?.[0].length + 1 || 0;
|
|
21768
21086
|
report$m({
|
|
@@ -21821,13 +21139,9 @@ let meta$s = {
|
|
|
21821
21139
|
function rule$s(primary) {
|
|
21822
21140
|
return (root2, result2) => {
|
|
21823
21141
|
let validOptions = validateOptions$s(result2, ruleName$s, { actual: primary });
|
|
21824
|
-
if (!validOptions || root2.source.inline || root2.source.lang === `object-literal`)
|
|
21825
|
-
return;
|
|
21826
|
-
}
|
|
21142
|
+
if (!validOptions || root2.source.inline || root2.source.lang === `object-literal`) return;
|
|
21827
21143
|
let rootString = root2.source && root2.source.input.css || ``;
|
|
21828
|
-
if (!rootString.trim())
|
|
21829
|
-
return;
|
|
21830
|
-
}
|
|
21144
|
+
if (!rootString.trim()) return;
|
|
21831
21145
|
if (noEmptyFirstLineTest.test(rootString)) {
|
|
21832
21146
|
report$l({
|
|
21833
21147
|
message: messages$s.rejected,
|
|
@@ -21835,12 +21149,8 @@ function rule$s(primary) {
|
|
|
21835
21149
|
result: result2,
|
|
21836
21150
|
ruleName: ruleName$s,
|
|
21837
21151
|
fix() {
|
|
21838
|
-
if (root2.first === null)
|
|
21839
|
-
|
|
21840
|
-
}
|
|
21841
|
-
if (root2.first.raws.before === null) {
|
|
21842
|
-
throw new Error(`The first node must have spaces before.`);
|
|
21843
|
-
}
|
|
21152
|
+
if (root2.first === null) throw new Error(`The root node must have the first node.`);
|
|
21153
|
+
if (root2.first.raws.before === null) throw new Error(`The first node must have spaces before.`);
|
|
21844
21154
|
root2.first.raws.before = root2.first.raws.before.replace(noEmptyFirstLineTest, ``);
|
|
21845
21155
|
}
|
|
21846
21156
|
});
|
|
@@ -21858,20 +21168,12 @@ const index$s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
21858
21168
|
ruleName: ruleName$s
|
|
21859
21169
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
21860
21170
|
function isOnlyWhitespace(input2) {
|
|
21861
|
-
for (let element of input2)
|
|
21862
|
-
if (!isWhitespace$1(element)) {
|
|
21863
|
-
return false;
|
|
21864
|
-
}
|
|
21865
|
-
}
|
|
21171
|
+
for (let element of input2) if (!isWhitespace$1(element)) return false;
|
|
21866
21172
|
return true;
|
|
21867
21173
|
}
|
|
21868
21174
|
function isStandardSyntaxComment(comment2) {
|
|
21869
|
-
if (`inline` in comment2)
|
|
21870
|
-
|
|
21871
|
-
}
|
|
21872
|
-
if (`inline` in comment2.raws) {
|
|
21873
|
-
return false;
|
|
21874
|
-
}
|
|
21175
|
+
if (`inline` in comment2) return false;
|
|
21176
|
+
if (`inline` in comment2.raws) return false;
|
|
21875
21177
|
return true;
|
|
21876
21178
|
}
|
|
21877
21179
|
let { utils: { report: report$k, ruleMessages: ruleMessages$r, validateOptions: validateOptions$r } } = stylelint;
|
|
@@ -21890,17 +21192,13 @@ function fixString(str) {
|
|
|
21890
21192
|
}
|
|
21891
21193
|
function findErrorStartIndex(lastEOLIndex, string2, { ignoreEmptyLines, isRootFirst }) {
|
|
21892
21194
|
let eolWhitespaceIndex = lastEOLIndex - 1;
|
|
21893
|
-
if (!whitespacesToReject.has(string2.charAt(eolWhitespaceIndex)))
|
|
21894
|
-
return -1;
|
|
21895
|
-
}
|
|
21195
|
+
if (!whitespacesToReject.has(string2.charAt(eolWhitespaceIndex))) return -1;
|
|
21896
21196
|
if (ignoreEmptyLines) {
|
|
21897
21197
|
let beforeNewlineIndex = string2.lastIndexOf(`
|
|
21898
21198
|
`, eolWhitespaceIndex);
|
|
21899
21199
|
if (beforeNewlineIndex >= 0 || isRootFirst) {
|
|
21900
21200
|
let line = string2.substring(beforeNewlineIndex, eolWhitespaceIndex);
|
|
21901
|
-
if (isOnlyWhitespace(line))
|
|
21902
|
-
return -1;
|
|
21903
|
-
}
|
|
21201
|
+
if (isOnlyWhitespace(line)) return -1;
|
|
21904
21202
|
}
|
|
21905
21203
|
}
|
|
21906
21204
|
return eolWhitespaceIndex;
|
|
@@ -21921,9 +21219,7 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21921
21219
|
}
|
|
21922
21220
|
}
|
|
21923
21221
|
);
|
|
21924
|
-
if (!validOptions)
|
|
21925
|
-
return;
|
|
21926
|
-
}
|
|
21222
|
+
if (!validOptions) return;
|
|
21927
21223
|
let ignoreEmptyLines = optionsMatches(secondaryOptions, `ignore`, `empty-lines`);
|
|
21928
21224
|
let rootString = root2.source && root2.source.input.css || ``;
|
|
21929
21225
|
function reportFromIndex(index2) {
|
|
@@ -21942,9 +21238,7 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21942
21238
|
ignoreEmptyLines,
|
|
21943
21239
|
isRootFirst: true
|
|
21944
21240
|
});
|
|
21945
|
-
if (errorIndex > -1)
|
|
21946
|
-
reportFromIndex(errorIndex);
|
|
21947
|
-
}
|
|
21241
|
+
if (errorIndex > -1) reportFromIndex(errorIndex);
|
|
21948
21242
|
function eachEolWhitespace(string2, callback, isRootFirst) {
|
|
21949
21243
|
styleSearch(
|
|
21950
21244
|
{
|
|
@@ -21958,9 +21252,7 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21958
21252
|
ignoreEmptyLines,
|
|
21959
21253
|
isRootFirst
|
|
21960
21254
|
});
|
|
21961
|
-
if (index2 > -1)
|
|
21962
|
-
callback(index2);
|
|
21963
|
-
}
|
|
21255
|
+
if (index2 > -1) callback(index2);
|
|
21964
21256
|
}
|
|
21965
21257
|
);
|
|
21966
21258
|
}
|
|
@@ -22023,9 +21315,8 @@ function rule$r(primary, secondaryOptions) {
|
|
|
22023
21315
|
fixText(node2.raws.left, (fixed) => {
|
|
22024
21316
|
node2.raws.left = fixed;
|
|
22025
21317
|
});
|
|
22026
|
-
if (!isStandardSyntaxComment(node2))
|
|
22027
|
-
|
|
22028
|
-
} else {
|
|
21318
|
+
if (!isStandardSyntaxComment(node2)) node2.raws.right = node2.raws.right && fixString(node2.raws.right);
|
|
21319
|
+
else {
|
|
22029
21320
|
fixText(node2.raws.right, (fixed) => {
|
|
22030
21321
|
node2.raws.right = fixed;
|
|
22031
21322
|
});
|
|
@@ -22053,15 +21344,11 @@ function rule$r(primary, secondaryOptions) {
|
|
|
22053
21344
|
`),
|
|
22054
21345
|
root2.raws.after.lastIndexOf(`\r`)
|
|
22055
21346
|
);
|
|
22056
|
-
if (lastEOL !== root2.raws.after.length - 1)
|
|
22057
|
-
root2.raws.after = root2.raws.after.slice(0, lastEOL + 1) + fixString(root2.raws.after.slice(lastEOL + 1));
|
|
22058
|
-
}
|
|
21347
|
+
if (lastEOL !== root2.raws.after.length - 1) root2.raws.after = root2.raws.after.slice(0, lastEOL + 1) + fixString(root2.raws.after.slice(lastEOL + 1));
|
|
22059
21348
|
}
|
|
22060
21349
|
}
|
|
22061
21350
|
function fixText(value, fixFn, isRootFirst = false) {
|
|
22062
|
-
if (!value)
|
|
22063
|
-
return;
|
|
22064
|
-
}
|
|
21351
|
+
if (!value) return;
|
|
22065
21352
|
let fixed = ``;
|
|
22066
21353
|
let lastIndex = 0;
|
|
22067
21354
|
eachEolWhitespace(
|
|
@@ -22107,51 +21394,25 @@ function hasTplInterpolation(string2) {
|
|
|
22107
21394
|
return HAS_TPL_INTERPOLATION.test(string2);
|
|
22108
21395
|
}
|
|
22109
21396
|
function hasInterpolation(string2) {
|
|
22110
|
-
if (hasLessInterpolation(string2) || hasScssInterpolation(string2) || hasTplInterpolation(string2) || hasPsvInterpolation(string2))
|
|
22111
|
-
return true;
|
|
22112
|
-
}
|
|
21397
|
+
if (hasLessInterpolation(string2) || hasScssInterpolation(string2) || hasTplInterpolation(string2) || hasPsvInterpolation(string2)) return true;
|
|
22113
21398
|
return false;
|
|
22114
21399
|
}
|
|
22115
21400
|
function isStandardSyntaxSelector(selector2) {
|
|
22116
|
-
if (hasInterpolation(selector2))
|
|
22117
|
-
|
|
22118
|
-
|
|
22119
|
-
if (
|
|
22120
|
-
|
|
22121
|
-
|
|
22122
|
-
if (
|
|
22123
|
-
|
|
22124
|
-
|
|
22125
|
-
if (/:extend(?:\(.*?\))?/.test(selector2)) {
|
|
22126
|
-
return false;
|
|
22127
|
-
}
|
|
22128
|
-
if (/\.[\w-]+\(.*\).+/.test(selector2)) {
|
|
22129
|
-
return false;
|
|
22130
|
-
}
|
|
22131
|
-
if (selector2.endsWith(`)`) && !selector2.includes(`:`)) {
|
|
22132
|
-
return false;
|
|
22133
|
-
}
|
|
22134
|
-
if (/\(@.*\)$/.test(selector2)) {
|
|
22135
|
-
return false;
|
|
22136
|
-
}
|
|
22137
|
-
if (selector2.includes(`<%`) || selector2.includes(`%>`)) {
|
|
22138
|
-
return false;
|
|
22139
|
-
}
|
|
22140
|
-
if (selector2.includes(`//`)) {
|
|
22141
|
-
return false;
|
|
22142
|
-
}
|
|
21401
|
+
if (hasInterpolation(selector2)) return false;
|
|
21402
|
+
if (selector2.startsWith(`%`)) return false;
|
|
21403
|
+
if (selector2.endsWith(`:`)) return false;
|
|
21404
|
+
if (/:extend(?:\(.*?\))?/.test(selector2)) return false;
|
|
21405
|
+
if (/\.[\w-]+\(.*\).+/.test(selector2)) return false;
|
|
21406
|
+
if (selector2.endsWith(`)`) && !selector2.includes(`:`)) return false;
|
|
21407
|
+
if (/\(@.*\)$/.test(selector2)) return false;
|
|
21408
|
+
if (selector2.includes(`<%`) || selector2.includes(`%>`)) return false;
|
|
21409
|
+
if (selector2.includes(`//`)) return false;
|
|
22143
21410
|
return true;
|
|
22144
21411
|
}
|
|
22145
21412
|
function isStandardSyntaxRule(rule2) {
|
|
22146
|
-
if (rule2.type !== `rule`)
|
|
22147
|
-
|
|
22148
|
-
|
|
22149
|
-
if (`extend` in rule2 && rule2.extend) {
|
|
22150
|
-
return false;
|
|
22151
|
-
}
|
|
22152
|
-
if (!isStandardSyntaxSelector(rule2.selector)) {
|
|
22153
|
-
return false;
|
|
22154
|
-
}
|
|
21413
|
+
if (rule2.type !== `rule`) return false;
|
|
21414
|
+
if (`extend` in rule2 && rule2.extend) return false;
|
|
21415
|
+
if (!isStandardSyntaxSelector(rule2.selector)) return false;
|
|
22155
21416
|
return true;
|
|
22156
21417
|
}
|
|
22157
21418
|
let { utils: { report: report$j, ruleMessages: ruleMessages$q, validateOptions: validateOptions$q } } = stylelint;
|
|
@@ -22165,19 +21426,11 @@ let meta$q = {
|
|
|
22165
21426
|
fixable: true
|
|
22166
21427
|
};
|
|
22167
21428
|
function getOffsetByNode(node2) {
|
|
22168
|
-
if (node2.parent && node2.parent.document)
|
|
22169
|
-
return 0;
|
|
22170
|
-
}
|
|
21429
|
+
if (node2.parent && node2.parent.document) return 0;
|
|
22171
21430
|
let root2 = node2.root();
|
|
22172
|
-
if (!root2.source)
|
|
22173
|
-
|
|
22174
|
-
|
|
22175
|
-
if (!node2.source) {
|
|
22176
|
-
throw new Error(`The node must have a source`);
|
|
22177
|
-
}
|
|
22178
|
-
if (!node2.source.start) {
|
|
22179
|
-
throw new Error(`The source must have a start position`);
|
|
22180
|
-
}
|
|
21431
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
21432
|
+
if (!node2.source) throw new Error(`The node must have a source`);
|
|
21433
|
+
if (!node2.source.start) throw new Error(`The source must have a start position`);
|
|
22181
21434
|
let string2 = root2.source.input.css;
|
|
22182
21435
|
let nodeColumn = node2.source.start.column;
|
|
22183
21436
|
let nodeLine = node2.source.start.line;
|
|
@@ -22193,18 +21446,14 @@ function getOffsetByNode(node2) {
|
|
|
22193
21446
|
`) {
|
|
22194
21447
|
column = 1;
|
|
22195
21448
|
line += 1;
|
|
22196
|
-
} else
|
|
22197
|
-
column += 1;
|
|
22198
|
-
}
|
|
21449
|
+
} else column += 1;
|
|
22199
21450
|
}
|
|
22200
21451
|
return index2;
|
|
22201
21452
|
}
|
|
22202
21453
|
function rule$q(primary) {
|
|
22203
21454
|
return (root2, result2) => {
|
|
22204
21455
|
let validOptions = validateOptions$q(result2, ruleName$q, { actual: primary });
|
|
22205
|
-
if (!validOptions)
|
|
22206
|
-
return;
|
|
22207
|
-
}
|
|
21456
|
+
if (!validOptions) return;
|
|
22208
21457
|
let fix = null;
|
|
22209
21458
|
if (root2.raws.after && root2.raws.after.trim().length !== 0) {
|
|
22210
21459
|
let rawAfterRoot = root2.raws.after;
|
|
@@ -22213,45 +21462,31 @@ function rule$q(primary) {
|
|
|
22213
21462
|
fix = () => {
|
|
22214
21463
|
fixSemiIndices.push(match.startIndex);
|
|
22215
21464
|
};
|
|
22216
|
-
if (!root2.source)
|
|
22217
|
-
throw new Error(`The root node must have a source`);
|
|
22218
|
-
}
|
|
21465
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
22219
21466
|
complain(root2.source.input.css.length - rawAfterRoot.length + match.startIndex);
|
|
22220
21467
|
});
|
|
22221
|
-
if (fixSemiIndices.length)
|
|
22222
|
-
root2.raws.after = removeIndices(rawAfterRoot, fixSemiIndices);
|
|
22223
|
-
}
|
|
21468
|
+
if (fixSemiIndices.length) root2.raws.after = removeIndices(rawAfterRoot, fixSemiIndices);
|
|
22224
21469
|
}
|
|
22225
21470
|
root2.walk((node2) => {
|
|
22226
|
-
if (isAtRule(node2) && !isStandardSyntaxAtRule(node2))
|
|
22227
|
-
|
|
22228
|
-
}
|
|
22229
|
-
if (node2.type === `rule` && !isStandardSyntaxRule(node2)) {
|
|
22230
|
-
return;
|
|
22231
|
-
}
|
|
21471
|
+
if (isAtRule(node2) && !isStandardSyntaxAtRule(node2)) return;
|
|
21472
|
+
if (node2.type === `rule` && !isStandardSyntaxRule(node2)) return;
|
|
22232
21473
|
if (node2.raws.before && node2.raws.before.trim().length !== 0) {
|
|
22233
21474
|
let rawBeforeNode = node2.raws.before;
|
|
22234
21475
|
let allowedSemi = 0;
|
|
22235
21476
|
let rawBeforeIndexStart = 0;
|
|
22236
21477
|
let fixSemiIndices = [];
|
|
22237
21478
|
styleSearch({ source: rawBeforeNode, target: `;` }, (match, count) => {
|
|
22238
|
-
if (count === allowedSemi)
|
|
22239
|
-
return;
|
|
22240
|
-
}
|
|
21479
|
+
if (count === allowedSemi) return;
|
|
22241
21480
|
fix = () => {
|
|
22242
21481
|
fixSemiIndices.push(match.startIndex - rawBeforeIndexStart);
|
|
22243
21482
|
};
|
|
22244
21483
|
complain(getOffsetByNode(node2) - rawBeforeNode.length + match.startIndex);
|
|
22245
21484
|
});
|
|
22246
|
-
if (fixSemiIndices.length)
|
|
22247
|
-
node2.raws.before = removeIndices(rawBeforeNode, fixSemiIndices);
|
|
22248
|
-
}
|
|
21485
|
+
if (fixSemiIndices.length) node2.raws.before = removeIndices(rawBeforeNode, fixSemiIndices);
|
|
22249
21486
|
}
|
|
22250
21487
|
if (typeof node2.raws.after === `string` && node2.raws.after.trim().length !== 0) {
|
|
22251
21488
|
let rawAfterNode = node2.raws.after;
|
|
22252
|
-
if (`last` in node2 && node2.last && node2.last.type === `atrule` && !isStandardSyntaxAtRule(node2.last))
|
|
22253
|
-
return;
|
|
22254
|
-
}
|
|
21489
|
+
if (`last` in node2 && node2.last && node2.last.type === `atrule` && !isStandardSyntaxAtRule(node2.last)) return;
|
|
22255
21490
|
let fixSemiIndices = [];
|
|
22256
21491
|
styleSearch({ source: rawAfterNode, target: `;` }, (match) => {
|
|
22257
21492
|
fix = () => {
|
|
@@ -22260,27 +21495,21 @@ function rule$q(primary) {
|
|
|
22260
21495
|
let index2 = getOffsetByNode(node2) + node2.toString().length - 1 - rawAfterNode.length + match.startIndex;
|
|
22261
21496
|
complain(index2);
|
|
22262
21497
|
});
|
|
22263
|
-
if (fixSemiIndices.length)
|
|
22264
|
-
node2.raws.after = removeIndices(rawAfterNode, fixSemiIndices);
|
|
22265
|
-
}
|
|
21498
|
+
if (fixSemiIndices.length) node2.raws.after = removeIndices(rawAfterNode, fixSemiIndices);
|
|
22266
21499
|
}
|
|
22267
21500
|
if (typeof node2.raws.ownSemicolon === `string`) {
|
|
22268
21501
|
let rawOwnSemicolon = node2.raws.ownSemicolon;
|
|
22269
21502
|
let allowedSemi = 0;
|
|
22270
21503
|
let fixSemiIndices = [];
|
|
22271
21504
|
styleSearch({ source: rawOwnSemicolon, target: `;` }, (match, count) => {
|
|
22272
|
-
if (count === allowedSemi)
|
|
22273
|
-
return;
|
|
22274
|
-
}
|
|
21505
|
+
if (count === allowedSemi) return;
|
|
22275
21506
|
fix = () => {
|
|
22276
21507
|
fixSemiIndices.push(match.startIndex);
|
|
22277
21508
|
};
|
|
22278
21509
|
let index2 = getOffsetByNode(node2) + node2.toString().length - rawOwnSemicolon.length + match.startIndex;
|
|
22279
21510
|
complain(index2);
|
|
22280
21511
|
});
|
|
22281
|
-
if (fixSemiIndices.length)
|
|
22282
|
-
node2.raws.ownSemicolon = removeIndices(rawOwnSemicolon, fixSemiIndices);
|
|
22283
|
-
}
|
|
21512
|
+
if (fixSemiIndices.length) node2.raws.ownSemicolon = removeIndices(rawOwnSemicolon, fixSemiIndices);
|
|
22284
21513
|
}
|
|
22285
21514
|
});
|
|
22286
21515
|
function complain(index2) {
|
|
@@ -22295,9 +21524,7 @@ function rule$q(primary) {
|
|
|
22295
21524
|
});
|
|
22296
21525
|
}
|
|
22297
21526
|
function removeIndices(str, indices) {
|
|
22298
|
-
for (let index2 of indices.reverse())
|
|
22299
|
-
str = str.slice(0, index2) + str.slice(index2 + 1);
|
|
22300
|
-
}
|
|
21527
|
+
for (let index2 of indices.reverse()) str = str.slice(0, index2) + str.slice(index2 + 1);
|
|
22301
21528
|
return str;
|
|
22302
21529
|
}
|
|
22303
21530
|
};
|
|
@@ -22325,20 +21552,12 @@ let meta$p = {
|
|
|
22325
21552
|
function rule$p(primary, _secondaryOptions, context) {
|
|
22326
21553
|
return (root2, result2) => {
|
|
22327
21554
|
let validOptions = validateOptions$p(result2, ruleName$p, { actual: primary });
|
|
22328
|
-
if (!validOptions)
|
|
22329
|
-
|
|
22330
|
-
|
|
22331
|
-
if (root2.source === null) {
|
|
22332
|
-
throw new Error(`The root node must have a source property`);
|
|
22333
|
-
}
|
|
22334
|
-
if (root2.source.inline || root2.source.lang === `object-literal`) {
|
|
22335
|
-
return;
|
|
22336
|
-
}
|
|
21555
|
+
if (!validOptions) return;
|
|
21556
|
+
if (root2.source === null) throw new Error(`The root node must have a source property`);
|
|
21557
|
+
if (root2.source.inline || root2.source.lang === `object-literal`) return;
|
|
22337
21558
|
let rootString = root2.source.input.css;
|
|
22338
21559
|
if (!rootString.trim() || rootString.endsWith(`
|
|
22339
|
-
`))
|
|
22340
|
-
return;
|
|
22341
|
-
}
|
|
21560
|
+
`)) return;
|
|
22342
21561
|
const problemIndex = rootString.length - 1;
|
|
22343
21562
|
report$i({
|
|
22344
21563
|
message: messages$p.rejected,
|
|
@@ -22380,35 +21599,23 @@ function rule$o(primary) {
|
|
|
22380
21599
|
actual: primary,
|
|
22381
21600
|
possible: [`always`, `never`]
|
|
22382
21601
|
});
|
|
22383
|
-
if (!validOptions)
|
|
22384
|
-
return;
|
|
22385
|
-
}
|
|
21602
|
+
if (!validOptions) return;
|
|
22386
21603
|
let fix = null;
|
|
22387
21604
|
root2.walkAtRules((atRule2) => {
|
|
22388
|
-
if (atRule2.name.toLowerCase() === `import`)
|
|
22389
|
-
return;
|
|
22390
|
-
}
|
|
21605
|
+
if (atRule2.name.toLowerCase() === `import`) return;
|
|
22391
21606
|
check(atRule2, atRule2.params);
|
|
22392
21607
|
});
|
|
22393
21608
|
root2.walkDecls((decl) => check(decl, decl.value));
|
|
22394
21609
|
function check(node2, value) {
|
|
22395
21610
|
let neverFixPositions = [];
|
|
22396
21611
|
let alwaysFixPositions = [];
|
|
22397
|
-
if (!value.includes(`.`))
|
|
22398
|
-
return;
|
|
22399
|
-
}
|
|
21612
|
+
if (!value.includes(`.`)) return;
|
|
22400
21613
|
valueParser(value).walk((valueNode) => {
|
|
22401
|
-
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`)
|
|
22402
|
-
|
|
22403
|
-
}
|
|
22404
|
-
if (valueNode.type !== `word`) {
|
|
22405
|
-
return;
|
|
22406
|
-
}
|
|
21614
|
+
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`) return false;
|
|
21615
|
+
if (valueNode.type !== `word`) return;
|
|
22407
21616
|
if (primary === `always`) {
|
|
22408
21617
|
let match = /(?:\D|^)(\.\d+)/.exec(valueNode.value);
|
|
22409
|
-
if (match === null || match[0] === null || match[1] === null)
|
|
22410
|
-
return;
|
|
22411
|
-
}
|
|
21618
|
+
if (match === null || match[0] === null || match[1] === null) return;
|
|
22412
21619
|
let capturingGroupIndex = match[0].length - match[1].length;
|
|
22413
21620
|
let index2 = valueNode.sourceIndex + match.index + capturingGroupIndex;
|
|
22414
21621
|
fix = () => {
|
|
@@ -22421,9 +21628,7 @@ function rule$o(primary) {
|
|
|
22421
21628
|
}
|
|
22422
21629
|
if (primary === `never`) {
|
|
22423
21630
|
let match = /(?:\D|^)(0+)(\.\d+)/.exec(valueNode.value);
|
|
22424
|
-
if (match === null || match[0] === null || match[1] === null || match[2] === null)
|
|
22425
|
-
return;
|
|
22426
|
-
}
|
|
21631
|
+
if (match === null || match[0] === null || match[1] === null || match[2] === null) return;
|
|
22427
21632
|
let capturingGroupIndex = match[0].length - (match[1].length + match[2].length);
|
|
22428
21633
|
let index2 = valueNode.sourceIndex + match.index + capturingGroupIndex;
|
|
22429
21634
|
fix = () => {
|
|
@@ -22440,22 +21645,16 @@ function rule$o(primary) {
|
|
|
22440
21645
|
if (alwaysFixPositions.length) {
|
|
22441
21646
|
for (let fixPosition of alwaysFixPositions) {
|
|
22442
21647
|
let index2 = fixPosition.index;
|
|
22443
|
-
if (isAtRule(node2))
|
|
22444
|
-
|
|
22445
|
-
} else {
|
|
22446
|
-
node2.value = addLeadingZero(node2.value, index2);
|
|
22447
|
-
}
|
|
21648
|
+
if (isAtRule(node2)) node2.params = addLeadingZero(node2.params, index2);
|
|
21649
|
+
else node2.value = addLeadingZero(node2.value, index2);
|
|
22448
21650
|
}
|
|
22449
21651
|
}
|
|
22450
21652
|
if (neverFixPositions.length) {
|
|
22451
21653
|
for (let fixPosition of neverFixPositions) {
|
|
22452
21654
|
let startIndex = fixPosition.startIndex;
|
|
22453
21655
|
let endIndex = fixPosition.endIndex;
|
|
22454
|
-
if (isAtRule(node2))
|
|
22455
|
-
|
|
22456
|
-
} else {
|
|
22457
|
-
node2.value = removeLeadingZeros(node2.value, startIndex, endIndex);
|
|
22458
|
-
}
|
|
21656
|
+
if (isAtRule(node2)) node2.params = removeLeadingZeros(node2.params, startIndex, endIndex);
|
|
21657
|
+
else node2.value = removeLeadingZeros(node2.value, startIndex, endIndex);
|
|
22459
21658
|
}
|
|
22460
21659
|
}
|
|
22461
21660
|
}
|
|
@@ -22501,32 +21700,20 @@ let meta$n = {
|
|
|
22501
21700
|
function rule$n(primary) {
|
|
22502
21701
|
return (root2, result2) => {
|
|
22503
21702
|
let validOptions = validateOptions$n(result2, ruleName$n, { actual: primary });
|
|
22504
|
-
if (!validOptions)
|
|
22505
|
-
return;
|
|
22506
|
-
}
|
|
21703
|
+
if (!validOptions) return;
|
|
22507
21704
|
root2.walkAtRules((atRule2) => {
|
|
22508
|
-
if (atRule2.name.toLowerCase() === `import`)
|
|
22509
|
-
return;
|
|
22510
|
-
}
|
|
21705
|
+
if (atRule2.name.toLowerCase() === `import`) return;
|
|
22511
21706
|
check(atRule2, atRule2.params);
|
|
22512
21707
|
});
|
|
22513
21708
|
root2.walkDecls((decl) => check(decl, decl.value));
|
|
22514
21709
|
function check(node2, value) {
|
|
22515
21710
|
let fixPositions = [];
|
|
22516
|
-
if (!value.includes(`.`))
|
|
22517
|
-
return;
|
|
22518
|
-
}
|
|
21711
|
+
if (!value.includes(`.`)) return;
|
|
22519
21712
|
valueParser(value).walk((valueNode) => {
|
|
22520
|
-
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`)
|
|
22521
|
-
|
|
22522
|
-
}
|
|
22523
|
-
if (valueNode.type !== `word`) {
|
|
22524
|
-
return;
|
|
22525
|
-
}
|
|
21713
|
+
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`) return false;
|
|
21714
|
+
if (valueNode.type !== `word`) return;
|
|
22526
21715
|
let match = /\.(\d{0,100}?)(0+)(?:\D|$)/.exec(valueNode.value);
|
|
22527
|
-
if (match === null || match[1] === null || match[2] === null)
|
|
22528
|
-
return;
|
|
22529
|
-
}
|
|
21716
|
+
if (match === null || match[1] === null || match[2] === null) return;
|
|
22530
21717
|
let index2 = valueNode.sourceIndex + match.index + 1 + match[1].length;
|
|
22531
21718
|
let startIndex = match[1].length > 0 ? index2 : index2 - 1;
|
|
22532
21719
|
let endIndex = index2 + match[2].length;
|
|
@@ -22551,11 +21738,8 @@ function rule$n(primary) {
|
|
|
22551
21738
|
for (let fixPosition of fixPositions) {
|
|
22552
21739
|
let startIndex = fixPosition.startIndex;
|
|
22553
21740
|
let endIndex = fixPosition.endIndex;
|
|
22554
|
-
if (isAtRule(node2))
|
|
22555
|
-
|
|
22556
|
-
} else {
|
|
22557
|
-
node2.value = removeTrailingZeros(node2.value, startIndex, endIndex);
|
|
22558
|
-
}
|
|
21741
|
+
if (isAtRule(node2)) node2.params = removeTrailingZeros(node2.params, startIndex, endIndex);
|
|
21742
|
+
else node2.value = removeTrailingZeros(node2.value, startIndex, endIndex);
|
|
22559
21743
|
}
|
|
22560
21744
|
}
|
|
22561
21745
|
}
|
|
@@ -22575,18 +21759,10 @@ const index$n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
22575
21759
|
ruleName: ruleName$n
|
|
22576
21760
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
22577
21761
|
function isStandardSyntaxProperty(property) {
|
|
22578
|
-
if (isScssVariable(property))
|
|
22579
|
-
|
|
22580
|
-
|
|
22581
|
-
if (property
|
|
22582
|
-
return false;
|
|
22583
|
-
}
|
|
22584
|
-
if (property.endsWith(`+`) || property.endsWith(`+_`)) {
|
|
22585
|
-
return false;
|
|
22586
|
-
}
|
|
22587
|
-
if (hasInterpolation(property)) {
|
|
22588
|
-
return false;
|
|
22589
|
-
}
|
|
21762
|
+
if (isScssVariable(property)) return false;
|
|
21763
|
+
if (property.startsWith(`@`)) return false;
|
|
21764
|
+
if (property.endsWith(`+`) || property.endsWith(`+_`)) return false;
|
|
21765
|
+
if (hasInterpolation(property)) return false;
|
|
22590
21766
|
return true;
|
|
22591
21767
|
}
|
|
22592
21768
|
let { utils: { report: report$f, ruleMessages: ruleMessages$m, validateOptions: validateOptions$m } } = stylelint;
|
|
@@ -22616,31 +21792,19 @@ function rule$m(primary, secondaryOptions) {
|
|
|
22616
21792
|
optional: true
|
|
22617
21793
|
}
|
|
22618
21794
|
);
|
|
22619
|
-
if (!validOptions)
|
|
22620
|
-
return;
|
|
22621
|
-
}
|
|
21795
|
+
if (!validOptions) return;
|
|
22622
21796
|
root2.walkDecls((decl) => {
|
|
22623
21797
|
let prop = decl.prop;
|
|
22624
|
-
if (!isStandardSyntaxProperty(prop))
|
|
22625
|
-
|
|
22626
|
-
}
|
|
22627
|
-
if (isCustomProperty(prop)) {
|
|
22628
|
-
return;
|
|
22629
|
-
}
|
|
21798
|
+
if (!isStandardSyntaxProperty(prop)) return;
|
|
21799
|
+
if (isCustomProperty(prop)) return;
|
|
22630
21800
|
let { parent } = decl;
|
|
22631
|
-
if (!parent)
|
|
22632
|
-
throw new Error(`A parent node must be present`);
|
|
22633
|
-
}
|
|
21801
|
+
if (!parent) throw new Error(`A parent node must be present`);
|
|
22634
21802
|
if (isRule(parent)) {
|
|
22635
21803
|
let { selector: selector2 } = parent;
|
|
22636
|
-
if (selector2 && optionsMatches(secondaryOptions, `ignoreSelectors`, selector2))
|
|
22637
|
-
return;
|
|
22638
|
-
}
|
|
21804
|
+
if (selector2 && optionsMatches(secondaryOptions, `ignoreSelectors`, selector2)) return;
|
|
22639
21805
|
}
|
|
22640
21806
|
let expectedProp = primary === `lower` ? prop.toLowerCase() : prop.toUpperCase();
|
|
22641
|
-
if (prop === expectedProp)
|
|
22642
|
-
return;
|
|
22643
|
-
}
|
|
21807
|
+
if (prop === expectedProp) return;
|
|
22644
21808
|
report$f({
|
|
22645
21809
|
message: messages$m.expected,
|
|
22646
21810
|
messageArgs: [prop, expectedProp],
|
|
@@ -26319,16 +25483,10 @@ function rule$l(primary) {
|
|
|
26319
25483
|
actual: primary,
|
|
26320
25484
|
possible: [`always`, `never`]
|
|
26321
25485
|
});
|
|
26322
|
-
if (!validOptions)
|
|
26323
|
-
return;
|
|
26324
|
-
}
|
|
25486
|
+
if (!validOptions) return;
|
|
26325
25487
|
root2.walkRules((ruleNode) => {
|
|
26326
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
26327
|
-
|
|
26328
|
-
}
|
|
26329
|
-
if (!ruleNode.selector.includes(`[`)) {
|
|
26330
|
-
return;
|
|
26331
|
-
}
|
|
25488
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
25489
|
+
if (!ruleNode.selector.includes(`[`)) return;
|
|
26332
25490
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
26333
25491
|
let fix = null;
|
|
26334
25492
|
let hasFixed;
|
|
@@ -26374,11 +25532,8 @@ function rule$l(primary) {
|
|
|
26374
25532
|
});
|
|
26375
25533
|
});
|
|
26376
25534
|
if (hasFixed && fixedSelector) {
|
|
26377
|
-
if (!ruleNode.raws.selector)
|
|
26378
|
-
|
|
26379
|
-
} else {
|
|
26380
|
-
ruleNode.raws.selector.raw = fixedSelector;
|
|
26381
|
-
}
|
|
25535
|
+
if (!ruleNode.raws.selector) ruleNode.selector = fixedSelector;
|
|
25536
|
+
else ruleNode.raws.selector.raw = fixedSelector;
|
|
26382
25537
|
}
|
|
26383
25538
|
function complain(message, index2) {
|
|
26384
25539
|
report$e({
|
|
@@ -26404,17 +25559,12 @@ function rule$l(primary) {
|
|
|
26404
25559
|
} : {
|
|
26405
25560
|
attrBefore: attributeNode.spaces.attribute && attributeNode.spaces.attribute.before || ``,
|
|
26406
25561
|
setAttrBefore(fixed) {
|
|
26407
|
-
if (!attributeNode.spaces.attribute) {
|
|
26408
|
-
attributeNode.spaces.attribute = {};
|
|
26409
|
-
}
|
|
25562
|
+
if (!attributeNode.spaces.attribute) attributeNode.spaces.attribute = {};
|
|
26410
25563
|
attributeNode.spaces.attribute.before = fixed;
|
|
26411
25564
|
}
|
|
26412
25565
|
};
|
|
26413
|
-
if (primary === `always`)
|
|
26414
|
-
|
|
26415
|
-
} else if (primary === `never`) {
|
|
26416
|
-
setAttrBefore(attrBefore.replace(/^\s*/, ``));
|
|
26417
|
-
}
|
|
25566
|
+
if (primary === `always`) setAttrBefore(attrBefore.replace(/^\s*/, ` `));
|
|
25567
|
+
else if (primary === `never`) setAttrBefore(attrBefore.replace(/^\s*/, ``));
|
|
26418
25568
|
}
|
|
26419
25569
|
function fixAfter(attributeNode) {
|
|
26420
25570
|
let key = attributeNode.operator ? attributeNode.insensitive ? `insensitive` : `value` : `attribute`;
|
|
@@ -26429,17 +25579,12 @@ function rule$l(primary) {
|
|
|
26429
25579
|
} : {
|
|
26430
25580
|
after: spaces && spaces.after || ``,
|
|
26431
25581
|
setAfter(fixed) {
|
|
26432
|
-
if (!attributeNode.spaces[key]) {
|
|
26433
|
-
attributeNode.spaces[key] = {};
|
|
26434
|
-
}
|
|
25582
|
+
if (!attributeNode.spaces[key]) attributeNode.spaces[key] = {};
|
|
26435
25583
|
attributeNode.spaces[key].after = fixed;
|
|
26436
25584
|
}
|
|
26437
25585
|
};
|
|
26438
|
-
if (primary === `always`)
|
|
26439
|
-
|
|
26440
|
-
} else if (primary === `never`) {
|
|
26441
|
-
setAfter(after.replace(/\s*$/, ``));
|
|
26442
|
-
}
|
|
25586
|
+
if (primary === `always`) setAfter(after.replace(/\s*$/, ` `));
|
|
25587
|
+
else if (primary === `never`) setAfter(after.replace(/\s*$/, ``));
|
|
26443
25588
|
}
|
|
26444
25589
|
}
|
|
26445
25590
|
rule$l.ruleName = ruleName$l;
|
|
@@ -26455,20 +25600,14 @@ const index$l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
26455
25600
|
let { utils: { report: report$d } } = stylelint;
|
|
26456
25601
|
function selectorAttributeOperatorSpaceChecker(options) {
|
|
26457
25602
|
options.root.walkRules((rule2) => {
|
|
26458
|
-
if (!isStandardSyntaxRule(rule2))
|
|
26459
|
-
|
|
26460
|
-
}
|
|
26461
|
-
if (!rule2.selector.includes(`[`) || !rule2.selector.includes(`=`)) {
|
|
26462
|
-
return;
|
|
26463
|
-
}
|
|
25603
|
+
if (!isStandardSyntaxRule(rule2)) return;
|
|
25604
|
+
if (!rule2.selector.includes(`[`) || !rule2.selector.includes(`=`)) return;
|
|
26464
25605
|
let hasFixed = false;
|
|
26465
25606
|
let selector2 = rule2.raws.selector ? rule2.raws.selector.raw : rule2.selector;
|
|
26466
25607
|
let fixedSelector = parseSelector(selector2, options.result, rule2, (selectorTree) => {
|
|
26467
25608
|
selectorTree.walkAttributes((attributeNode) => {
|
|
26468
25609
|
let operator = attributeNode.operator;
|
|
26469
|
-
if (!operator)
|
|
26470
|
-
return;
|
|
26471
|
-
}
|
|
25610
|
+
if (!operator) return;
|
|
26472
25611
|
let attributeNodeString = attributeNode.toString();
|
|
26473
25612
|
styleSearch({ source: attributeNodeString, target: operator }, (match) => {
|
|
26474
25613
|
let index2 = options.checkBeforeOperator ? match.startIndex : match.endIndex - 1;
|
|
@@ -26477,11 +25616,8 @@ function selectorAttributeOperatorSpaceChecker(options) {
|
|
|
26477
25616
|
});
|
|
26478
25617
|
});
|
|
26479
25618
|
if (hasFixed && fixedSelector) {
|
|
26480
|
-
if (!rule2.raws.selector)
|
|
26481
|
-
|
|
26482
|
-
} else {
|
|
26483
|
-
rule2.raws.selector.raw = fixedSelector;
|
|
26484
|
-
}
|
|
25619
|
+
if (!rule2.raws.selector) rule2.selector = fixedSelector;
|
|
25620
|
+
else rule2.raws.selector.raw = fixedSelector;
|
|
26485
25621
|
}
|
|
26486
25622
|
function checkOperator(source, index2, node2, attributeNode, operator) {
|
|
26487
25623
|
options.locationChecker({
|
|
@@ -26527,9 +25663,7 @@ function rule$k(primary) {
|
|
|
26527
25663
|
actual: primary,
|
|
26528
25664
|
possible: [`always`, `never`]
|
|
26529
25665
|
});
|
|
26530
|
-
if (!validOptions)
|
|
26531
|
-
return;
|
|
26532
|
-
}
|
|
25666
|
+
if (!validOptions) return;
|
|
26533
25667
|
selectorAttributeOperatorSpaceChecker({
|
|
26534
25668
|
root: root2,
|
|
26535
25669
|
result: result2,
|
|
@@ -26546,12 +25680,8 @@ function rule$k(primary) {
|
|
|
26546
25680
|
),
|
|
26547
25681
|
setOperatorAfter(fixed) {
|
|
26548
25682
|
delete attributeNode.raws.operator;
|
|
26549
|
-
if (!attributeNode.raws.spaces) {
|
|
26550
|
-
|
|
26551
|
-
}
|
|
26552
|
-
if (!attributeNode.raws.spaces.operator) {
|
|
26553
|
-
attributeNode.raws.spaces.operator = {};
|
|
26554
|
-
}
|
|
25683
|
+
if (!attributeNode.raws.spaces) attributeNode.raws.spaces = {};
|
|
25684
|
+
if (!attributeNode.raws.spaces.operator) attributeNode.raws.spaces.operator = {};
|
|
26555
25685
|
attributeNode.raws.spaces.operator.after = fixed;
|
|
26556
25686
|
}
|
|
26557
25687
|
};
|
|
@@ -26569,9 +25699,7 @@ function rule$k(primary) {
|
|
|
26569
25699
|
return {
|
|
26570
25700
|
operatorAfter: attributeNode.spaces.operator && attributeNode.spaces.operator.after || ``,
|
|
26571
25701
|
setOperatorAfter(fixed) {
|
|
26572
|
-
if (!attributeNode.spaces.operator) {
|
|
26573
|
-
attributeNode.spaces.operator = {};
|
|
26574
|
-
}
|
|
25702
|
+
if (!attributeNode.spaces.operator) attributeNode.spaces.operator = {};
|
|
26575
25703
|
attributeNode.spaces.operator.after = fixed;
|
|
26576
25704
|
}
|
|
26577
25705
|
};
|
|
@@ -26617,9 +25745,7 @@ function rule$j(primary) {
|
|
|
26617
25745
|
actual: primary,
|
|
26618
25746
|
possible: [`always`, `never`]
|
|
26619
25747
|
});
|
|
26620
|
-
if (!validOptions)
|
|
26621
|
-
return;
|
|
26622
|
-
}
|
|
25748
|
+
if (!validOptions) return;
|
|
26623
25749
|
selectorAttributeOperatorSpaceChecker({
|
|
26624
25750
|
root: root2,
|
|
26625
25751
|
result: result2,
|
|
@@ -26637,9 +25763,7 @@ function rule$j(primary) {
|
|
|
26637
25763
|
} : {
|
|
26638
25764
|
attrAfter: attributeNode.spaces.attribute && attributeNode.spaces.attribute.after || ``,
|
|
26639
25765
|
setAttrAfter(fixed) {
|
|
26640
|
-
if (!attributeNode.spaces.attribute) {
|
|
26641
|
-
attributeNode.spaces.attribute = {};
|
|
26642
|
-
}
|
|
25766
|
+
if (!attributeNode.spaces.attribute) attributeNode.spaces.attribute = {};
|
|
26643
25767
|
attributeNode.spaces.attribute.after = fixed;
|
|
26644
25768
|
}
|
|
26645
25769
|
};
|
|
@@ -26667,20 +25791,12 @@ const index$j = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
26667
25791
|
ruleName: ruleName$j
|
|
26668
25792
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
26669
25793
|
function isStandardSyntaxCombinator(node2) {
|
|
26670
|
-
if (node2.type !== `combinator`)
|
|
26671
|
-
|
|
26672
|
-
}
|
|
26673
|
-
if (node2.value.startsWith(`/`) || node2.value.endsWith(`/`)) {
|
|
26674
|
-
return false;
|
|
26675
|
-
}
|
|
25794
|
+
if (node2.type !== `combinator`) return false;
|
|
25795
|
+
if (node2.value.startsWith(`/`) || node2.value.endsWith(`/`)) return false;
|
|
26676
25796
|
if (node2.parent !== void 0 && node2.parent !== null) {
|
|
26677
25797
|
let parent = node2.parent;
|
|
26678
|
-
if (node2 === parent.first)
|
|
26679
|
-
|
|
26680
|
-
}
|
|
26681
|
-
if (node2 === parent.last) {
|
|
26682
|
-
return false;
|
|
26683
|
-
}
|
|
25798
|
+
if (node2 === parent.first) return false;
|
|
25799
|
+
if (node2 === parent.last) return false;
|
|
26684
25800
|
}
|
|
26685
25801
|
return true;
|
|
26686
25802
|
}
|
|
@@ -26688,37 +25804,24 @@ let { utils: { report: report$c } } = stylelint;
|
|
|
26688
25804
|
function selectorCombinatorSpaceChecker(opts) {
|
|
26689
25805
|
let hasFixed;
|
|
26690
25806
|
opts.root.walkRules((rule2) => {
|
|
26691
|
-
if (!isStandardSyntaxRule(rule2))
|
|
26692
|
-
return;
|
|
26693
|
-
}
|
|
25807
|
+
if (!isStandardSyntaxRule(rule2)) return;
|
|
26694
25808
|
hasFixed = false;
|
|
26695
25809
|
let selector2 = rule2.raws.selector ? rule2.raws.selector.raw : rule2.selector;
|
|
26696
25810
|
let fixedSelector = parseSelector(selector2, opts.result, rule2, (selectorTree) => {
|
|
26697
25811
|
selectorTree.walkCombinators((node2) => {
|
|
26698
|
-
if (!isStandardSyntaxCombinator(node2))
|
|
26699
|
-
|
|
26700
|
-
|
|
26701
|
-
if (/\s/.test(node2.value)) {
|
|
26702
|
-
return;
|
|
26703
|
-
}
|
|
26704
|
-
if (opts.locationType === `before` && !node2.prev()) {
|
|
26705
|
-
return;
|
|
26706
|
-
}
|
|
25812
|
+
if (!isStandardSyntaxCombinator(node2)) return;
|
|
25813
|
+
if (/\s/.test(node2.value)) return;
|
|
25814
|
+
if (opts.locationType === `before` && !node2.prev()) return;
|
|
26707
25815
|
let parentParentNode = node2.parent && node2.parent.parent;
|
|
26708
|
-
if (parentParentNode && parentParentNode.type === `pseudo`)
|
|
26709
|
-
return;
|
|
26710
|
-
}
|
|
25816
|
+
if (parentParentNode && parentParentNode.type === `pseudo`) return;
|
|
26711
25817
|
let sourceIndex = node2.sourceIndex;
|
|
26712
25818
|
let index2 = node2.value.length > 1 && opts.locationType === `before` ? sourceIndex : sourceIndex + node2.value.length - 1;
|
|
26713
25819
|
check(selector2, node2, index2, rule2, sourceIndex);
|
|
26714
25820
|
});
|
|
26715
25821
|
});
|
|
26716
25822
|
if (hasFixed && fixedSelector) {
|
|
26717
|
-
if (!rule2.raws.selector)
|
|
26718
|
-
|
|
26719
|
-
} else {
|
|
26720
|
-
rule2.raws.selector.raw = fixedSelector;
|
|
26721
|
-
}
|
|
25823
|
+
if (!rule2.raws.selector) rule2.selector = fixedSelector;
|
|
25824
|
+
else rule2.raws.selector.raw = fixedSelector;
|
|
26722
25825
|
}
|
|
26723
25826
|
});
|
|
26724
25827
|
function check(source, combinator2, index2, node2, sourceIndex) {
|
|
@@ -26761,9 +25864,7 @@ function rule$i(primary) {
|
|
|
26761
25864
|
actual: primary,
|
|
26762
25865
|
possible: [`always`, `never`]
|
|
26763
25866
|
});
|
|
26764
|
-
if (!validOptions)
|
|
26765
|
-
return;
|
|
26766
|
-
}
|
|
25867
|
+
if (!validOptions) return;
|
|
26767
25868
|
selectorCombinatorSpaceChecker({
|
|
26768
25869
|
root: root2,
|
|
26769
25870
|
result: result2,
|
|
@@ -26812,9 +25913,7 @@ function rule$h(primary) {
|
|
|
26812
25913
|
actual: primary,
|
|
26813
25914
|
possible: [`always`, `never`]
|
|
26814
25915
|
});
|
|
26815
|
-
if (!validOptions)
|
|
26816
|
-
return;
|
|
26817
|
-
}
|
|
25916
|
+
if (!validOptions) return;
|
|
26818
25917
|
selectorCombinatorSpaceChecker({
|
|
26819
25918
|
root: root2,
|
|
26820
25919
|
result: result2,
|
|
@@ -26860,23 +25959,15 @@ function rule$g(primary) {
|
|
|
26860
25959
|
let validOptions = validateOptions$g(result2, ruleName$g, {
|
|
26861
25960
|
actual: primary
|
|
26862
25961
|
});
|
|
26863
|
-
if (!validOptions)
|
|
26864
|
-
return;
|
|
26865
|
-
}
|
|
25962
|
+
if (!validOptions) return;
|
|
26866
25963
|
root2.walkRules((ruleNode) => {
|
|
26867
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
26868
|
-
return;
|
|
26869
|
-
}
|
|
25964
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26870
25965
|
let hasFixed = false;
|
|
26871
25966
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
26872
|
-
if (selector2.includes(`/*`))
|
|
26873
|
-
return;
|
|
26874
|
-
}
|
|
25967
|
+
if (selector2.includes(`/*`)) return;
|
|
26875
25968
|
let fixedSelector = parseSelector(selector2, result2, ruleNode, (fullSelector) => {
|
|
26876
25969
|
fullSelector.walkCombinators((combinatorNode) => {
|
|
26877
|
-
if (combinatorNode.value !== ` `)
|
|
26878
|
-
return;
|
|
26879
|
-
}
|
|
25970
|
+
if (combinatorNode.value !== ` `) return;
|
|
26880
25971
|
let value = combinatorNode.toString();
|
|
26881
25972
|
if (value.includes(` `) || value.includes(` `) || value.includes(`
|
|
26882
25973
|
`) || value.includes(`\r`)) {
|
|
@@ -26891,9 +25982,7 @@ function rule$g(primary) {
|
|
|
26891
25982
|
fix() {
|
|
26892
25983
|
if (/^\s+$/.test(value)) {
|
|
26893
25984
|
hasFixed = true;
|
|
26894
|
-
if (!combinatorNode.raws) {
|
|
26895
|
-
combinatorNode.raws = {};
|
|
26896
|
-
}
|
|
25985
|
+
if (!combinatorNode.raws) combinatorNode.raws = {};
|
|
26897
25986
|
combinatorNode.raws.value = ` `;
|
|
26898
25987
|
combinatorNode.rawSpaceBefore = combinatorNode.rawSpaceBefore.replace(/^\s+/, ``);
|
|
26899
25988
|
combinatorNode.rawSpaceAfter = combinatorNode.rawSpaceAfter.replace(/\s+$/, ``);
|
|
@@ -26904,11 +25993,8 @@ function rule$g(primary) {
|
|
|
26904
25993
|
});
|
|
26905
25994
|
});
|
|
26906
25995
|
if (hasFixed && fixedSelector) {
|
|
26907
|
-
if (!ruleNode.raws.selector)
|
|
26908
|
-
|
|
26909
|
-
} else {
|
|
26910
|
-
ruleNode.raws.selector.raw = fixedSelector;
|
|
26911
|
-
}
|
|
25996
|
+
if (!ruleNode.raws.selector) ruleNode.selector = fixedSelector;
|
|
25997
|
+
else ruleNode.raws.selector.raw = fixedSelector;
|
|
26912
25998
|
}
|
|
26913
25999
|
});
|
|
26914
26000
|
};
|
|
@@ -26942,13 +26028,9 @@ function rule$f(primary, _secondaryOptions, context) {
|
|
|
26942
26028
|
actual: primary,
|
|
26943
26029
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
26944
26030
|
});
|
|
26945
|
-
if (!validOptions)
|
|
26946
|
-
return;
|
|
26947
|
-
}
|
|
26031
|
+
if (!validOptions) return;
|
|
26948
26032
|
root2.walkRules((ruleNode) => {
|
|
26949
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
26950
|
-
return;
|
|
26951
|
-
}
|
|
26033
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26952
26034
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
26953
26035
|
let fixIndices = [];
|
|
26954
26036
|
styleSearch(
|
|
@@ -26959,9 +26041,7 @@ function rule$f(primary, _secondaryOptions, context) {
|
|
|
26959
26041
|
},
|
|
26960
26042
|
(match) => {
|
|
26961
26043
|
let nextChars = selector2.slice(match.endIndex);
|
|
26962
|
-
if (/^\s+\/\//.test(nextChars))
|
|
26963
|
-
return;
|
|
26964
|
-
}
|
|
26044
|
+
if (/^\s+\/\//.test(nextChars)) return;
|
|
26965
26045
|
let indextoCheckAfter = /^\s+\/\*/.test(nextChars) ? selector2.indexOf(`*/`, match.endIndex) + 1 : match.startIndex;
|
|
26966
26046
|
checker.afterOneOnly({
|
|
26967
26047
|
source: selector2,
|
|
@@ -26987,18 +26067,12 @@ function rule$f(primary, _secondaryOptions, context) {
|
|
|
26987
26067
|
for (let index2 of fixIndices.sort((a2, b2) => b2 - a2)) {
|
|
26988
26068
|
let beforeSelector = fixedSelector.slice(0, index2);
|
|
26989
26069
|
let afterSelector = fixedSelector.slice(index2);
|
|
26990
|
-
if (primary.startsWith(`always`))
|
|
26991
|
-
|
|
26992
|
-
} else if (primary.startsWith(`never-multi-line`)) {
|
|
26993
|
-
afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
26994
|
-
}
|
|
26070
|
+
if (primary.startsWith(`always`)) afterSelector = context.newline + afterSelector;
|
|
26071
|
+
else if (primary.startsWith(`never-multi-line`)) afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
26995
26072
|
fixedSelector = beforeSelector + afterSelector;
|
|
26996
26073
|
}
|
|
26997
|
-
if (ruleNode.raws.selector)
|
|
26998
|
-
|
|
26999
|
-
} else {
|
|
27000
|
-
ruleNode.selector = fixedSelector;
|
|
27001
|
-
}
|
|
26074
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = fixedSelector;
|
|
26075
|
+
else ruleNode.selector = fixedSelector;
|
|
27002
26076
|
}
|
|
27003
26077
|
});
|
|
27004
26078
|
};
|
|
@@ -27016,9 +26090,7 @@ const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
27016
26090
|
let { utils: { report: report$9 } } = stylelint;
|
|
27017
26091
|
function selectorListCommaWhitespaceChecker(opts) {
|
|
27018
26092
|
opts.root.walkRules((rule2) => {
|
|
27019
|
-
if (!isStandardSyntaxRule(rule2))
|
|
27020
|
-
return;
|
|
27021
|
-
}
|
|
26093
|
+
if (!isStandardSyntaxRule(rule2)) return;
|
|
27022
26094
|
let selector2 = rule2.raws.selector ? rule2.raws.selector.raw : rule2.selector;
|
|
27023
26095
|
styleSearch(
|
|
27024
26096
|
{
|
|
@@ -27068,9 +26140,7 @@ function rule$e(primary, _secondaryOptions, context) {
|
|
|
27068
26140
|
actual: primary,
|
|
27069
26141
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
27070
26142
|
});
|
|
27071
|
-
if (!validOptions)
|
|
27072
|
-
return;
|
|
27073
|
-
}
|
|
26143
|
+
if (!validOptions) return;
|
|
27074
26144
|
let fixData;
|
|
27075
26145
|
selectorListCommaWhitespaceChecker({
|
|
27076
26146
|
root: root2,
|
|
@@ -27094,16 +26164,11 @@ function rule$e(primary, _secondaryOptions, context) {
|
|
|
27094
26164
|
if (primary.startsWith(`always`)) {
|
|
27095
26165
|
let spaceIndex = beforeSelector.search(/\s+$/);
|
|
27096
26166
|
beforeSelector = spaceIndex >= 0 ? beforeSelector.slice(0, spaceIndex) + context.newline + beforeSelector.slice(spaceIndex) : beforeSelector + context.newline;
|
|
27097
|
-
} else if (primary === `never-multi-line`)
|
|
27098
|
-
beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27099
|
-
}
|
|
26167
|
+
} else if (primary === `never-multi-line`) beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27100
26168
|
selector2 = beforeSelector + afterSelector;
|
|
27101
26169
|
}
|
|
27102
|
-
if (ruleNode.raws.selector)
|
|
27103
|
-
|
|
27104
|
-
} else {
|
|
27105
|
-
ruleNode.selector = selector2;
|
|
27106
|
-
}
|
|
26170
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = selector2;
|
|
26171
|
+
else ruleNode.selector = selector2;
|
|
27107
26172
|
}
|
|
27108
26173
|
}
|
|
27109
26174
|
};
|
|
@@ -27138,9 +26203,7 @@ function rule$d(primary) {
|
|
|
27138
26203
|
actual: primary,
|
|
27139
26204
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
27140
26205
|
});
|
|
27141
|
-
if (!validOptions)
|
|
27142
|
-
return;
|
|
27143
|
-
}
|
|
26206
|
+
if (!validOptions) return;
|
|
27144
26207
|
let fixData;
|
|
27145
26208
|
selectorListCommaWhitespaceChecker({
|
|
27146
26209
|
root: root2,
|
|
@@ -27161,18 +26224,12 @@ function rule$d(primary) {
|
|
|
27161
26224
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
27162
26225
|
let beforeSelector = selector2.slice(0, index2 + 1);
|
|
27163
26226
|
let afterSelector = selector2.slice(index2 + 1);
|
|
27164
|
-
if (primary.startsWith(`always`))
|
|
27165
|
-
|
|
27166
|
-
} else if (primary.startsWith(`never`)) {
|
|
27167
|
-
afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
27168
|
-
}
|
|
26227
|
+
if (primary.startsWith(`always`)) afterSelector = afterSelector.replace(/^\s*/, ` `);
|
|
26228
|
+
else if (primary.startsWith(`never`)) afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
27169
26229
|
selector2 = beforeSelector + afterSelector;
|
|
27170
26230
|
}
|
|
27171
|
-
if (ruleNode.raws.selector)
|
|
27172
|
-
|
|
27173
|
-
} else {
|
|
27174
|
-
ruleNode.selector = selector2;
|
|
27175
|
-
}
|
|
26231
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = selector2;
|
|
26232
|
+
else ruleNode.selector = selector2;
|
|
27176
26233
|
}
|
|
27177
26234
|
}
|
|
27178
26235
|
};
|
|
@@ -27207,9 +26264,7 @@ function rule$c(primary) {
|
|
|
27207
26264
|
actual: primary,
|
|
27208
26265
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
27209
26266
|
});
|
|
27210
|
-
if (!validOptions)
|
|
27211
|
-
return;
|
|
27212
|
-
}
|
|
26267
|
+
if (!validOptions) return;
|
|
27213
26268
|
let fixData;
|
|
27214
26269
|
selectorListCommaWhitespaceChecker({
|
|
27215
26270
|
root: root2,
|
|
@@ -27230,18 +26285,12 @@ function rule$c(primary) {
|
|
|
27230
26285
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
27231
26286
|
let beforeSelector = selector2.slice(0, index2);
|
|
27232
26287
|
let afterSelector = selector2.slice(index2);
|
|
27233
|
-
if (primary.includes(`always`))
|
|
27234
|
-
|
|
27235
|
-
} else if (primary.includes(`never`)) {
|
|
27236
|
-
beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27237
|
-
}
|
|
26288
|
+
if (primary.includes(`always`)) beforeSelector = beforeSelector.replace(/\s*$/, ` `);
|
|
26289
|
+
else if (primary.includes(`never`)) beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27238
26290
|
selector2 = beforeSelector + afterSelector;
|
|
27239
26291
|
}
|
|
27240
|
-
if (ruleNode.raws.selector)
|
|
27241
|
-
|
|
27242
|
-
} else {
|
|
27243
|
-
ruleNode.selector = selector2;
|
|
27244
|
-
}
|
|
26292
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = selector2;
|
|
26293
|
+
else ruleNode.selector = selector2;
|
|
27245
26294
|
}
|
|
27246
26295
|
}
|
|
27247
26296
|
};
|
|
@@ -27273,9 +26322,7 @@ function rule$b(primary) {
|
|
|
27273
26322
|
actual: primary,
|
|
27274
26323
|
possible: isNumber$1
|
|
27275
26324
|
});
|
|
27276
|
-
if (!validOptions)
|
|
27277
|
-
return;
|
|
27278
|
-
}
|
|
26325
|
+
if (!validOptions) return;
|
|
27279
26326
|
let violatedCRLFNewLinesRegex = new RegExp(`(?:\r
|
|
27280
26327
|
){${maxAdjacentNewlines + 1},}`);
|
|
27281
26328
|
let violatedLFNewLinesRegex = new RegExp(`
|
|
@@ -27297,11 +26344,8 @@ function rule$b(primary) {
|
|
|
27297
26344
|
ruleName: ruleName$b,
|
|
27298
26345
|
fix() {
|
|
27299
26346
|
let newSelectorString = selector2.replace(new RegExp(violatedLFNewLinesRegex, `gm`), allowedLFNewLinesString).replace(new RegExp(violatedCRLFNewLinesRegex, `gm`), allowedCRLFNewLinesString);
|
|
27300
|
-
if (ruleNode.raws.selector)
|
|
27301
|
-
|
|
27302
|
-
} else {
|
|
27303
|
-
ruleNode.selector = newSelectorString;
|
|
27304
|
-
}
|
|
26347
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = newSelectorString;
|
|
26348
|
+
else ruleNode.selector = newSelectorString;
|
|
27305
26349
|
}
|
|
27306
26350
|
});
|
|
27307
26351
|
}
|
|
@@ -27340,17 +26384,11 @@ function rule$a(primary) {
|
|
|
27340
26384
|
actual: primary,
|
|
27341
26385
|
possible: [`lower`, `upper`]
|
|
27342
26386
|
});
|
|
27343
|
-
if (!validOptions)
|
|
27344
|
-
return;
|
|
27345
|
-
}
|
|
26387
|
+
if (!validOptions) return;
|
|
27346
26388
|
root2.walkRules((ruleNode) => {
|
|
27347
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27348
|
-
return;
|
|
27349
|
-
}
|
|
26389
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
27350
26390
|
let selector2 = ruleNode.selector;
|
|
27351
|
-
if (!selector2.includes(`:`))
|
|
27352
|
-
return;
|
|
27353
|
-
}
|
|
26391
|
+
if (!selector2.includes(`:`)) return;
|
|
27354
26392
|
let fixedSelector = parseSelector(
|
|
27355
26393
|
ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector,
|
|
27356
26394
|
result2,
|
|
@@ -27358,16 +26396,10 @@ function rule$a(primary) {
|
|
|
27358
26396
|
(selectorTree) => {
|
|
27359
26397
|
selectorTree.walkPseudos((pseudoNode) => {
|
|
27360
26398
|
let pseudo2 = pseudoNode.value;
|
|
27361
|
-
if (!isStandardSyntaxSelector(pseudo2))
|
|
27362
|
-
|
|
27363
|
-
}
|
|
27364
|
-
if (pseudo2.includes(`::`) || levelOneAndTwoPseudoElements.has(pseudo2.toLowerCase().slice(1))) {
|
|
27365
|
-
return;
|
|
27366
|
-
}
|
|
26399
|
+
if (!isStandardSyntaxSelector(pseudo2)) return;
|
|
26400
|
+
if (pseudo2.includes(`::`) || levelOneAndTwoPseudoElements.has(pseudo2.toLowerCase().slice(1))) return;
|
|
27367
26401
|
let expectedPseudo = primary === `lower` ? pseudo2.toLowerCase() : pseudo2.toUpperCase();
|
|
27368
|
-
if (pseudo2 === expectedPseudo)
|
|
27369
|
-
return;
|
|
27370
|
-
}
|
|
26402
|
+
if (pseudo2 === expectedPseudo) return;
|
|
27371
26403
|
report$7({
|
|
27372
26404
|
message: messages$a.expected,
|
|
27373
26405
|
messageArgs: [pseudo2, expectedPseudo],
|
|
@@ -27384,11 +26416,8 @@ function rule$a(primary) {
|
|
|
27384
26416
|
}
|
|
27385
26417
|
);
|
|
27386
26418
|
if (fixedSelector) {
|
|
27387
|
-
if (ruleNode.raws.selector)
|
|
27388
|
-
|
|
27389
|
-
} else {
|
|
27390
|
-
ruleNode.selector = fixedSelector;
|
|
27391
|
-
}
|
|
26419
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = fixedSelector;
|
|
26420
|
+
else ruleNode.selector = fixedSelector;
|
|
27392
26421
|
}
|
|
27393
26422
|
});
|
|
27394
26423
|
};
|
|
@@ -27422,25 +26451,19 @@ function rule$9(primary) {
|
|
|
27422
26451
|
actual: primary,
|
|
27423
26452
|
possible: [`always`, `never`]
|
|
27424
26453
|
});
|
|
27425
|
-
if (!validOptions)
|
|
27426
|
-
return;
|
|
27427
|
-
}
|
|
26454
|
+
if (!validOptions) return;
|
|
27428
26455
|
root2.walkRules((ruleNode) => {
|
|
27429
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27430
|
-
|
|
27431
|
-
}
|
|
27432
|
-
if (!ruleNode.selector.includes(`(`)) {
|
|
27433
|
-
return;
|
|
27434
|
-
}
|
|
26456
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26457
|
+
if (!ruleNode.selector.includes(`(`)) return;
|
|
27435
26458
|
let fix = null;
|
|
27436
26459
|
let hasFixed = false;
|
|
27437
26460
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
27438
26461
|
let fixedSelector = parseSelector(selector2, result2, ruleNode, (selectorTree) => {
|
|
27439
26462
|
selectorTree.walkPseudos((pseudoNode) => {
|
|
27440
|
-
if (!pseudoNode.length)
|
|
27441
|
-
return;
|
|
27442
|
-
}
|
|
26463
|
+
if (!pseudoNode.length) return;
|
|
27443
26464
|
let paramString = pseudoNode.map((node2) => String(node2)).join(`,`);
|
|
26465
|
+
let isParamStringMultiline = paramString.includes(`
|
|
26466
|
+
`);
|
|
27444
26467
|
let nextCharIsSpace = paramString.startsWith(` `);
|
|
27445
26468
|
let openIndex = pseudoNode.sourceIndex + pseudoNode.value.length + 1;
|
|
27446
26469
|
if (nextCharIsSpace && primary === `never`) {
|
|
@@ -27459,7 +26482,7 @@ function rule$9(primary) {
|
|
|
27459
26482
|
}
|
|
27460
26483
|
let prevCharIsSpace = paramString.endsWith(` `);
|
|
27461
26484
|
let closeIndex = openIndex + paramString.length - 1;
|
|
27462
|
-
if (prevCharIsSpace && primary === `never`) {
|
|
26485
|
+
if (prevCharIsSpace && primary === `never` && !isParamStringMultiline) {
|
|
27463
26486
|
fix = () => {
|
|
27464
26487
|
hasFixed = true;
|
|
27465
26488
|
setLastNodeSpaceAfter(pseudoNode, ``);
|
|
@@ -27476,11 +26499,8 @@ function rule$9(primary) {
|
|
|
27476
26499
|
});
|
|
27477
26500
|
});
|
|
27478
26501
|
if (hasFixed && fixedSelector) {
|
|
27479
|
-
if (!ruleNode.raws.selector)
|
|
27480
|
-
|
|
27481
|
-
} else {
|
|
27482
|
-
ruleNode.raws.selector.raw = fixedSelector;
|
|
27483
|
-
}
|
|
26502
|
+
if (!ruleNode.raws.selector) ruleNode.selector = fixedSelector;
|
|
26503
|
+
else ruleNode.raws.selector.raw = fixedSelector;
|
|
27484
26504
|
}
|
|
27485
26505
|
function complain(message, index2) {
|
|
27486
26506
|
report$6({
|
|
@@ -27498,19 +26518,13 @@ function rule$9(primary) {
|
|
|
27498
26518
|
}
|
|
27499
26519
|
function setFirstNodeSpaceBefore(node2, value) {
|
|
27500
26520
|
let target = node2.first;
|
|
27501
|
-
if (target.type === `selector`)
|
|
27502
|
-
|
|
27503
|
-
} else {
|
|
27504
|
-
target.spaces.before = value;
|
|
27505
|
-
}
|
|
26521
|
+
if (target.type === `selector`) setFirstNodeSpaceBefore(target, value);
|
|
26522
|
+
else target.spaces.before = value;
|
|
27506
26523
|
}
|
|
27507
26524
|
function setLastNodeSpaceAfter(node2, value) {
|
|
27508
26525
|
let target = node2.last;
|
|
27509
|
-
if (target.type === `selector`)
|
|
27510
|
-
|
|
27511
|
-
} else {
|
|
27512
|
-
target.spaces.after = value;
|
|
27513
|
-
}
|
|
26526
|
+
if (target.type === `selector`) setLastNodeSpaceAfter(target, value);
|
|
26527
|
+
else target.spaces.after = value;
|
|
27514
26528
|
}
|
|
27515
26529
|
rule$9.ruleName = ruleName$9;
|
|
27516
26530
|
rule$9.messages = messages$9;
|
|
@@ -27546,30 +26560,18 @@ function rule$8(primary) {
|
|
|
27546
26560
|
actual: primary,
|
|
27547
26561
|
possible: [`lower`, `upper`]
|
|
27548
26562
|
});
|
|
27549
|
-
if (!validOptions)
|
|
27550
|
-
return;
|
|
27551
|
-
}
|
|
26563
|
+
if (!validOptions) return;
|
|
27552
26564
|
root2.walkRules((ruleNode) => {
|
|
27553
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27554
|
-
return;
|
|
27555
|
-
}
|
|
26565
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
27556
26566
|
let selector2 = ruleNode.selector;
|
|
27557
|
-
if (!selector2.includes(`:`))
|
|
27558
|
-
return;
|
|
27559
|
-
}
|
|
26567
|
+
if (!selector2.includes(`:`)) return;
|
|
27560
26568
|
transformSelector(result2, ruleNode, (selectorTree) => {
|
|
27561
26569
|
selectorTree.walkPseudos((pseudoNode) => {
|
|
27562
26570
|
let pseudoElement = pseudoNode.value;
|
|
27563
|
-
if (!isStandardSyntaxSelector(pseudoElement))
|
|
27564
|
-
|
|
27565
|
-
}
|
|
27566
|
-
if (!pseudoElement.includes(`::`) && !levelOneAndTwoPseudoElements.has(pseudoElement.toLowerCase().slice(1))) {
|
|
27567
|
-
return;
|
|
27568
|
-
}
|
|
26571
|
+
if (!isStandardSyntaxSelector(pseudoElement)) return;
|
|
26572
|
+
if (!pseudoElement.includes(`::`) && !levelOneAndTwoPseudoElements.has(pseudoElement.toLowerCase().slice(1))) return;
|
|
27569
26573
|
let expectedPseudoElement = primary === `lower` ? pseudoElement.toLowerCase() : pseudoElement.toUpperCase();
|
|
27570
|
-
if (pseudoElement === expectedPseudoElement)
|
|
27571
|
-
return;
|
|
27572
|
-
}
|
|
26574
|
+
if (pseudoElement === expectedPseudoElement) return;
|
|
27573
26575
|
report$5({
|
|
27574
26576
|
message: messages$8.expected,
|
|
27575
26577
|
messageArgs: [pseudoElement, expectedPseudoElement],
|
|
@@ -27628,9 +26630,7 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27628
26630
|
optional: true
|
|
27629
26631
|
}
|
|
27630
26632
|
);
|
|
27631
|
-
if (!validOptions)
|
|
27632
|
-
return;
|
|
27633
|
-
}
|
|
26633
|
+
if (!validOptions) return;
|
|
27634
26634
|
let avoidEscape = secondaryOptions && secondaryOptions.avoidEscape !== void 0 ? secondaryOptions.avoidEscape : true;
|
|
27635
26635
|
root2.walk((node2) => {
|
|
27636
26636
|
switch (node2.type) {
|
|
@@ -27646,27 +26646,19 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27646
26646
|
}
|
|
27647
26647
|
});
|
|
27648
26648
|
function checkRule(ruleNode) {
|
|
27649
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27650
|
-
|
|
27651
|
-
}
|
|
27652
|
-
if (!ruleNode.selector.includes(`[`) || !ruleNode.selector.includes(`=`)) {
|
|
27653
|
-
return;
|
|
27654
|
-
}
|
|
26649
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26650
|
+
if (!ruleNode.selector.includes(`[`) || !ruleNode.selector.includes(`=`)) return;
|
|
27655
26651
|
let fixPositions = [];
|
|
27656
26652
|
parseSelector(ruleNode.selector, result2, ruleNode, (selectorTree) => {
|
|
27657
26653
|
let selectorFixed = false;
|
|
27658
26654
|
selectorTree.walkAttributes((attributeNode) => {
|
|
27659
|
-
if (!attributeNode.quoted)
|
|
27660
|
-
return;
|
|
27661
|
-
}
|
|
26655
|
+
if (!attributeNode.quoted) return;
|
|
27662
26656
|
const maybeProblemIndex = attributeNode.sourceIndex + attributeNode.offsetOf(`value`);
|
|
27663
26657
|
if (attributeNode.quoteMark === correctQuote && avoidEscape) {
|
|
27664
26658
|
assertString(attributeNode.value);
|
|
27665
26659
|
let needsCorrectEscape = attributeNode.value.includes(correctQuote);
|
|
27666
26660
|
let needsOtherEscape = attributeNode.value.includes(erroneousQuote);
|
|
27667
|
-
if (needsOtherEscape)
|
|
27668
|
-
return;
|
|
27669
|
-
}
|
|
26661
|
+
if (needsOtherEscape) return;
|
|
27670
26662
|
if (needsCorrectEscape) {
|
|
27671
26663
|
report$4({
|
|
27672
26664
|
message: messages$7.expected,
|
|
@@ -27704,9 +26696,7 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27704
26696
|
});
|
|
27705
26697
|
return;
|
|
27706
26698
|
}
|
|
27707
|
-
if (needsCorrectEscape)
|
|
27708
|
-
return;
|
|
27709
|
-
}
|
|
26699
|
+
if (needsCorrectEscape) return;
|
|
27710
26700
|
}
|
|
27711
26701
|
report$4({
|
|
27712
26702
|
message: messages$7.expected,
|
|
@@ -27723,24 +26713,16 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27723
26713
|
});
|
|
27724
26714
|
}
|
|
27725
26715
|
});
|
|
27726
|
-
if (selectorFixed)
|
|
27727
|
-
ruleNode.selector = selectorTree.toString();
|
|
27728
|
-
}
|
|
26716
|
+
if (selectorFixed) ruleNode.selector = selectorTree.toString();
|
|
27729
26717
|
});
|
|
27730
|
-
for (let fixIndex of fixPositions)
|
|
27731
|
-
ruleNode.selector = replaceQuote(ruleNode.selector, fixIndex, correctQuote);
|
|
27732
|
-
}
|
|
26718
|
+
for (let fixIndex of fixPositions) ruleNode.selector = replaceQuote(ruleNode.selector, fixIndex, correctQuote);
|
|
27733
26719
|
}
|
|
27734
26720
|
function checkDeclOrAtRule(node2, value, getIndex) {
|
|
27735
26721
|
let fixPositions = [];
|
|
27736
|
-
if (!value.includes(erroneousQuote))
|
|
27737
|
-
return;
|
|
27738
|
-
}
|
|
26722
|
+
if (!value.includes(erroneousQuote)) return;
|
|
27739
26723
|
if (isAtRule(node2) && node2.name === `charset`) {
|
|
27740
26724
|
let hasValidQuotes = node2.params.startsWith(`"`) && node2.params.endsWith(`"`);
|
|
27741
|
-
if (hasValidQuotes || correctQuote === `'`)
|
|
27742
|
-
return;
|
|
27743
|
-
}
|
|
26725
|
+
if (hasValidQuotes || correctQuote === `'`) return;
|
|
27744
26726
|
}
|
|
27745
26727
|
valueParser(value).walk((valueNode) => {
|
|
27746
26728
|
if (valueNode.type === `string` && valueNode.quote === erroneousQuote) {
|
|
@@ -27768,11 +26750,8 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27768
26750
|
}
|
|
27769
26751
|
});
|
|
27770
26752
|
for (let fixIndex of fixPositions) {
|
|
27771
|
-
if (isAtRule(node2))
|
|
27772
|
-
|
|
27773
|
-
} else {
|
|
27774
|
-
node2.value = replaceQuote(node2.value, fixIndex, correctQuote);
|
|
27775
|
-
}
|
|
26753
|
+
if (isAtRule(node2)) node2.params = replaceQuote(node2.params, fixIndex, correctQuote);
|
|
26754
|
+
else node2.value = replaceQuote(node2.value, fixIndex, correctQuote);
|
|
27776
26755
|
}
|
|
27777
26756
|
}
|
|
27778
26757
|
};
|
|
@@ -27806,9 +26785,7 @@ function rule$6(primary) {
|
|
|
27806
26785
|
actual: primary,
|
|
27807
26786
|
possible: [`always`, `never`]
|
|
27808
26787
|
});
|
|
27809
|
-
if (!validOptions || !root2.source || root2.source.inline || root2.source.lang === `object-literal` || root2.document !== void 0)
|
|
27810
|
-
return;
|
|
27811
|
-
}
|
|
26788
|
+
if (!validOptions || !root2.source || root2.source.inline || root2.source.lang === `object-literal` || root2.document !== void 0) return;
|
|
27812
26789
|
let { hasBOM } = root2.source.input;
|
|
27813
26790
|
if (primary === `always` && !hasBOM) {
|
|
27814
26791
|
report$3({
|
|
@@ -27843,27 +26820,13 @@ function blurInterpolation(source, blurChar = ` `) {
|
|
|
27843
26820
|
}
|
|
27844
26821
|
function isStandardSyntaxValue(value) {
|
|
27845
26822
|
let normalizedValue = value;
|
|
27846
|
-
if (/^[-+*/]/.test(value.charAt(0)))
|
|
27847
|
-
|
|
27848
|
-
|
|
27849
|
-
if (
|
|
27850
|
-
|
|
27851
|
-
|
|
27852
|
-
if (
|
|
27853
|
-
return false;
|
|
27854
|
-
}
|
|
27855
|
-
if (/^.+\.[-\w]+\(/.test(value)) {
|
|
27856
|
-
return false;
|
|
27857
|
-
}
|
|
27858
|
-
if (normalizedValue.startsWith(`@`)) {
|
|
27859
|
-
return false;
|
|
27860
|
-
}
|
|
27861
|
-
if (hasInterpolation(normalizedValue)) {
|
|
27862
|
-
return false;
|
|
27863
|
-
}
|
|
27864
|
-
if (/__MSG_\S+__/.test(value)) {
|
|
27865
|
-
return false;
|
|
27866
|
-
}
|
|
26823
|
+
if (/^[-+*/]/.test(value.charAt(0))) normalizedValue = normalizedValue.slice(1);
|
|
26824
|
+
if (normalizedValue.startsWith(`$`)) return false;
|
|
26825
|
+
if (/^.+\.\$/.test(value)) return false;
|
|
26826
|
+
if (/^.+\.[-\w]+\(/.test(value)) return false;
|
|
26827
|
+
if (normalizedValue.startsWith(`@`)) return false;
|
|
26828
|
+
if (hasInterpolation(normalizedValue)) return false;
|
|
26829
|
+
if (/__MSG_\S+__/.test(value)) return false;
|
|
27867
26830
|
return true;
|
|
27868
26831
|
}
|
|
27869
26832
|
function getDimension(node2) {
|
|
@@ -27917,20 +26880,14 @@ function rule$5(primary) {
|
|
|
27917
26880
|
actual: primary,
|
|
27918
26881
|
possible: [`lower`, `upper`]
|
|
27919
26882
|
});
|
|
27920
|
-
if (!validOptions)
|
|
27921
|
-
return;
|
|
27922
|
-
}
|
|
26883
|
+
if (!validOptions) return;
|
|
27923
26884
|
function check(node2, checkedValue, getIndex) {
|
|
27924
26885
|
let problems = [];
|
|
27925
26886
|
function processValue(valueNode) {
|
|
27926
26887
|
let { number, unit: unit2 } = getDimension(valueNode);
|
|
27927
|
-
if (!number || !unit2)
|
|
27928
|
-
return false;
|
|
27929
|
-
}
|
|
26888
|
+
if (!number || !unit2) return false;
|
|
27930
26889
|
let expectedUnit = primary === `lower` ? unit2.toLowerCase() : unit2.toUpperCase();
|
|
27931
|
-
if (unit2 === expectedUnit)
|
|
27932
|
-
return false;
|
|
27933
|
-
}
|
|
26890
|
+
if (unit2 === expectedUnit) return false;
|
|
27934
26891
|
let index2 = getIndex(node2);
|
|
27935
26892
|
problems.push({
|
|
27936
26893
|
index: index2 + valueNode.sourceIndex + number.length,
|
|
@@ -27942,9 +26899,7 @@ function rule$5(primary) {
|
|
|
27942
26899
|
}
|
|
27943
26900
|
let parsedValue = valueParser(checkedValue).walk((valueNode) => {
|
|
27944
26901
|
let value = valueNode.value;
|
|
27945
|
-
if (valueNode.type === `function` && value.toLowerCase() === `url`)
|
|
27946
|
-
return false;
|
|
27947
|
-
}
|
|
26902
|
+
if (valueNode.type === `function` && value.toLowerCase() === `url`) return false;
|
|
27948
26903
|
if (value.includes(`*`)) {
|
|
27949
26904
|
value.split(`*`).some((val) => processValue({
|
|
27950
26905
|
...valueNode,
|
|
@@ -27952,9 +26907,7 @@ function rule$5(primary) {
|
|
|
27952
26907
|
value: val
|
|
27953
26908
|
}));
|
|
27954
26909
|
}
|
|
27955
|
-
if (processValue(valueNode))
|
|
27956
|
-
valueNode.value = primary === `lower` ? value.toLowerCase() : value.toUpperCase();
|
|
27957
|
-
}
|
|
26910
|
+
if (processValue(valueNode)) valueNode.value = primary === `lower` ? value.toLowerCase() : value.toUpperCase();
|
|
27958
26911
|
});
|
|
27959
26912
|
if (problems.length) {
|
|
27960
26913
|
for (let err of problems) {
|
|
@@ -27967,20 +26920,15 @@ function rule$5(primary) {
|
|
|
27967
26920
|
result: result2,
|
|
27968
26921
|
ruleName: ruleName$5,
|
|
27969
26922
|
fix() {
|
|
27970
|
-
if (`name` in node2 && node2.name === `media`)
|
|
27971
|
-
|
|
27972
|
-
} else if (`value` in node2) {
|
|
27973
|
-
node2.value = parsedValue.toString();
|
|
27974
|
-
}
|
|
26923
|
+
if (`name` in node2 && node2.name === `media`) node2.params = parsedValue.toString();
|
|
26924
|
+
else if (`value` in node2) node2.value = parsedValue.toString();
|
|
27975
26925
|
}
|
|
27976
26926
|
});
|
|
27977
26927
|
}
|
|
27978
26928
|
}
|
|
27979
26929
|
}
|
|
27980
26930
|
root2.walkAtRules((atRule2) => {
|
|
27981
|
-
if (!/^media$/i.test(atRule2.name) && !(`variable` in atRule2))
|
|
27982
|
-
return;
|
|
27983
|
-
}
|
|
26931
|
+
if (!/^media$/i.test(atRule2.name) && !(`variable` in atRule2)) return;
|
|
27984
26932
|
check(atRule2, atRule2.params, atRuleParamIndex);
|
|
27985
26933
|
});
|
|
27986
26934
|
root2.walkDecls((decl) => check(decl, decl.value, declarationValueIndex));
|
|
@@ -27999,9 +26947,7 @@ const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
27999
26947
|
let { utils: { report: report$1 } } = stylelint;
|
|
28000
26948
|
function valueListCommaWhitespaceChecker(opts) {
|
|
28001
26949
|
opts.root.walkDecls((decl) => {
|
|
28002
|
-
if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop))
|
|
28003
|
-
return;
|
|
28004
|
-
}
|
|
26950
|
+
if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop)) return;
|
|
28005
26951
|
let declString = decl.toString();
|
|
28006
26952
|
styleSearch(
|
|
28007
26953
|
{
|
|
@@ -28011,9 +26957,7 @@ function valueListCommaWhitespaceChecker(opts) {
|
|
|
28011
26957
|
},
|
|
28012
26958
|
(match) => {
|
|
28013
26959
|
let indexToCheckAfter = opts.determineIndex ? opts.determineIndex(declString, match) : match.startIndex;
|
|
28014
|
-
if (indexToCheckAfter === false)
|
|
28015
|
-
return;
|
|
28016
|
-
}
|
|
26960
|
+
if (indexToCheckAfter === false) return;
|
|
28017
26961
|
checkComma(declString, indexToCheckAfter, decl);
|
|
28018
26962
|
}
|
|
28019
26963
|
);
|
|
@@ -28055,9 +26999,7 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28055
26999
|
actual: primary,
|
|
28056
27000
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
28057
27001
|
});
|
|
28058
|
-
if (!validOptions)
|
|
28059
|
-
return;
|
|
28060
|
-
}
|
|
27002
|
+
if (!validOptions) return;
|
|
28061
27003
|
let fixData;
|
|
28062
27004
|
valueListCommaWhitespaceChecker({
|
|
28063
27005
|
root: root2,
|
|
@@ -28066,9 +27008,7 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28066
27008
|
checkedRuleName: ruleName$4,
|
|
28067
27009
|
fix: (declNode, index2) => {
|
|
28068
27010
|
let valueIndex = declarationValueIndex(declNode);
|
|
28069
|
-
if (index2 <= valueIndex)
|
|
28070
|
-
return false;
|
|
28071
|
-
}
|
|
27011
|
+
if (index2 <= valueIndex) return false;
|
|
28072
27012
|
fixData = fixData || /* @__PURE__ */ new Map();
|
|
28073
27013
|
let commaIndices = fixData.get(declNode) || [];
|
|
28074
27014
|
commaIndices.push(index2);
|
|
@@ -28077,9 +27017,7 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28077
27017
|
},
|
|
28078
27018
|
determineIndex: (declString, match) => {
|
|
28079
27019
|
let nextChars = declString.substring(match.endIndex, declString.length);
|
|
28080
|
-
if (/^[ \t]*\/\//.test(nextChars))
|
|
28081
|
-
return false;
|
|
28082
|
-
}
|
|
27020
|
+
if (/^[ \t]*\/\//.test(nextChars)) return false;
|
|
28083
27021
|
return /^[ \t]*\/\*/.test(nextChars) ? declString.indexOf(`*/`, match.endIndex) + 1 : match.startIndex;
|
|
28084
27022
|
}
|
|
28085
27023
|
});
|
|
@@ -28090,11 +27028,8 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28090
27028
|
let valueIndex = index2 - declarationValueIndex(decl);
|
|
28091
27029
|
let beforeValue = value.slice(0, valueIndex + 1);
|
|
28092
27030
|
let afterValue = value.slice(valueIndex + 1);
|
|
28093
|
-
if (primary.startsWith(`always`))
|
|
28094
|
-
|
|
28095
|
-
} else if (primary.startsWith(`never-multi-line`)) {
|
|
28096
|
-
afterValue = afterValue.replace(/^\s*/, ``);
|
|
28097
|
-
}
|
|
27031
|
+
if (primary.startsWith(`always`)) afterValue = context.newline + afterValue;
|
|
27032
|
+
else if (primary.startsWith(`never-multi-line`)) afterValue = afterValue.replace(/^\s*/, ``);
|
|
28098
27033
|
setDeclarationValue(decl, beforeValue + afterValue);
|
|
28099
27034
|
}
|
|
28100
27035
|
}
|
|
@@ -28129,9 +27064,7 @@ function rule$3(primary) {
|
|
|
28129
27064
|
actual: primary,
|
|
28130
27065
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
28131
27066
|
});
|
|
28132
|
-
if (!validOptions)
|
|
28133
|
-
return;
|
|
28134
|
-
}
|
|
27067
|
+
if (!validOptions) return;
|
|
28135
27068
|
valueListCommaWhitespaceChecker({
|
|
28136
27069
|
root: root2,
|
|
28137
27070
|
result: result2,
|
|
@@ -28170,9 +27103,7 @@ function rule$2(primary) {
|
|
|
28170
27103
|
actual: primary,
|
|
28171
27104
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
28172
27105
|
});
|
|
28173
|
-
if (!validOptions)
|
|
28174
|
-
return;
|
|
28175
|
-
}
|
|
27106
|
+
if (!validOptions) return;
|
|
28176
27107
|
let fixData;
|
|
28177
27108
|
valueListCommaWhitespaceChecker({
|
|
28178
27109
|
root: root2,
|
|
@@ -28181,9 +27112,7 @@ function rule$2(primary) {
|
|
|
28181
27112
|
checkedRuleName: ruleName$2,
|
|
28182
27113
|
fix: (declNode, index2) => {
|
|
28183
27114
|
let valueIndex = declarationValueIndex(declNode);
|
|
28184
|
-
if (index2 <= valueIndex)
|
|
28185
|
-
return false;
|
|
28186
|
-
}
|
|
27115
|
+
if (index2 <= valueIndex) return false;
|
|
28187
27116
|
fixData = fixData || /* @__PURE__ */ new Map();
|
|
28188
27117
|
let commaIndices = fixData.get(declNode) || [];
|
|
28189
27118
|
commaIndices.push(index2);
|
|
@@ -28198,11 +27127,8 @@ function rule$2(primary) {
|
|
|
28198
27127
|
let valueIndex = index2 - declarationValueIndex(decl);
|
|
28199
27128
|
let beforeValue = value.slice(0, valueIndex + 1);
|
|
28200
27129
|
let afterValue = value.slice(valueIndex + 1);
|
|
28201
|
-
if (primary.startsWith(`always`))
|
|
28202
|
-
|
|
28203
|
-
} else if (primary.startsWith(`never`)) {
|
|
28204
|
-
afterValue = afterValue.replace(/^\s*/, ``);
|
|
28205
|
-
}
|
|
27130
|
+
if (primary.startsWith(`always`)) afterValue = afterValue.replace(/^\s*/, ` `);
|
|
27131
|
+
else if (primary.startsWith(`never`)) afterValue = afterValue.replace(/^\s*/, ``);
|
|
28206
27132
|
setDeclarationValue(decl, beforeValue + afterValue);
|
|
28207
27133
|
}
|
|
28208
27134
|
}
|
|
@@ -28239,9 +27165,7 @@ function rule$1(primary) {
|
|
|
28239
27165
|
actual: primary,
|
|
28240
27166
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
28241
27167
|
});
|
|
28242
|
-
if (!validOptions)
|
|
28243
|
-
return;
|
|
28244
|
-
}
|
|
27168
|
+
if (!validOptions) return;
|
|
28245
27169
|
let fixData;
|
|
28246
27170
|
valueListCommaWhitespaceChecker({
|
|
28247
27171
|
root: root2,
|
|
@@ -28250,9 +27174,7 @@ function rule$1(primary) {
|
|
|
28250
27174
|
checkedRuleName: ruleName$1,
|
|
28251
27175
|
fix: (declNode, index2) => {
|
|
28252
27176
|
let valueIndex = declarationValueIndex(declNode);
|
|
28253
|
-
if (index2 <= valueIndex)
|
|
28254
|
-
return false;
|
|
28255
|
-
}
|
|
27177
|
+
if (index2 <= valueIndex) return false;
|
|
28256
27178
|
fixData = fixData || /* @__PURE__ */ new Map();
|
|
28257
27179
|
let commaIndices = fixData.get(declNode) || [];
|
|
28258
27180
|
commaIndices.push(index2);
|
|
@@ -28267,11 +27189,8 @@ function rule$1(primary) {
|
|
|
28267
27189
|
let valueIndex = index2 - declarationValueIndex(decl);
|
|
28268
27190
|
let beforeValue = value.slice(0, valueIndex);
|
|
28269
27191
|
let afterValue = value.slice(valueIndex);
|
|
28270
|
-
if (primary.startsWith(`always`))
|
|
28271
|
-
|
|
28272
|
-
} else if (primary.startsWith(`never`)) {
|
|
28273
|
-
beforeValue = beforeValue.replace(/\s*$/, ``);
|
|
28274
|
-
}
|
|
27192
|
+
if (primary.startsWith(`always`)) beforeValue = beforeValue.replace(/\s*$/, ` `);
|
|
27193
|
+
else if (primary.startsWith(`never`)) beforeValue = beforeValue.replace(/\s*$/, ``);
|
|
28275
27194
|
setDeclarationValue(decl, beforeValue + afterValue);
|
|
28276
27195
|
}
|
|
28277
27196
|
}
|
|
@@ -28305,9 +27224,7 @@ function rule(primary) {
|
|
|
28305
27224
|
actual: primary,
|
|
28306
27225
|
possible: isNumber$1
|
|
28307
27226
|
});
|
|
28308
|
-
if (!validOptions)
|
|
28309
|
-
return;
|
|
28310
|
-
}
|
|
27227
|
+
if (!validOptions) return;
|
|
28311
27228
|
let violatedCRLFNewLinesRegex = new RegExp(`(?:\r
|
|
28312
27229
|
){${maxAdjacentNewlines + 1},}`);
|
|
28313
27230
|
let violatedLFNewLinesRegex = new RegExp(`
|