stylelint-config-silverwind 35.0.2 → 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 +661 -1690
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -8898,7 +8898,7 @@ function resolveId(id2, basedir, {
|
|
|
8898
8898
|
});
|
|
8899
8899
|
}
|
|
8900
8900
|
async function getCustomPropertiesFromRoot(root2, resolver) {
|
|
8901
|
-
let customProperties =
|
|
8901
|
+
let customProperties = Object(null);
|
|
8902
8902
|
let sourceDir = process.cwd();
|
|
8903
8903
|
if (root2.source && root2.source.input && root2.source.input.file) {
|
|
8904
8904
|
sourceDir = path$2.dirname(root2.source.input.file);
|
|
@@ -8921,6 +8921,59 @@ async function getCustomPropertiesFromRoot(root2, resolver) {
|
|
|
8921
8921
|
importPromises.push(promise);
|
|
8922
8922
|
}
|
|
8923
8923
|
});
|
|
8924
|
+
root2.walkAtRules("property", (atRule2) => {
|
|
8925
|
+
const nodes = valueParser(atRule2.params).nodes;
|
|
8926
|
+
const names = [];
|
|
8927
|
+
for (let i2 = 0; i2 < nodes.length; i2++) {
|
|
8928
|
+
let node2 = nodes[i2];
|
|
8929
|
+
if (node2.type === "word" && node2.value.startsWith("--")) {
|
|
8930
|
+
names.push(node2.value);
|
|
8931
|
+
while (!(node2.type === "div" && node2.value === ",")) {
|
|
8932
|
+
i2++;
|
|
8933
|
+
node2 = nodes[i2];
|
|
8934
|
+
if (!node2) {
|
|
8935
|
+
break;
|
|
8936
|
+
}
|
|
8937
|
+
}
|
|
8938
|
+
}
|
|
8939
|
+
}
|
|
8940
|
+
const atProperty = {
|
|
8941
|
+
inherits: void 0,
|
|
8942
|
+
syntax: void 0,
|
|
8943
|
+
initialValue: void 0
|
|
8944
|
+
};
|
|
8945
|
+
atRule2.each((descriptor) => {
|
|
8946
|
+
if (descriptor.type !== "decl") {
|
|
8947
|
+
return;
|
|
8948
|
+
}
|
|
8949
|
+
switch (descriptor.prop) {
|
|
8950
|
+
case "initial-value":
|
|
8951
|
+
atProperty.initialValue = descriptor.value;
|
|
8952
|
+
return;
|
|
8953
|
+
case "syntax":
|
|
8954
|
+
atProperty.syntax = descriptor.value.trim();
|
|
8955
|
+
break;
|
|
8956
|
+
case "inherits":
|
|
8957
|
+
atProperty.inherits = descriptor.value.trim();
|
|
8958
|
+
break;
|
|
8959
|
+
}
|
|
8960
|
+
});
|
|
8961
|
+
if (typeof atProperty.inherits === "undefined" || typeof atProperty.syntax === "undefined") {
|
|
8962
|
+
return;
|
|
8963
|
+
}
|
|
8964
|
+
if (atProperty.syntax === "*" || atProperty.syntax === "'*'" || atProperty.syntax === '"*"') {
|
|
8965
|
+
names.forEach((name) => {
|
|
8966
|
+
customProperties[name] = {};
|
|
8967
|
+
});
|
|
8968
|
+
return;
|
|
8969
|
+
}
|
|
8970
|
+
if (typeof atProperty.initialValue === "undefined") {
|
|
8971
|
+
return;
|
|
8972
|
+
}
|
|
8973
|
+
names.forEach((name) => {
|
|
8974
|
+
customProperties[name] = {};
|
|
8975
|
+
});
|
|
8976
|
+
});
|
|
8924
8977
|
(await Promise.all(importPromises)).forEach((propertiesFromImport) => {
|
|
8925
8978
|
customProperties = Object.assign(customProperties, propertiesFromImport);
|
|
8926
8979
|
});
|
|
@@ -8928,7 +8981,7 @@ async function getCustomPropertiesFromRoot(root2, resolver) {
|
|
|
8928
8981
|
if (!decl.variable || !decl.prop.startsWith("--")) {
|
|
8929
8982
|
return;
|
|
8930
8983
|
}
|
|
8931
|
-
customProperties[decl.prop] =
|
|
8984
|
+
customProperties[decl.prop] = {};
|
|
8932
8985
|
});
|
|
8933
8986
|
return customProperties;
|
|
8934
8987
|
}
|
|
@@ -9050,7 +9103,8 @@ const validateValueAST = (ast, { result: result2, customProperties, decl }) => {
|
|
|
9050
9103
|
return;
|
|
9051
9104
|
}
|
|
9052
9105
|
stylelint.utils.report({
|
|
9053
|
-
message: messages$1d.unexpected
|
|
9106
|
+
message: messages$1d.unexpected,
|
|
9107
|
+
messageArgs: [propertyName, decl.prop],
|
|
9054
9108
|
node: decl,
|
|
9055
9109
|
result: result2,
|
|
9056
9110
|
ruleName: ruleName$1d,
|
|
@@ -9060,8 +9114,8 @@ const validateValueAST = (ast, { result: result2, customProperties, decl }) => {
|
|
|
9060
9114
|
});
|
|
9061
9115
|
};
|
|
9062
9116
|
const isVarFunction = (node2) => node2.type === "function" && node2.value === "var" && node2.nodes[0].value.startsWith("--");
|
|
9063
|
-
const validateResult = (result2, customProperties) => {
|
|
9064
|
-
|
|
9117
|
+
const validateResult = (root2, result2, customProperties) => {
|
|
9118
|
+
root2.walkDecls((decl) => {
|
|
9065
9119
|
if (hasCustomPropertyReference(decl)) {
|
|
9066
9120
|
validateDecl(decl, { result: result2, customProperties });
|
|
9067
9121
|
}
|
|
@@ -9088,7 +9142,7 @@ const ruleFunction = (method, opts) => {
|
|
|
9088
9142
|
await customPropertiesPromise,
|
|
9089
9143
|
await getCustomPropertiesFromRoot(root2, resolver)
|
|
9090
9144
|
);
|
|
9091
|
-
validateResult(result2, customProperties);
|
|
9145
|
+
validateResult(root2, result2, customProperties);
|
|
9092
9146
|
}
|
|
9093
9147
|
};
|
|
9094
9148
|
};
|
|
@@ -9098,10 +9152,6 @@ ruleFunction.meta = meta$1d;
|
|
|
9098
9152
|
const valueNoUnknownCustomProperties = stylelint.createPlugin(ruleName$1d, ruleFunction);
|
|
9099
9153
|
const isMethodEnabled = (method) => method === true;
|
|
9100
9154
|
const isMethodDisabled = (method) => method === null || method === false;
|
|
9101
|
-
let namespace$1 = `@stylistic`;
|
|
9102
|
-
function addNamespace(ruleName2) {
|
|
9103
|
-
return `${namespace$1}/${ruleName2}`;
|
|
9104
|
-
}
|
|
9105
9155
|
const rules = {
|
|
9106
9156
|
get "at-rule-name-case"() {
|
|
9107
9157
|
return Promise.resolve().then(() => index$1c).then((m2) => m2.default);
|
|
@@ -9335,6 +9385,10 @@ const rules = {
|
|
|
9335
9385
|
return Promise.resolve().then(() => index).then((m2) => m2.default);
|
|
9336
9386
|
}
|
|
9337
9387
|
};
|
|
9388
|
+
let namespace$1 = `@stylistic`;
|
|
9389
|
+
function addNamespace(ruleName2) {
|
|
9390
|
+
return `${namespace$1}/${ruleName2}`;
|
|
9391
|
+
}
|
|
9338
9392
|
let rulesPlugins = Object.keys(rules).map((name) => stylelint.createPlugin(addNamespace(name), rules[name]));
|
|
9339
9393
|
var lib$6 = {};
|
|
9340
9394
|
var Parser = {};
|
|
@@ -14469,15 +14523,9 @@ function getRuleDocUrl(shortName2) {
|
|
|
14469
14523
|
return `https://github.com/stylelint-stylistic/stylelint-stylistic/blob/main/lib/rules/${shortName2}/README.md`;
|
|
14470
14524
|
}
|
|
14471
14525
|
function isStandardSyntaxAtRule(atRule2) {
|
|
14472
|
-
if (!atRule2.nodes && atRule2.params === ``)
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
if (`mixin` in atRule2 && atRule2.mixin) {
|
|
14476
|
-
return false;
|
|
14477
|
-
}
|
|
14478
|
-
if (`variable` in atRule2 && atRule2.variable || !atRule2.nodes && atRule2.raws.afterName === `` && atRule2.params[0] === `(`) {
|
|
14479
|
-
return false;
|
|
14480
|
-
}
|
|
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;
|
|
14481
14529
|
return true;
|
|
14482
14530
|
}
|
|
14483
14531
|
let { utils: { report: report$X, ruleMessages: ruleMessages$1c, validateOptions: validateOptions$1c } } = stylelint;
|
|
@@ -14496,19 +14544,13 @@ function rule$1c(primary) {
|
|
|
14496
14544
|
actual: primary,
|
|
14497
14545
|
possible: [`lower`, `upper`]
|
|
14498
14546
|
});
|
|
14499
|
-
if (!validOptions)
|
|
14500
|
-
return;
|
|
14501
|
-
}
|
|
14547
|
+
if (!validOptions) return;
|
|
14502
14548
|
let expectation = primary;
|
|
14503
14549
|
root2.walkAtRules((atRule2) => {
|
|
14504
|
-
if (!isStandardSyntaxAtRule(atRule2))
|
|
14505
|
-
return;
|
|
14506
|
-
}
|
|
14550
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14507
14551
|
let name = atRule2.name;
|
|
14508
14552
|
let expectedName = expectation === `lower` ? name.toLowerCase() : name.toUpperCase();
|
|
14509
|
-
if (name === expectedName)
|
|
14510
|
-
return;
|
|
14511
|
-
}
|
|
14553
|
+
if (name === expectedName) return;
|
|
14512
14554
|
report$X({
|
|
14513
14555
|
message: messages$1c.expected,
|
|
14514
14556
|
messageArgs: [name, expectedName],
|
|
@@ -14535,9 +14577,7 @@ const index$1c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
|
14535
14577
|
let { utils: { report: report$W } } = stylelint;
|
|
14536
14578
|
function atRuleNameSpaceChecker(options) {
|
|
14537
14579
|
options.root.walkAtRules((atRule2) => {
|
|
14538
|
-
if (!isStandardSyntaxAtRule(atRule2))
|
|
14539
|
-
return;
|
|
14540
|
-
}
|
|
14580
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14541
14581
|
checkColon(
|
|
14542
14582
|
`@${atRule2.name}${atRule2.raws.afterName || ``}${atRule2.params}`,
|
|
14543
14583
|
atRule2.name.length,
|
|
@@ -14601,11 +14641,8 @@ function isString(value) {
|
|
|
14601
14641
|
return typeof value === `string` || value instanceof String;
|
|
14602
14642
|
}
|
|
14603
14643
|
function assert(value, message = void 0) {
|
|
14604
|
-
if (message)
|
|
14605
|
-
|
|
14606
|
-
} else {
|
|
14607
|
-
console.assert(value);
|
|
14608
|
-
}
|
|
14644
|
+
if (message) console.assert(value, message);
|
|
14645
|
+
else console.assert(value);
|
|
14609
14646
|
}
|
|
14610
14647
|
function assertFunction(value) {
|
|
14611
14648
|
console.assert(isFunction(value), `"${value}" must be a function`);
|
|
@@ -14640,27 +14677,19 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14640
14677
|
rejectBefore();
|
|
14641
14678
|
break;
|
|
14642
14679
|
case `always-single-line`:
|
|
14643
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14644
|
-
return;
|
|
14645
|
-
}
|
|
14680
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14646
14681
|
expectBefore(messages2.expectedBeforeSingleLine);
|
|
14647
14682
|
break;
|
|
14648
14683
|
case `never-single-line`:
|
|
14649
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14650
|
-
return;
|
|
14651
|
-
}
|
|
14684
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14652
14685
|
rejectBefore(messages2.rejectedBeforeSingleLine);
|
|
14653
14686
|
break;
|
|
14654
14687
|
case `always-multi-line`:
|
|
14655
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14656
|
-
return;
|
|
14657
|
-
}
|
|
14688
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14658
14689
|
expectBefore(messages2.expectedBeforeMultiLine);
|
|
14659
14690
|
break;
|
|
14660
14691
|
case `never-multi-line`:
|
|
14661
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14662
|
-
return;
|
|
14663
|
-
}
|
|
14692
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14664
14693
|
rejectBefore(messages2.rejectedBeforeMultiLine);
|
|
14665
14694
|
break;
|
|
14666
14695
|
default:
|
|
@@ -14677,27 +14706,19 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14677
14706
|
rejectAfter();
|
|
14678
14707
|
break;
|
|
14679
14708
|
case `always-single-line`:
|
|
14680
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14681
|
-
return;
|
|
14682
|
-
}
|
|
14709
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14683
14710
|
expectAfter(messages2.expectedAfterSingleLine);
|
|
14684
14711
|
break;
|
|
14685
14712
|
case `never-single-line`:
|
|
14686
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14687
|
-
return;
|
|
14688
|
-
}
|
|
14713
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14689
14714
|
rejectAfter(messages2.rejectedAfterSingleLine);
|
|
14690
14715
|
break;
|
|
14691
14716
|
case `always-multi-line`:
|
|
14692
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14693
|
-
return;
|
|
14694
|
-
}
|
|
14717
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14695
14718
|
expectAfter(messages2.expectedAfterMultiLine);
|
|
14696
14719
|
break;
|
|
14697
14720
|
case `never-multi-line`:
|
|
14698
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14699
|
-
return;
|
|
14700
|
-
}
|
|
14721
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14701
14722
|
rejectAfter(messages2.rejectedAfterMultiLine);
|
|
14702
14723
|
break;
|
|
14703
14724
|
default:
|
|
@@ -14717,12 +14738,8 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14717
14738
|
let index2 = _activeArgs.index;
|
|
14718
14739
|
let oneCharBefore = source[index2 - 1];
|
|
14719
14740
|
let twoCharsBefore = source[index2 - 2];
|
|
14720
|
-
if (isNullish(oneCharBefore))
|
|
14721
|
-
|
|
14722
|
-
}
|
|
14723
|
-
if (targetWhitespace === `space` && oneCharBefore === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsBefore) || !isWhitespace$1(twoCharsBefore))) {
|
|
14724
|
-
return;
|
|
14725
|
-
}
|
|
14741
|
+
if (isNullish(oneCharBefore)) return;
|
|
14742
|
+
if (targetWhitespace === `space` && oneCharBefore === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsBefore) || !isWhitespace$1(twoCharsBefore))) return;
|
|
14726
14743
|
assertFunction(messageFunc);
|
|
14727
14744
|
activeArgs.err(messageFunc(activeArgs.errTarget || source.charAt(index2)));
|
|
14728
14745
|
}
|
|
@@ -14764,22 +14781,14 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14764
14781
|
let oneCharAfter = source[index2 + 1];
|
|
14765
14782
|
let twoCharsAfter = source[index2 + 2];
|
|
14766
14783
|
let threeCharsAfter = source[index2 + 3];
|
|
14767
|
-
if (isNullish(oneCharAfter))
|
|
14768
|
-
return;
|
|
14769
|
-
}
|
|
14784
|
+
if (isNullish(oneCharAfter)) return;
|
|
14770
14785
|
if (targetWhitespace === `newline`) {
|
|
14771
14786
|
if (oneCharAfter === `\r` && twoCharsAfter === `
|
|
14772
|
-
` && (activeArgs.onlyOneChar || isNullish(threeCharsAfter) || !isWhitespace$1(threeCharsAfter)))
|
|
14773
|
-
return;
|
|
14774
|
-
}
|
|
14787
|
+
` && (activeArgs.onlyOneChar || isNullish(threeCharsAfter) || !isWhitespace$1(threeCharsAfter))) return;
|
|
14775
14788
|
if (oneCharAfter === `
|
|
14776
|
-
` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter)))
|
|
14777
|
-
return;
|
|
14778
|
-
}
|
|
14779
|
-
}
|
|
14780
|
-
if (targetWhitespace === `space` && oneCharAfter === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter))) {
|
|
14781
|
-
return;
|
|
14789
|
+
` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter))) return;
|
|
14782
14790
|
}
|
|
14791
|
+
if (targetWhitespace === `space` && oneCharAfter === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter))) return;
|
|
14783
14792
|
assertFunction(messageFunc);
|
|
14784
14793
|
activeArgs.err(messageFunc(activeArgs.errTarget || source.charAt(index2)));
|
|
14785
14794
|
}
|
|
@@ -14816,9 +14825,7 @@ function rule$1b(primary) {
|
|
|
14816
14825
|
actual: primary,
|
|
14817
14826
|
possible: [`always`, `always-multi-line`]
|
|
14818
14827
|
});
|
|
14819
|
-
if (!validOptions)
|
|
14820
|
-
return;
|
|
14821
|
-
}
|
|
14828
|
+
if (!validOptions) return;
|
|
14822
14829
|
atRuleNameSpaceChecker({
|
|
14823
14830
|
root: root2,
|
|
14824
14831
|
result: result2,
|
|
@@ -14854,18 +14861,14 @@ function rule$1a(primary) {
|
|
|
14854
14861
|
actual: primary,
|
|
14855
14862
|
possible: [`always`, `always-single-line`]
|
|
14856
14863
|
});
|
|
14857
|
-
if (!validOptions)
|
|
14858
|
-
return;
|
|
14859
|
-
}
|
|
14864
|
+
if (!validOptions) return;
|
|
14860
14865
|
atRuleNameSpaceChecker({
|
|
14861
14866
|
root: root2,
|
|
14862
14867
|
result: result2,
|
|
14863
14868
|
locationChecker: checker.after,
|
|
14864
14869
|
checkedRuleName: ruleName$1a,
|
|
14865
14870
|
fix: (atRule2) => {
|
|
14866
|
-
if (typeof atRule2.raws.afterName === `string`)
|
|
14867
|
-
atRule2.raws.afterName = atRule2.raws.afterName.replace(/^\s*/, ` `);
|
|
14868
|
-
}
|
|
14871
|
+
if (typeof atRule2.raws.afterName === `string`) atRule2.raws.afterName = atRule2.raws.afterName.replace(/^\s*/, ` `);
|
|
14869
14872
|
}
|
|
14870
14873
|
});
|
|
14871
14874
|
};
|
|
@@ -14884,19 +14887,13 @@ function hasBlock(statement) {
|
|
|
14884
14887
|
return statement.nodes !== void 0;
|
|
14885
14888
|
}
|
|
14886
14889
|
function nextNonCommentNode(startNode) {
|
|
14887
|
-
if (!startNode || !startNode.next)
|
|
14888
|
-
|
|
14889
|
-
}
|
|
14890
|
-
if (startNode.type === `comment`) {
|
|
14891
|
-
return nextNonCommentNode(startNode.next());
|
|
14892
|
-
}
|
|
14890
|
+
if (!startNode || !startNode.next) return null;
|
|
14891
|
+
if (startNode.type === `comment`) return nextNonCommentNode(startNode.next());
|
|
14893
14892
|
return startNode;
|
|
14894
14893
|
}
|
|
14895
14894
|
function rawNodeString(node2) {
|
|
14896
14895
|
let result2 = ``;
|
|
14897
|
-
if (node2.raws.before)
|
|
14898
|
-
result2 += node2.raws.before;
|
|
14899
|
-
}
|
|
14896
|
+
if (node2.raws.before) result2 += node2.raws.before;
|
|
14900
14897
|
result2 += node2.toString();
|
|
14901
14898
|
return result2;
|
|
14902
14899
|
}
|
|
@@ -14917,24 +14914,14 @@ function rule$19(primary, _secondary, context) {
|
|
|
14917
14914
|
actual: primary,
|
|
14918
14915
|
possible: [`always`]
|
|
14919
14916
|
});
|
|
14920
|
-
if (!validOptions)
|
|
14921
|
-
return;
|
|
14922
|
-
}
|
|
14917
|
+
if (!validOptions) return;
|
|
14923
14918
|
root2.walkAtRules((atRule2) => {
|
|
14924
14919
|
let nextNode = atRule2.next();
|
|
14925
|
-
if (!nextNode)
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
if (hasBlock(atRule2)) {
|
|
14929
|
-
return;
|
|
14930
|
-
}
|
|
14931
|
-
if (!isStandardSyntaxAtRule(atRule2)) {
|
|
14932
|
-
return;
|
|
14933
|
-
}
|
|
14920
|
+
if (!nextNode) return;
|
|
14921
|
+
if (hasBlock(atRule2)) return;
|
|
14922
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14934
14923
|
let nodeToCheck = nextNonCommentNode(nextNode);
|
|
14935
|
-
if (!nodeToCheck)
|
|
14936
|
-
return;
|
|
14937
|
-
}
|
|
14924
|
+
if (!nodeToCheck) return;
|
|
14938
14925
|
const problemIndex = atRule2.toString().length + 1;
|
|
14939
14926
|
checker.afterOneOnly({
|
|
14940
14927
|
source: rawNodeString(nodeToCheck),
|
|
@@ -14983,16 +14970,10 @@ function rule$18(primary) {
|
|
|
14983
14970
|
actual: primary,
|
|
14984
14971
|
possible: [`always`, `never`]
|
|
14985
14972
|
});
|
|
14986
|
-
if (!validOptions)
|
|
14987
|
-
return;
|
|
14988
|
-
}
|
|
14973
|
+
if (!validOptions) return;
|
|
14989
14974
|
root2.walkAtRules((atRule2) => {
|
|
14990
|
-
if (hasBlock(atRule2))
|
|
14991
|
-
|
|
14992
|
-
}
|
|
14993
|
-
if (!isStandardSyntaxAtRule(atRule2)) {
|
|
14994
|
-
return;
|
|
14995
|
-
}
|
|
14975
|
+
if (hasBlock(atRule2)) return;
|
|
14976
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14996
14977
|
const nodeString = rawNodeString(atRule2);
|
|
14997
14978
|
const problemIndex = nodeString.length - 1;
|
|
14998
14979
|
checker.before({
|
|
@@ -15024,16 +15005,11 @@ const index$18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
|
15024
15005
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
15025
15006
|
function addEmptyLineAfter(node2, newline) {
|
|
15026
15007
|
let { raws } = node2;
|
|
15027
|
-
if (typeof raws.after !== `string`)
|
|
15028
|
-
return node2;
|
|
15029
|
-
}
|
|
15008
|
+
if (typeof raws.after !== `string`) return node2;
|
|
15030
15009
|
let spaces = raws.after.split(`;`);
|
|
15031
15010
|
let after = spaces[spaces.length - 1] || ``;
|
|
15032
|
-
if (!/\r?\n/.test(after))
|
|
15033
|
-
|
|
15034
|
-
} else {
|
|
15035
|
-
raws.after = raws.after.replace(/(\r?\n)/, `${newline}$1`);
|
|
15036
|
-
}
|
|
15011
|
+
if (!/\r?\n/.test(after)) raws.after += newline.repeat(2);
|
|
15012
|
+
else raws.after = raws.after.replace(/(\r?\n)/, `${newline}$1`);
|
|
15037
15013
|
return node2;
|
|
15038
15014
|
}
|
|
15039
15015
|
function isRoot(node2) {
|
|
@@ -15054,23 +15030,15 @@ function isDeclaration(node2) {
|
|
|
15054
15030
|
function beforeBlockString(statement, { noRawBefore } = { noRawBefore: false }) {
|
|
15055
15031
|
let result2 = ``;
|
|
15056
15032
|
let before = statement.raws.before || ``;
|
|
15057
|
-
if (!noRawBefore)
|
|
15058
|
-
|
|
15059
|
-
}
|
|
15060
|
-
|
|
15061
|
-
result2 += statement.selector;
|
|
15062
|
-
} else if (isAtRule(statement)) {
|
|
15063
|
-
result2 += `@${statement.name}${statement.raws.afterName || ``}${statement.params}`;
|
|
15064
|
-
} else {
|
|
15065
|
-
return ``;
|
|
15066
|
-
}
|
|
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 ``;
|
|
15067
15037
|
result2 += statement.raws.between || ``;
|
|
15068
15038
|
return result2;
|
|
15069
15039
|
}
|
|
15070
15040
|
function blockString(statement) {
|
|
15071
|
-
if (!hasBlock(statement))
|
|
15072
|
-
return ``;
|
|
15073
|
-
}
|
|
15041
|
+
if (!hasBlock(statement)) return ``;
|
|
15074
15042
|
return rawNodeString(statement).slice(beforeBlockString(statement).length);
|
|
15075
15043
|
}
|
|
15076
15044
|
function hasEmptyBlock(statement) {
|
|
@@ -15078,32 +15046,22 @@ function hasEmptyBlock(statement) {
|
|
|
15078
15046
|
}
|
|
15079
15047
|
const HAS_EMPTY_LINE = /\n[\r\t ]*\n/;
|
|
15080
15048
|
function hasEmptyLine(string2) {
|
|
15081
|
-
if (string2 === `` || string2 === void 0)
|
|
15082
|
-
return false;
|
|
15083
|
-
}
|
|
15049
|
+
if (string2 === `` || string2 === void 0) return false;
|
|
15084
15050
|
return HAS_EMPTY_LINE.test(string2);
|
|
15085
15051
|
}
|
|
15086
15052
|
function matchesStringOrRegExp(input2, comparison) {
|
|
15087
|
-
if (!Array.isArray(input2))
|
|
15088
|
-
return testAgainstStringOrRegExpOrArray(input2, comparison);
|
|
15089
|
-
}
|
|
15053
|
+
if (!Array.isArray(input2)) return testAgainstStringOrRegExpOrArray(input2, comparison);
|
|
15090
15054
|
for (let inputItem of input2) {
|
|
15091
15055
|
let testResult = testAgainstStringOrRegExpOrArray(inputItem, comparison);
|
|
15092
|
-
if (testResult)
|
|
15093
|
-
return testResult;
|
|
15094
|
-
}
|
|
15056
|
+
if (testResult) return testResult;
|
|
15095
15057
|
}
|
|
15096
15058
|
return false;
|
|
15097
15059
|
}
|
|
15098
15060
|
function testAgainstStringOrRegExpOrArray(value, comparison) {
|
|
15099
|
-
if (!Array.isArray(comparison))
|
|
15100
|
-
return testAgainstStringOrRegExp(value, comparison);
|
|
15101
|
-
}
|
|
15061
|
+
if (!Array.isArray(comparison)) return testAgainstStringOrRegExp(value, comparison);
|
|
15102
15062
|
for (let comparisonItem of comparison) {
|
|
15103
15063
|
let testResult = testAgainstStringOrRegExp(value, comparisonItem);
|
|
15104
|
-
if (testResult)
|
|
15105
|
-
return testResult;
|
|
15106
|
-
}
|
|
15064
|
+
if (testResult) return testResult;
|
|
15107
15065
|
}
|
|
15108
15066
|
return false;
|
|
15109
15067
|
}
|
|
@@ -15158,32 +15116,22 @@ function rule$17(primary, secondaryOptions, context) {
|
|
|
15158
15116
|
optional: true
|
|
15159
15117
|
}
|
|
15160
15118
|
);
|
|
15161
|
-
if (!validOptions)
|
|
15162
|
-
return;
|
|
15163
|
-
}
|
|
15119
|
+
if (!validOptions) return;
|
|
15164
15120
|
root2.walkRules(check);
|
|
15165
15121
|
root2.walkAtRules(check);
|
|
15166
15122
|
function check(statement) {
|
|
15167
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15168
|
-
return;
|
|
15169
|
-
}
|
|
15123
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15170
15124
|
let before = (statement.raws.after || ``).replace(/;+/, ``);
|
|
15171
15125
|
let statementString = statement.toString();
|
|
15172
15126
|
let index2 = statementString.length - 1;
|
|
15173
|
-
if (statementString[index2 - 1] === `\r`)
|
|
15174
|
-
index2 -= 1;
|
|
15175
|
-
}
|
|
15127
|
+
if (statementString[index2 - 1] === `\r`) index2 -= 1;
|
|
15176
15128
|
let expectEmptyLineBefore = (() => {
|
|
15177
15129
|
let childNodeTypes = statement.nodes.map((item) => item.type);
|
|
15178
|
-
if (optionsMatches(secondaryOptions, `except`, `after-closing-brace`) && !childNodeTypes.includes(`decl`))
|
|
15179
|
-
return primary === `never`;
|
|
15180
|
-
}
|
|
15130
|
+
if (optionsMatches(secondaryOptions, `except`, `after-closing-brace`) && !childNodeTypes.includes(`decl`)) return primary === `never`;
|
|
15181
15131
|
return primary === `always-multi-line` && !isSingleLineString(blockString(statement));
|
|
15182
15132
|
})();
|
|
15183
15133
|
let hasEmptyLineBefore = hasEmptyLine(before);
|
|
15184
|
-
if (expectEmptyLineBefore === hasEmptyLineBefore)
|
|
15185
|
-
return;
|
|
15186
|
-
}
|
|
15134
|
+
if (expectEmptyLineBefore === hasEmptyLineBefore) return;
|
|
15187
15135
|
let message = expectEmptyLineBefore ? messages$17.expected : messages$17.rejected;
|
|
15188
15136
|
report$T({
|
|
15189
15137
|
message,
|
|
@@ -15195,11 +15143,8 @@ function rule$17(primary, secondaryOptions, context) {
|
|
|
15195
15143
|
fix() {
|
|
15196
15144
|
let { newline } = context;
|
|
15197
15145
|
if (typeof newline !== `string`) return;
|
|
15198
|
-
if (expectEmptyLineBefore)
|
|
15199
|
-
|
|
15200
|
-
} else {
|
|
15201
|
-
removeEmptyLinesAfter(statement, newline);
|
|
15202
|
-
}
|
|
15146
|
+
if (expectEmptyLineBefore) addEmptyLineAfter(statement, newline);
|
|
15147
|
+
else removeEmptyLinesAfter(statement, newline);
|
|
15203
15148
|
}
|
|
15204
15149
|
});
|
|
15205
15150
|
}
|
|
@@ -15253,28 +15198,18 @@ function rule$16(primary, secondaryOptions, context) {
|
|
|
15253
15198
|
optional: true
|
|
15254
15199
|
}
|
|
15255
15200
|
);
|
|
15256
|
-
if (!validOptions)
|
|
15257
|
-
return;
|
|
15258
|
-
}
|
|
15201
|
+
if (!validOptions) return;
|
|
15259
15202
|
root2.walkRules(check);
|
|
15260
15203
|
root2.walkAtRules(check);
|
|
15261
15204
|
function check(statement) {
|
|
15262
|
-
if (!hasBlock(statement))
|
|
15263
|
-
|
|
15264
|
-
}
|
|
15265
|
-
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) {
|
|
15266
|
-
return;
|
|
15267
|
-
}
|
|
15205
|
+
if (!hasBlock(statement)) return;
|
|
15206
|
+
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) return;
|
|
15268
15207
|
let nextNode = statement.next();
|
|
15269
|
-
if (!nextNode)
|
|
15270
|
-
return;
|
|
15271
|
-
}
|
|
15208
|
+
if (!nextNode) return;
|
|
15272
15209
|
let nextNodeIsSingleLineComment = nextNode.type === `comment` && !/[^ ]/.test(nextNode.raws.before || ``) && !nextNode.toString().includes(`
|
|
15273
15210
|
`);
|
|
15274
15211
|
let nodeToCheck = nextNodeIsSingleLineComment ? nextNode.next() : nextNode;
|
|
15275
|
-
if (!nodeToCheck)
|
|
15276
|
-
return;
|
|
15277
|
-
}
|
|
15212
|
+
if (!nodeToCheck) return;
|
|
15278
15213
|
let reportIndex = statement.toString().length;
|
|
15279
15214
|
let source = rawNodeString(nodeToCheck);
|
|
15280
15215
|
if (source && source.startsWith(`;`)) {
|
|
@@ -15299,9 +15234,7 @@ function rule$16(primary, secondaryOptions, context) {
|
|
|
15299
15234
|
if (primary.startsWith(`always`)) {
|
|
15300
15235
|
let index2 = nodeToCheckRaws.before.search(/\r?\n/);
|
|
15301
15236
|
nodeToCheckRaws.before = index2 >= 0 ? nodeToCheckRaws.before.slice(index2) : context.newline + nodeToCheckRaws.before;
|
|
15302
|
-
} else if (primary.startsWith(`never`))
|
|
15303
|
-
nodeToCheckRaws.before = ``;
|
|
15304
|
-
}
|
|
15237
|
+
} else if (primary.startsWith(`never`)) nodeToCheckRaws.before = ``;
|
|
15305
15238
|
}
|
|
15306
15239
|
});
|
|
15307
15240
|
}
|
|
@@ -15337,37 +15270,24 @@ function rule$15(primary, _secondaryOptions, context) {
|
|
|
15337
15270
|
actual: primary,
|
|
15338
15271
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
15339
15272
|
});
|
|
15340
|
-
if (!validOptions)
|
|
15341
|
-
return;
|
|
15342
|
-
}
|
|
15273
|
+
if (!validOptions) return;
|
|
15343
15274
|
root2.walkRules(check);
|
|
15344
15275
|
root2.walkAtRules(check);
|
|
15345
15276
|
function check(statement) {
|
|
15346
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15347
|
-
return;
|
|
15348
|
-
}
|
|
15277
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15349
15278
|
let after = (statement.raws.after || ``).replace(/;+/, ``);
|
|
15350
|
-
if (after === void 0)
|
|
15351
|
-
return;
|
|
15352
|
-
}
|
|
15279
|
+
if (after === void 0) return;
|
|
15353
15280
|
let blockIsMultiLine = !isSingleLineString(blockString(statement));
|
|
15354
15281
|
let statementString = statement.toString();
|
|
15355
15282
|
let index2 = statementString.length - 2;
|
|
15356
|
-
if (statementString[index2 - 1] === `\r`)
|
|
15357
|
-
index2 -= 1;
|
|
15358
|
-
}
|
|
15283
|
+
if (statementString[index2 - 1] === `\r`) index2 -= 1;
|
|
15359
15284
|
if (!after.startsWith(`
|
|
15360
15285
|
`) && !after.startsWith(`\r
|
|
15361
15286
|
`)) {
|
|
15362
|
-
if (primary === `always`)
|
|
15363
|
-
|
|
15364
|
-
} else if (blockIsMultiLine && primary === `always-multi-line`) {
|
|
15365
|
-
complain(messages$15.expectedBeforeMultiLine);
|
|
15366
|
-
}
|
|
15367
|
-
}
|
|
15368
|
-
if (after !== `` && blockIsMultiLine && primary === `never-multi-line`) {
|
|
15369
|
-
complain(messages$15.rejectedBeforeMultiLine);
|
|
15287
|
+
if (primary === `always`) complain(messages$15.expectedBefore);
|
|
15288
|
+
else if (blockIsMultiLine && primary === `always-multi-line`) complain(messages$15.expectedBeforeMultiLine);
|
|
15370
15289
|
}
|
|
15290
|
+
if (after !== `` && blockIsMultiLine && primary === `never-multi-line`) complain(messages$15.rejectedBeforeMultiLine);
|
|
15371
15291
|
function complain(message) {
|
|
15372
15292
|
report$R({
|
|
15373
15293
|
message,
|
|
@@ -15385,9 +15305,7 @@ function rule$15(primary, _secondaryOptions, context) {
|
|
|
15385
15305
|
let newlineAfter = firstWhitespaceIndex >= 0 ? statementRaws.after.slice(firstWhitespaceIndex) : ``;
|
|
15386
15306
|
let newlineIndex = newlineAfter.search(/\r?\n/);
|
|
15387
15307
|
statementRaws.after = newlineIndex >= 0 ? newlineBefore + newlineAfter.slice(newlineIndex) : newlineBefore + context.newline + newlineAfter;
|
|
15388
|
-
} else if (primary === `never-multi-line`)
|
|
15389
|
-
statementRaws.after = statementRaws.after.replace(/\s/g, ``);
|
|
15390
|
-
}
|
|
15308
|
+
} else if (primary === `never-multi-line`) statementRaws.after = statementRaws.after.replace(/\s/g, ``);
|
|
15391
15309
|
}
|
|
15392
15310
|
});
|
|
15393
15311
|
}
|
|
@@ -15432,19 +15350,13 @@ function rule$14(primary) {
|
|
|
15432
15350
|
`never-multi-line`
|
|
15433
15351
|
]
|
|
15434
15352
|
});
|
|
15435
|
-
if (!validOptions)
|
|
15436
|
-
return;
|
|
15437
|
-
}
|
|
15353
|
+
if (!validOptions) return;
|
|
15438
15354
|
root2.walkRules(check);
|
|
15439
15355
|
root2.walkAtRules(check);
|
|
15440
15356
|
function check(statement) {
|
|
15441
15357
|
let nextNode = statement.next();
|
|
15442
|
-
if (!nextNode)
|
|
15443
|
-
|
|
15444
|
-
}
|
|
15445
|
-
if (!hasBlock(statement)) {
|
|
15446
|
-
return;
|
|
15447
|
-
}
|
|
15358
|
+
if (!nextNode) return;
|
|
15359
|
+
if (!hasBlock(statement)) return;
|
|
15448
15360
|
let reportIndex = statement.toString().length;
|
|
15449
15361
|
let source = rawNodeString(nextNode);
|
|
15450
15362
|
if (source && source.startsWith(`;`)) {
|
|
@@ -15508,21 +15420,15 @@ function rule$13(primary) {
|
|
|
15508
15420
|
`never-multi-line`
|
|
15509
15421
|
]
|
|
15510
15422
|
});
|
|
15511
|
-
if (!validOptions)
|
|
15512
|
-
return;
|
|
15513
|
-
}
|
|
15423
|
+
if (!validOptions) return;
|
|
15514
15424
|
root2.walkRules(check);
|
|
15515
15425
|
root2.walkAtRules(check);
|
|
15516
15426
|
function check(statement) {
|
|
15517
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15518
|
-
return;
|
|
15519
|
-
}
|
|
15427
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15520
15428
|
let source = blockString(statement);
|
|
15521
15429
|
let statementString = statement.toString();
|
|
15522
15430
|
let index2 = statementString.length - 2;
|
|
15523
|
-
if (statementString[index2 - 1] === `\r`)
|
|
15524
|
-
index2 -= 1;
|
|
15525
|
-
}
|
|
15431
|
+
if (statementString[index2 - 1] === `\r`) index2 -= 1;
|
|
15526
15432
|
checker.before({
|
|
15527
15433
|
source,
|
|
15528
15434
|
index: source.length - 1,
|
|
@@ -15537,11 +15443,8 @@ function rule$13(primary) {
|
|
|
15537
15443
|
fix() {
|
|
15538
15444
|
let statementRaws = statement.raws;
|
|
15539
15445
|
if (typeof statementRaws.after !== `string`) return;
|
|
15540
|
-
if (primary.startsWith(`always`))
|
|
15541
|
-
|
|
15542
|
-
} else if (primary.startsWith(`never`)) {
|
|
15543
|
-
statementRaws.after = statementRaws.after.replace(/\s*$/, ``);
|
|
15544
|
-
}
|
|
15446
|
+
if (primary.startsWith(`always`)) statementRaws.after = statementRaws.after.replace(/\s*$/, ` `);
|
|
15447
|
+
else if (primary.startsWith(`never`)) statementRaws.after = statementRaws.after.replace(/\s*$/, ``);
|
|
15545
15448
|
}
|
|
15546
15449
|
});
|
|
15547
15450
|
}
|
|
@@ -15589,22 +15492,14 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15589
15492
|
optional: true
|
|
15590
15493
|
}
|
|
15591
15494
|
);
|
|
15592
|
-
if (!validOptions)
|
|
15593
|
-
|
|
15594
|
-
}
|
|
15595
|
-
if (!optionsMatches(secondaryOptions, `ignore`, `rules`)) {
|
|
15596
|
-
root2.walkRules(check);
|
|
15597
|
-
}
|
|
15495
|
+
if (!validOptions) return;
|
|
15496
|
+
if (!optionsMatches(secondaryOptions, `ignore`, `rules`)) root2.walkRules(check);
|
|
15598
15497
|
root2.walkAtRules(check);
|
|
15599
15498
|
function check(statement) {
|
|
15600
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15601
|
-
return;
|
|
15602
|
-
}
|
|
15499
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15603
15500
|
let backupCommentNextBefores = /* @__PURE__ */ new Map();
|
|
15604
15501
|
function nextNode(startNode) {
|
|
15605
|
-
if (!startNode || !startNode.next)
|
|
15606
|
-
return;
|
|
15607
|
-
}
|
|
15502
|
+
if (!startNode || !startNode.next) return;
|
|
15608
15503
|
if (startNode.type === `comment`) {
|
|
15609
15504
|
let reNewLine = /\r?\n/;
|
|
15610
15505
|
let newLineMatch = reNewLine.test(startNode.raws.before || ``);
|
|
@@ -15618,9 +15513,7 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15618
15513
|
return startNode;
|
|
15619
15514
|
}
|
|
15620
15515
|
let nodeToCheck = nextNode(statement.first);
|
|
15621
|
-
if (!nodeToCheck)
|
|
15622
|
-
return;
|
|
15623
|
-
}
|
|
15516
|
+
if (!nodeToCheck) return;
|
|
15624
15517
|
const problemIndex = beforeBlockString(statement, { noRawBefore: true }).length + 1;
|
|
15625
15518
|
checker.afterOneOnly({
|
|
15626
15519
|
source: rawNodeString(nodeToCheck),
|
|
@@ -15636,9 +15529,7 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15636
15529
|
ruleName: ruleName$12,
|
|
15637
15530
|
fix() {
|
|
15638
15531
|
let nodeToCheckRaws = nodeToCheck.raws;
|
|
15639
|
-
if (typeof nodeToCheckRaws.before !== `string`)
|
|
15640
|
-
return;
|
|
15641
|
-
}
|
|
15532
|
+
if (typeof nodeToCheckRaws.before !== `string`) return;
|
|
15642
15533
|
if (primary.startsWith(`always`)) {
|
|
15643
15534
|
let index2 = nodeToCheckRaws.before.search(/\r?\n/);
|
|
15644
15535
|
nodeToCheckRaws.before = index2 >= 0 ? nodeToCheckRaws.before.slice(index2) : context.newline + nodeToCheckRaws.before;
|
|
@@ -15646,23 +15537,15 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15646
15537
|
return;
|
|
15647
15538
|
}
|
|
15648
15539
|
if (primary === `never-multi-line`) {
|
|
15649
|
-
for (let [node2, before] of backupCommentNextBefores.entries())
|
|
15650
|
-
node2.raws.before = before;
|
|
15651
|
-
}
|
|
15540
|
+
for (let [node2, before] of backupCommentNextBefores.entries()) node2.raws.before = before;
|
|
15652
15541
|
backupCommentNextBefores.clear();
|
|
15653
15542
|
let reNewLine = /\r?\n/;
|
|
15654
15543
|
let fixTarget = statement.first;
|
|
15655
15544
|
while (fixTarget) {
|
|
15656
15545
|
let fixTargetRaws = fixTarget.raws;
|
|
15657
|
-
if (typeof fixTargetRaws.before !== `string`)
|
|
15658
|
-
|
|
15659
|
-
|
|
15660
|
-
if (reNewLine.test(fixTargetRaws.before || ``)) {
|
|
15661
|
-
fixTargetRaws.before = fixTargetRaws.before.replace(/\r?\n/g, ``);
|
|
15662
|
-
}
|
|
15663
|
-
if (fixTarget.type !== `comment`) {
|
|
15664
|
-
break;
|
|
15665
|
-
}
|
|
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;
|
|
15666
15549
|
fixTarget = fixTarget.next();
|
|
15667
15550
|
}
|
|
15668
15551
|
nodeToCheckRaws.before = ``;
|
|
@@ -15671,9 +15554,7 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15671
15554
|
});
|
|
15672
15555
|
}
|
|
15673
15556
|
});
|
|
15674
|
-
for (let [node2, before] of backupCommentNextBefores.entries())
|
|
15675
|
-
node2.raws.before = before;
|
|
15676
|
-
}
|
|
15557
|
+
for (let [node2, before] of backupCommentNextBefores.entries()) node2.raws.before = before;
|
|
15677
15558
|
}
|
|
15678
15559
|
};
|
|
15679
15560
|
}
|
|
@@ -15714,23 +15595,17 @@ function rule$11(primary, _secondaryOptions, context) {
|
|
|
15714
15595
|
`never-multi-line`
|
|
15715
15596
|
]
|
|
15716
15597
|
});
|
|
15717
|
-
if (!validOptions)
|
|
15718
|
-
return;
|
|
15719
|
-
}
|
|
15598
|
+
if (!validOptions) return;
|
|
15720
15599
|
root2.walkRules(check);
|
|
15721
15600
|
root2.walkAtRules(check);
|
|
15722
15601
|
function check(statement) {
|
|
15723
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15724
|
-
return;
|
|
15725
|
-
}
|
|
15602
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15726
15603
|
let source = beforeBlockString(statement);
|
|
15727
15604
|
let beforeBraceNoRaw = beforeBlockString(statement, {
|
|
15728
15605
|
noRawBefore: true
|
|
15729
15606
|
});
|
|
15730
15607
|
let index2 = beforeBraceNoRaw.length - 1;
|
|
15731
|
-
if (beforeBraceNoRaw[index2 - 1] === `\r`)
|
|
15732
|
-
index2 -= 1;
|
|
15733
|
-
}
|
|
15608
|
+
if (beforeBraceNoRaw[index2 - 1] === `\r`) index2 -= 1;
|
|
15734
15609
|
checker.beforeAllowingIndentation({
|
|
15735
15610
|
lineCheckStr: blockString(statement),
|
|
15736
15611
|
source,
|
|
@@ -15747,14 +15622,9 @@ function rule$11(primary, _secondaryOptions, context) {
|
|
|
15747
15622
|
if (typeof statement.raws.between !== `string`) return;
|
|
15748
15623
|
if (primary.startsWith(`always`)) {
|
|
15749
15624
|
let spaceIndex = statement.raws.between.search(/\s+$/);
|
|
15750
|
-
if (spaceIndex >= 0)
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
statement.raws.between += context.newline;
|
|
15754
|
-
}
|
|
15755
|
-
} else if (primary.startsWith(`never`)) {
|
|
15756
|
-
statement.raws.between = statement.raws.between.replace(/\s*$/, ``);
|
|
15757
|
-
}
|
|
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*$/, ``);
|
|
15758
15628
|
}
|
|
15759
15629
|
});
|
|
15760
15630
|
}
|
|
@@ -15812,17 +15682,11 @@ function rule$10(primary, secondaryOptions) {
|
|
|
15812
15682
|
optional: true
|
|
15813
15683
|
}
|
|
15814
15684
|
);
|
|
15815
|
-
if (!validOptions)
|
|
15816
|
-
return;
|
|
15817
|
-
}
|
|
15685
|
+
if (!validOptions) return;
|
|
15818
15686
|
root2.walkRules(check);
|
|
15819
|
-
if (!optionsMatches(secondaryOptions, `ignore`, `at-rules`))
|
|
15820
|
-
root2.walkAtRules(check);
|
|
15821
|
-
}
|
|
15687
|
+
if (!optionsMatches(secondaryOptions, `ignore`, `at-rules`)) root2.walkAtRules(check);
|
|
15822
15688
|
function check(statement) {
|
|
15823
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15824
|
-
return;
|
|
15825
|
-
}
|
|
15689
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15826
15690
|
const problemIndex = beforeBlockString(statement, { noRawBefore: true }).length + 1;
|
|
15827
15691
|
checker.after({
|
|
15828
15692
|
source: blockString(statement),
|
|
@@ -15838,11 +15702,8 @@ function rule$10(primary, secondaryOptions) {
|
|
|
15838
15702
|
fix() {
|
|
15839
15703
|
let statementFirst = statement.first;
|
|
15840
15704
|
if (statementFirst === null) return;
|
|
15841
|
-
if (primary.startsWith(`always`))
|
|
15842
|
-
|
|
15843
|
-
} else if (primary.startsWith(`never`)) {
|
|
15844
|
-
statementFirst.raws.before = ``;
|
|
15845
|
-
}
|
|
15705
|
+
if (primary.startsWith(`always`)) statementFirst.raws.before = ` `;
|
|
15706
|
+
else if (primary.startsWith(`never`)) statementFirst.raws.before = ``;
|
|
15846
15707
|
}
|
|
15847
15708
|
});
|
|
15848
15709
|
}
|
|
@@ -15901,29 +15762,19 @@ function rule$$(primary, secondaryOptions) {
|
|
|
15901
15762
|
optional: true
|
|
15902
15763
|
}
|
|
15903
15764
|
);
|
|
15904
|
-
if (!validOptions)
|
|
15905
|
-
return;
|
|
15906
|
-
}
|
|
15765
|
+
if (!validOptions) return;
|
|
15907
15766
|
root2.walkRules(check);
|
|
15908
15767
|
root2.walkAtRules(check);
|
|
15909
15768
|
function check(statement) {
|
|
15910
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15911
|
-
|
|
15912
|
-
|
|
15913
|
-
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) {
|
|
15914
|
-
return;
|
|
15915
|
-
}
|
|
15916
|
-
if (statement.type === `rule` && optionsMatches(secondaryOptions, `ignoreSelectors`, statement.selector)) {
|
|
15917
|
-
return;
|
|
15918
|
-
}
|
|
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;
|
|
15919
15772
|
let source = beforeBlockString(statement);
|
|
15920
15773
|
let beforeBraceNoRaw = beforeBlockString(statement, {
|
|
15921
15774
|
noRawBefore: true
|
|
15922
15775
|
});
|
|
15923
15776
|
let index2 = beforeBraceNoRaw.length - 1;
|
|
15924
|
-
if (beforeBraceNoRaw[index2 - 1] === `\r`)
|
|
15925
|
-
index2 -= 1;
|
|
15926
|
-
}
|
|
15777
|
+
if (beforeBraceNoRaw[index2 - 1] === `\r`) index2 -= 1;
|
|
15927
15778
|
checker.before({
|
|
15928
15779
|
source,
|
|
15929
15780
|
index: source.length,
|
|
@@ -15941,9 +15792,7 @@ function rule$$(primary, secondaryOptions) {
|
|
|
15941
15792
|
statement.raws.between = ` `;
|
|
15942
15793
|
return;
|
|
15943
15794
|
}
|
|
15944
|
-
if (primary.startsWith(`never`))
|
|
15945
|
-
statement.raws.between = ``;
|
|
15946
|
-
}
|
|
15795
|
+
if (primary.startsWith(`never`)) statement.raws.between = ``;
|
|
15947
15796
|
}
|
|
15948
15797
|
});
|
|
15949
15798
|
}
|
|
@@ -15971,9 +15820,7 @@ function declarationValueIndex(decl) {
|
|
|
15971
15820
|
raws.between || `:`,
|
|
15972
15821
|
raws.value && `prefix` in raws.value && raws.value.prefix
|
|
15973
15822
|
].reduce((count, str) => {
|
|
15974
|
-
if (isString(str))
|
|
15975
|
-
return count + str.length;
|
|
15976
|
-
}
|
|
15823
|
+
if (isString(str)) return count + str.length;
|
|
15977
15824
|
return count;
|
|
15978
15825
|
}, 0);
|
|
15979
15826
|
}
|
|
@@ -15983,11 +15830,8 @@ function getDeclarationValue(decl) {
|
|
|
15983
15830
|
}
|
|
15984
15831
|
function setDeclarationValue(decl, value) {
|
|
15985
15832
|
let raws = decl.raws;
|
|
15986
|
-
if (raws.value)
|
|
15987
|
-
|
|
15988
|
-
} else {
|
|
15989
|
-
decl.value = value;
|
|
15990
|
-
}
|
|
15833
|
+
if (raws.value) raws.value.raw = value;
|
|
15834
|
+
else decl.value = value;
|
|
15991
15835
|
return decl;
|
|
15992
15836
|
}
|
|
15993
15837
|
let { utils: { report: report$K, ruleMessages: ruleMessages$_, validateOptions: validateOptions$_ } } = stylelint;
|
|
@@ -16009,27 +15853,17 @@ function rule$_(primary) {
|
|
|
16009
15853
|
actual: primary,
|
|
16010
15854
|
possible: [`lower`, `upper`]
|
|
16011
15855
|
});
|
|
16012
|
-
if (!validOptions)
|
|
16013
|
-
return;
|
|
16014
|
-
}
|
|
15856
|
+
if (!validOptions) return;
|
|
16015
15857
|
root2.walkDecls((decl) => {
|
|
16016
|
-
if (!CONTAINS_HEX.test(decl.value))
|
|
16017
|
-
return;
|
|
16018
|
-
}
|
|
15858
|
+
if (!CONTAINS_HEX.test(decl.value)) return;
|
|
16019
15859
|
let parsedValue = valueParser(getDeclarationValue(decl));
|
|
16020
15860
|
let needsFix = false;
|
|
16021
15861
|
parsedValue.walk((node2) => {
|
|
16022
15862
|
let { value } = node2;
|
|
16023
|
-
if (isIgnoredFunction(node2))
|
|
16024
|
-
|
|
16025
|
-
}
|
|
16026
|
-
if (!isHexColor(node2)) {
|
|
16027
|
-
return;
|
|
16028
|
-
}
|
|
15863
|
+
if (isIgnoredFunction(node2)) return false;
|
|
15864
|
+
if (!isHexColor(node2)) return;
|
|
16029
15865
|
let expected = primary === `lower` ? value.toLowerCase() : value.toUpperCase();
|
|
16030
|
-
if (value === expected)
|
|
16031
|
-
return;
|
|
16032
|
-
}
|
|
15866
|
+
if (value === expected) return;
|
|
16033
15867
|
const problemIndex = declarationValueIndex(decl) + node2.sourceIndex;
|
|
16034
15868
|
report$K({
|
|
16035
15869
|
message: messages$_.expected,
|
|
@@ -16045,9 +15879,7 @@ function rule$_(primary) {
|
|
|
16045
15879
|
}
|
|
16046
15880
|
});
|
|
16047
15881
|
});
|
|
16048
|
-
if (needsFix)
|
|
16049
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
16050
|
-
}
|
|
15882
|
+
if (needsFix) setDeclarationValue(decl, parsedValue.toString());
|
|
16051
15883
|
});
|
|
16052
15884
|
};
|
|
16053
15885
|
}
|
|
@@ -16219,9 +16051,7 @@ function declarationBangSpaceChecker(opts) {
|
|
|
16219
16051
|
let indexOffset = declarationValueIndex(decl);
|
|
16220
16052
|
let declString = decl.toString();
|
|
16221
16053
|
let valueString = decl.toString().slice(indexOffset);
|
|
16222
|
-
if (!valueString.includes(`!`))
|
|
16223
|
-
return;
|
|
16224
|
-
}
|
|
16054
|
+
if (!valueString.includes(`!`)) return;
|
|
16225
16055
|
styleSearch({ source: valueString, target: `!` }, (match) => {
|
|
16226
16056
|
check(declString, match.startIndex + indexOffset, decl);
|
|
16227
16057
|
});
|
|
@@ -16262,9 +16092,7 @@ function rule$Z(primary) {
|
|
|
16262
16092
|
actual: primary,
|
|
16263
16093
|
possible: [`always`, `never`]
|
|
16264
16094
|
});
|
|
16265
|
-
if (!validOptions)
|
|
16266
|
-
return;
|
|
16267
|
-
}
|
|
16095
|
+
if (!validOptions) return;
|
|
16268
16096
|
declarationBangSpaceChecker({
|
|
16269
16097
|
root: root2,
|
|
16270
16098
|
result: result2,
|
|
@@ -16286,9 +16114,7 @@ function rule$Z(primary) {
|
|
|
16286
16114
|
setFixed = (value) => {
|
|
16287
16115
|
decl.raws.important = value;
|
|
16288
16116
|
};
|
|
16289
|
-
} else
|
|
16290
|
-
return false;
|
|
16291
|
-
}
|
|
16117
|
+
} else return false;
|
|
16292
16118
|
let targetBefore = target.slice(0, bangIndex + 1);
|
|
16293
16119
|
let targetAfter = target.slice(bangIndex + 1);
|
|
16294
16120
|
if (primary === `always`) {
|
|
@@ -16332,9 +16158,7 @@ function rule$Y(primary) {
|
|
|
16332
16158
|
actual: primary,
|
|
16333
16159
|
possible: [`always`, `never`]
|
|
16334
16160
|
});
|
|
16335
|
-
if (!validOptions)
|
|
16336
|
-
return;
|
|
16337
|
-
}
|
|
16161
|
+
if (!validOptions) return;
|
|
16338
16162
|
declarationBangSpaceChecker({
|
|
16339
16163
|
root: root2,
|
|
16340
16164
|
result: result2,
|
|
@@ -16356,9 +16180,7 @@ function rule$Y(primary) {
|
|
|
16356
16180
|
setFixed = (val) => {
|
|
16357
16181
|
decl.raws.important = val;
|
|
16358
16182
|
};
|
|
16359
|
-
} else
|
|
16360
|
-
return false;
|
|
16361
|
-
}
|
|
16183
|
+
} else return false;
|
|
16362
16184
|
let targetBefore = target.slice(0, bangIndex);
|
|
16363
16185
|
let targetAfter = target.slice(bangIndex);
|
|
16364
16186
|
if (primary === `always`) {
|
|
@@ -16403,28 +16225,16 @@ function rule$X(primary, _secondaryOptions, context) {
|
|
|
16403
16225
|
actual: primary,
|
|
16404
16226
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
16405
16227
|
});
|
|
16406
|
-
if (!validOptions)
|
|
16407
|
-
return;
|
|
16408
|
-
}
|
|
16228
|
+
if (!validOptions) return;
|
|
16409
16229
|
root2.walkDecls((decl) => {
|
|
16410
16230
|
let parentRule = decl.parent;
|
|
16411
|
-
if (!parentRule)
|
|
16412
|
-
|
|
16413
|
-
|
|
16414
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16415
|
-
return;
|
|
16416
|
-
}
|
|
16417
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16418
|
-
return;
|
|
16419
|
-
}
|
|
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;
|
|
16420
16234
|
let nextNode = decl.next();
|
|
16421
|
-
if (!nextNode)
|
|
16422
|
-
return;
|
|
16423
|
-
}
|
|
16235
|
+
if (!nextNode) return;
|
|
16424
16236
|
let nodeToCheck = nextNonCommentNode(nextNode);
|
|
16425
|
-
if (!nodeToCheck)
|
|
16426
|
-
return;
|
|
16427
|
-
}
|
|
16237
|
+
if (!nodeToCheck) return;
|
|
16428
16238
|
const problemIndex = decl.toString().length + 1;
|
|
16429
16239
|
checker.afterOneOnly({
|
|
16430
16240
|
source: rawNodeString(nodeToCheck),
|
|
@@ -16444,9 +16254,7 @@ function rule$X(primary, _secondaryOptions, context) {
|
|
|
16444
16254
|
nodeToCheck.raws.before = index2 >= 0 ? nodeToCheck.raws.before.slice(index2) : context.newline + nodeToCheck.raws.before;
|
|
16445
16255
|
return;
|
|
16446
16256
|
}
|
|
16447
|
-
if (primary === `never-multi-line`)
|
|
16448
|
-
nodeToCheck.raws.before = ``;
|
|
16449
|
-
}
|
|
16257
|
+
if (primary === `never-multi-line`) nodeToCheck.raws.before = ``;
|
|
16450
16258
|
}
|
|
16451
16259
|
});
|
|
16452
16260
|
}
|
|
@@ -16482,20 +16290,12 @@ function rule$W(primary) {
|
|
|
16482
16290
|
actual: primary,
|
|
16483
16291
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
16484
16292
|
});
|
|
16485
|
-
if (!validOptions)
|
|
16486
|
-
return;
|
|
16487
|
-
}
|
|
16293
|
+
if (!validOptions) return;
|
|
16488
16294
|
root2.walkDecls((decl) => {
|
|
16489
16295
|
let parentRule = decl.parent;
|
|
16490
|
-
if (!parentRule)
|
|
16491
|
-
|
|
16492
|
-
|
|
16493
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16494
|
-
return;
|
|
16495
|
-
}
|
|
16496
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16497
|
-
return;
|
|
16498
|
-
}
|
|
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;
|
|
16499
16299
|
const declString = decl.toString();
|
|
16500
16300
|
const problemIndex = decl.toString().length - 1;
|
|
16501
16301
|
checker.beforeAllowingIndentation({
|
|
@@ -16546,24 +16346,14 @@ function rule$V(primary) {
|
|
|
16546
16346
|
actual: primary,
|
|
16547
16347
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
16548
16348
|
});
|
|
16549
|
-
if (!validOptions)
|
|
16550
|
-
return;
|
|
16551
|
-
}
|
|
16349
|
+
if (!validOptions) return;
|
|
16552
16350
|
root2.walkDecls((decl) => {
|
|
16553
16351
|
let parentRule = decl.parent;
|
|
16554
|
-
if (!parentRule)
|
|
16555
|
-
|
|
16556
|
-
|
|
16557
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16558
|
-
return;
|
|
16559
|
-
}
|
|
16560
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16561
|
-
return;
|
|
16562
|
-
}
|
|
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;
|
|
16563
16355
|
let nextDecl = decl.next();
|
|
16564
|
-
if (!nextDecl)
|
|
16565
|
-
return;
|
|
16566
|
-
}
|
|
16356
|
+
if (!nextDecl) return;
|
|
16567
16357
|
const problemIndex = decl.toString().length + 1;
|
|
16568
16358
|
checker.after({
|
|
16569
16359
|
source: rawNodeString(nextDecl),
|
|
@@ -16582,9 +16372,7 @@ function rule$V(primary) {
|
|
|
16582
16372
|
nextDecl.raws.before = ` `;
|
|
16583
16373
|
return;
|
|
16584
16374
|
}
|
|
16585
|
-
if (primary.startsWith(`never`))
|
|
16586
|
-
nextDecl.raws.before = ``;
|
|
16587
|
-
}
|
|
16375
|
+
if (primary.startsWith(`never`)) nextDecl.raws.before = ``;
|
|
16588
16376
|
}
|
|
16589
16377
|
});
|
|
16590
16378
|
}
|
|
@@ -16625,27 +16413,17 @@ function rule$U(primary) {
|
|
|
16625
16413
|
actual: primary,
|
|
16626
16414
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
16627
16415
|
});
|
|
16628
|
-
if (!validOptions)
|
|
16629
|
-
return;
|
|
16630
|
-
}
|
|
16416
|
+
if (!validOptions) return;
|
|
16631
16417
|
root2.walkDecls((decl) => {
|
|
16632
16418
|
let parentRule = decl.parent;
|
|
16633
|
-
if (!parentRule)
|
|
16634
|
-
|
|
16635
|
-
|
|
16636
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16637
|
-
return;
|
|
16638
|
-
}
|
|
16639
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16640
|
-
return;
|
|
16641
|
-
}
|
|
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;
|
|
16642
16422
|
const value = getDeclarationValue(decl);
|
|
16643
16423
|
let isCustomPropertyWithOnlySpaces = false;
|
|
16644
16424
|
if (isCustomProperty(decl.prop)) {
|
|
16645
16425
|
isCustomPropertyWithOnlySpaces = /^\s+$/.test(value);
|
|
16646
|
-
if (primary.startsWith(`never`) && value === ` `)
|
|
16647
|
-
return;
|
|
16648
|
-
}
|
|
16426
|
+
if (primary.startsWith(`never`) && value === ` `) return;
|
|
16649
16427
|
}
|
|
16650
16428
|
const declString = decl.toString();
|
|
16651
16429
|
const problemIndex = decl.toString().length - 1;
|
|
@@ -16663,17 +16441,13 @@ function rule$U(primary) {
|
|
|
16663
16441
|
ruleName: ruleName$U,
|
|
16664
16442
|
fix() {
|
|
16665
16443
|
if (primary.startsWith(`always`)) {
|
|
16666
|
-
if (decl.important)
|
|
16667
|
-
|
|
16668
|
-
} else {
|
|
16669
|
-
setDeclarationValue(decl, value.replace(/\s*$/, ` `));
|
|
16670
|
-
}
|
|
16444
|
+
if (decl.important) decl.raws.important = ` !important `;
|
|
16445
|
+
else setDeclarationValue(decl, value.replace(/\s*$/, ` `));
|
|
16671
16446
|
return;
|
|
16672
16447
|
}
|
|
16673
16448
|
if (primary.startsWith(`never`)) {
|
|
16674
|
-
if (decl.raws.important)
|
|
16675
|
-
|
|
16676
|
-
} else {
|
|
16449
|
+
if (decl.raws.important) decl.raws.important = decl.raws.important.replace(/\s*$/, ``);
|
|
16450
|
+
else {
|
|
16677
16451
|
const newValue = isCustomPropertyWithOnlySpaces ? ` ` : value.replace(/\s*$/, ``);
|
|
16678
16452
|
setDeclarationValue(decl, newValue);
|
|
16679
16453
|
}
|
|
@@ -16723,9 +16497,7 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16723
16497
|
optional: true
|
|
16724
16498
|
}
|
|
16725
16499
|
);
|
|
16726
|
-
if (!validOptions)
|
|
16727
|
-
return;
|
|
16728
|
-
}
|
|
16500
|
+
if (!validOptions) return;
|
|
16729
16501
|
root2.walkAtRules((atRule2) => {
|
|
16730
16502
|
if (!atRule2.parent) throw new Error(`A parent node must be present`);
|
|
16731
16503
|
if (atRule2.parent === root2 || atRule2 !== atRule2.parent.last || hasBlock(atRule2)) return;
|
|
@@ -16737,9 +16509,7 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16737
16509
|
checkLastNode(decl);
|
|
16738
16510
|
});
|
|
16739
16511
|
function checkLastNode(node2) {
|
|
16740
|
-
if (!node2.parent)
|
|
16741
|
-
throw new Error(`A parent node must be present`);
|
|
16742
|
-
}
|
|
16512
|
+
if (!node2.parent) throw new Error(`A parent node must be present`);
|
|
16743
16513
|
let hasSemicolon = node2.parent.raws.semicolon;
|
|
16744
16514
|
let ignoreSingleDeclaration = optionsMatches(
|
|
16745
16515
|
secondaryOptions,
|
|
@@ -16749,11 +16519,8 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16749
16519
|
if (ignoreSingleDeclaration && node2.parent.first === node2) return;
|
|
16750
16520
|
if (primary === `always` && primary === `never`) throw new Error(`Unexpected primary option: "${primary}"`);
|
|
16751
16521
|
let message;
|
|
16752
|
-
if (primary === `always` && !hasSemicolon)
|
|
16753
|
-
|
|
16754
|
-
} else if (primary === `never` && hasSemicolon) {
|
|
16755
|
-
message = messages$T.rejected;
|
|
16756
|
-
}
|
|
16522
|
+
if (primary === `always` && !hasSemicolon) message = messages$T.expected;
|
|
16523
|
+
else if (primary === `never` && hasSemicolon) message = messages$T.rejected;
|
|
16757
16524
|
const problemIndex = node2.toString().trim().length - 1;
|
|
16758
16525
|
if (message) {
|
|
16759
16526
|
report$E({
|
|
@@ -16770,9 +16537,7 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16770
16537
|
node2.raws.between = ``;
|
|
16771
16538
|
node2.parent.raws.after = ` `;
|
|
16772
16539
|
}
|
|
16773
|
-
} else if (primary === `never` && hasSemicolon)
|
|
16774
|
-
node2.parent.raws.semicolon = false;
|
|
16775
|
-
}
|
|
16540
|
+
} else if (primary === `never` && hasSemicolon) node2.parent.raws.semicolon = false;
|
|
16776
16541
|
}
|
|
16777
16542
|
});
|
|
16778
16543
|
}
|
|
@@ -16790,35 +16555,19 @@ const index$T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
16790
16555
|
ruleName: ruleName$T
|
|
16791
16556
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
16792
16557
|
function isScssVariable(property) {
|
|
16793
|
-
if (property.startsWith(`$`))
|
|
16794
|
-
|
|
16795
|
-
}
|
|
16796
|
-
if (property.includes(`.$`)) {
|
|
16797
|
-
return true;
|
|
16798
|
-
}
|
|
16558
|
+
if (property.startsWith(`$`)) return true;
|
|
16559
|
+
if (property.includes(`.$`)) return true;
|
|
16799
16560
|
return false;
|
|
16800
16561
|
}
|
|
16801
16562
|
function isStandardSyntaxDeclaration(decl) {
|
|
16802
16563
|
let prop = decl.prop;
|
|
16803
16564
|
let parent = decl.parent;
|
|
16804
|
-
if (isScssVariable(prop))
|
|
16805
|
-
|
|
16806
|
-
|
|
16807
|
-
if (
|
|
16808
|
-
|
|
16809
|
-
|
|
16810
|
-
if (parent && parent.type === `atrule` && parent.raws.afterName === `:`) {
|
|
16811
|
-
return false;
|
|
16812
|
-
}
|
|
16813
|
-
if (parent && isRule(parent) && parent.selector && parent.selector.startsWith(`#`) && parent.selector.endsWith(`()`)) {
|
|
16814
|
-
return false;
|
|
16815
|
-
}
|
|
16816
|
-
if (parent && isRule(parent) && parent.selector && parent.selector[parent.selector.length - 1] === `:` && parent.selector.substring(0, 2) !== `--`) {
|
|
16817
|
-
return false;
|
|
16818
|
-
}
|
|
16819
|
-
if (`extend` in decl && decl.extend) {
|
|
16820
|
-
return false;
|
|
16821
|
-
}
|
|
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;
|
|
16822
16571
|
return true;
|
|
16823
16572
|
}
|
|
16824
16573
|
let { utils: { report: report$D, ruleMessages: ruleMessages$S, validateOptions: validateOptions$S } } = stylelint;
|
|
@@ -16839,19 +16588,13 @@ function rule$S(primary, _secondaryOptions, context) {
|
|
|
16839
16588
|
actual: primary,
|
|
16840
16589
|
possible: [`always`, `always-multi-line`]
|
|
16841
16590
|
});
|
|
16842
|
-
if (!validOptions)
|
|
16843
|
-
return;
|
|
16844
|
-
}
|
|
16591
|
+
if (!validOptions) return;
|
|
16845
16592
|
root2.walkDecls((decl) => {
|
|
16846
|
-
if (!isStandardSyntaxDeclaration(decl))
|
|
16847
|
-
return;
|
|
16848
|
-
}
|
|
16593
|
+
if (!isStandardSyntaxDeclaration(decl)) return;
|
|
16849
16594
|
let endOfPropIndex = declarationValueIndex(decl) + (decl.raws.between || ``).length - 1;
|
|
16850
16595
|
let propPlusColon = `${decl.toString().slice(0, endOfPropIndex)}xxx`;
|
|
16851
16596
|
for (let i2 = 0, l2 = propPlusColon.length; i2 < l2; i2++) {
|
|
16852
|
-
if (propPlusColon[i2] !== `:`)
|
|
16853
|
-
continue;
|
|
16854
|
-
}
|
|
16597
|
+
if (propPlusColon[i2] !== `:`) continue;
|
|
16855
16598
|
let indexToCheck = /^[^\S\r\n]*\/\*/.test(propPlusColon.slice(i2 + 1)) ? propPlusColon.indexOf(`*/`, i2) + 1 : i2;
|
|
16856
16599
|
checker.afterOneOnly({
|
|
16857
16600
|
source: propPlusColon,
|
|
@@ -16867,9 +16610,7 @@ function rule$S(primary, _secondaryOptions, context) {
|
|
|
16867
16610
|
ruleName: ruleName$S,
|
|
16868
16611
|
fix() {
|
|
16869
16612
|
let between = decl.raws.between;
|
|
16870
|
-
if (between === null)
|
|
16871
|
-
throw new Error(`\`between\` must be present`);
|
|
16872
|
-
}
|
|
16613
|
+
if (between === null) throw new Error(`\`between\` must be present`);
|
|
16873
16614
|
let betweenStart = declarationValueIndex(decl) - between.length;
|
|
16874
16615
|
let sliceIndex = indexToCheck - betweenStart + 1;
|
|
16875
16616
|
let betweenBefore = between.slice(0, sliceIndex);
|
|
@@ -16896,15 +16637,11 @@ const index$S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
16896
16637
|
let { utils: { report: report$C } } = stylelint;
|
|
16897
16638
|
function declarationColonSpaceChecker(opts) {
|
|
16898
16639
|
opts.root.walkDecls((decl) => {
|
|
16899
|
-
if (!isStandardSyntaxDeclaration(decl))
|
|
16900
|
-
return;
|
|
16901
|
-
}
|
|
16640
|
+
if (!isStandardSyntaxDeclaration(decl)) return;
|
|
16902
16641
|
let endOfPropIndex = declarationValueIndex(decl) + (decl.raws.between || ``).length - 1;
|
|
16903
16642
|
let propPlusColon = `${decl.toString().slice(0, endOfPropIndex)}xxx`;
|
|
16904
16643
|
for (let i2 = 0, l2 = propPlusColon.length; i2 < l2; i2++) {
|
|
16905
|
-
if (propPlusColon[i2] !== `:`)
|
|
16906
|
-
continue;
|
|
16907
|
-
}
|
|
16644
|
+
if (propPlusColon[i2] !== `:`) continue;
|
|
16908
16645
|
const problemIndex = decl.prop.toString().length + 1;
|
|
16909
16646
|
opts.locationChecker({
|
|
16910
16647
|
source: propPlusColon,
|
|
@@ -16945,9 +16682,7 @@ function rule$R(primary) {
|
|
|
16945
16682
|
actual: primary,
|
|
16946
16683
|
possible: [`always`, `never`, `always-single-line`]
|
|
16947
16684
|
});
|
|
16948
|
-
if (!validOptions)
|
|
16949
|
-
return;
|
|
16950
|
-
}
|
|
16685
|
+
if (!validOptions) return;
|
|
16951
16686
|
declarationColonSpaceChecker({
|
|
16952
16687
|
root: root2,
|
|
16953
16688
|
result: result2,
|
|
@@ -16956,9 +16691,7 @@ function rule$R(primary) {
|
|
|
16956
16691
|
fix: (decl, index2) => {
|
|
16957
16692
|
let colonIndex = index2 - declarationValueIndex(decl);
|
|
16958
16693
|
let between = decl.raws.between;
|
|
16959
|
-
if (between === null)
|
|
16960
|
-
throw new Error(`\`between\` must be present`);
|
|
16961
|
-
}
|
|
16694
|
+
if (between === null) throw new Error(`\`between\` must be present`);
|
|
16962
16695
|
if (primary.startsWith(`always`)) {
|
|
16963
16696
|
decl.raws.between = between.slice(0, colonIndex) + between.slice(colonIndex).replace(/^:\s*/, `: `);
|
|
16964
16697
|
return true;
|
|
@@ -17000,9 +16733,7 @@ function rule$Q(primary) {
|
|
|
17000
16733
|
actual: primary,
|
|
17001
16734
|
possible: [`always`, `never`]
|
|
17002
16735
|
});
|
|
17003
|
-
if (!validOptions)
|
|
17004
|
-
return;
|
|
17005
|
-
}
|
|
16736
|
+
if (!validOptions) return;
|
|
17006
16737
|
declarationColonSpaceChecker({
|
|
17007
16738
|
root: root2,
|
|
17008
16739
|
result: result2,
|
|
@@ -17011,9 +16742,7 @@ function rule$Q(primary) {
|
|
|
17011
16742
|
fix: (decl, index2) => {
|
|
17012
16743
|
let colonIndex = index2 - declarationValueIndex(decl);
|
|
17013
16744
|
let between = decl.raws.between;
|
|
17014
|
-
if (between === null)
|
|
17015
|
-
throw new Error(`\`between\` must be present`);
|
|
17016
|
-
}
|
|
16745
|
+
if (between === null) throw new Error(`\`between\` must be present`);
|
|
17017
16746
|
if (primary === `always`) {
|
|
17018
16747
|
decl.raws.between = between.slice(0, colonIndex).replace(/\s*$/, ` `) + between.slice(colonIndex);
|
|
17019
16748
|
return true;
|
|
@@ -17037,45 +16766,11 @@ const index$Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17037
16766
|
meta: meta$Q,
|
|
17038
16767
|
ruleName: ruleName$Q
|
|
17039
16768
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
17040
|
-
function functionCommaSpaceFix(params) {
|
|
17041
|
-
let { div, index: index2, nodes, expectation, position, symb } = params;
|
|
17042
|
-
if (expectation.startsWith(`always`)) {
|
|
17043
|
-
div[position] = symb;
|
|
17044
|
-
return true;
|
|
17045
|
-
}
|
|
17046
|
-
if (expectation.startsWith(`never`)) {
|
|
17047
|
-
div[position] = ``;
|
|
17048
|
-
for (let i2 = index2 + 1; i2 < nodes.length; i2++) {
|
|
17049
|
-
let node2 = nodes[i2];
|
|
17050
|
-
if (node2 === void 0) {
|
|
17051
|
-
continue;
|
|
17052
|
-
}
|
|
17053
|
-
if (node2.type === `comment`) {
|
|
17054
|
-
continue;
|
|
17055
|
-
}
|
|
17056
|
-
if (node2.type === `space`) {
|
|
17057
|
-
node2.value = ``;
|
|
17058
|
-
continue;
|
|
17059
|
-
}
|
|
17060
|
-
break;
|
|
17061
|
-
}
|
|
17062
|
-
return true;
|
|
17063
|
-
}
|
|
17064
|
-
return false;
|
|
17065
|
-
}
|
|
17066
16769
|
function isStandardSyntaxFunction(node2) {
|
|
17067
|
-
if (!node2.value)
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
if (node2.value.startsWith(
|
|
17071
|
-
return false;
|
|
17072
|
-
}
|
|
17073
|
-
if (node2.value.startsWith(`\${`)) {
|
|
17074
|
-
return false;
|
|
17075
|
-
}
|
|
17076
|
-
if (node2.value.startsWith(`\``)) {
|
|
17077
|
-
return false;
|
|
17078
|
-
}
|
|
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;
|
|
17079
16774
|
return true;
|
|
17080
16775
|
}
|
|
17081
16776
|
let { utils: { report: report$B } } = stylelint;
|
|
@@ -17085,15 +16780,9 @@ function functionCommaSpaceChecker(opts) {
|
|
|
17085
16780
|
let hasFixed;
|
|
17086
16781
|
let parsedValue = valueParser(declValue);
|
|
17087
16782
|
parsedValue.walk((valueNode) => {
|
|
17088
|
-
if (valueNode.type !== `function`)
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
if (!isStandardSyntaxFunction(valueNode)) {
|
|
17092
|
-
return;
|
|
17093
|
-
}
|
|
17094
|
-
if (valueNode.value.toLowerCase() === `url`) {
|
|
17095
|
-
return;
|
|
17096
|
-
}
|
|
16783
|
+
if (valueNode.type !== `function`) return;
|
|
16784
|
+
if (!isStandardSyntaxFunction(valueNode)) return;
|
|
16785
|
+
if (valueNode.value.toLowerCase() === `url`) return;
|
|
17097
16786
|
let argumentStrings = valueNode.nodes.map((node2) => valueParser.stringify(node2));
|
|
17098
16787
|
let functionArguments = (() => {
|
|
17099
16788
|
let result2 = valueNode.before + argumentStrings.join(``) + valueNode.after;
|
|
@@ -17107,9 +16796,7 @@ function functionCommaSpaceChecker(opts) {
|
|
|
17107
16796
|
}
|
|
17108
16797
|
let commaDataList = [];
|
|
17109
16798
|
for (let [nodeIndex, node2] of valueNode.nodes.entries()) {
|
|
17110
|
-
if (node2.type !== `div` || node2.value !== `,`)
|
|
17111
|
-
continue;
|
|
17112
|
-
}
|
|
16799
|
+
if (node2.type !== `div` || node2.value !== `,`) continue;
|
|
17113
16800
|
let checkIndex = getCommaCheckIndex(node2, nodeIndex);
|
|
17114
16801
|
commaDataList.push({
|
|
17115
16802
|
commaNode: node2,
|
|
@@ -17139,11 +16826,31 @@ function functionCommaSpaceChecker(opts) {
|
|
|
17139
16826
|
});
|
|
17140
16827
|
}
|
|
17141
16828
|
});
|
|
17142
|
-
if (hasFixed)
|
|
17143
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
17144
|
-
}
|
|
16829
|
+
if (hasFixed) setDeclarationValue(decl, parsedValue.toString());
|
|
17145
16830
|
});
|
|
17146
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
|
+
}
|
|
17147
16854
|
let { utils: { ruleMessages: ruleMessages$P, validateOptions: validateOptions$P } } = stylelint;
|
|
17148
16855
|
let shortName$P = `function-comma-newline-after`;
|
|
17149
16856
|
let ruleName$P = addNamespace(shortName$P);
|
|
@@ -17163,9 +16870,7 @@ function rule$P(primary, _secondaryOptions, context) {
|
|
|
17163
16870
|
actual: primary,
|
|
17164
16871
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
17165
16872
|
});
|
|
17166
|
-
if (!validOptions)
|
|
17167
|
-
return;
|
|
17168
|
-
}
|
|
16873
|
+
if (!validOptions) return;
|
|
17169
16874
|
functionCommaSpaceChecker({
|
|
17170
16875
|
root: root2,
|
|
17171
16876
|
result: result2,
|
|
@@ -17211,9 +16916,7 @@ function rule$O(primary, _secondaryOptions, context) {
|
|
|
17211
16916
|
actual: primary,
|
|
17212
16917
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
17213
16918
|
});
|
|
17214
|
-
if (!validOptions)
|
|
17215
|
-
return;
|
|
17216
|
-
}
|
|
16919
|
+
if (!validOptions) return;
|
|
17217
16920
|
functionCommaSpaceChecker({
|
|
17218
16921
|
root: root2,
|
|
17219
16922
|
result: result2,
|
|
@@ -17260,9 +16963,7 @@ function rule$N(primary) {
|
|
|
17260
16963
|
actual: primary,
|
|
17261
16964
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
17262
16965
|
});
|
|
17263
|
-
if (!validOptions)
|
|
17264
|
-
return;
|
|
17265
|
-
}
|
|
16966
|
+
if (!validOptions) return;
|
|
17266
16967
|
functionCommaSpaceChecker({
|
|
17267
16968
|
root: root2,
|
|
17268
16969
|
result: result2,
|
|
@@ -17309,9 +17010,7 @@ function rule$M(primary) {
|
|
|
17309
17010
|
actual: primary,
|
|
17310
17011
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
17311
17012
|
});
|
|
17312
|
-
if (!validOptions)
|
|
17313
|
-
return;
|
|
17314
|
-
}
|
|
17013
|
+
if (!validOptions) return;
|
|
17315
17014
|
functionCommaSpaceChecker({
|
|
17316
17015
|
root: root2,
|
|
17317
17016
|
result: result2,
|
|
@@ -17349,9 +17048,7 @@ let meta$L = {
|
|
|
17349
17048
|
fixable: true
|
|
17350
17049
|
};
|
|
17351
17050
|
function placeIndexOnValueStart(decl) {
|
|
17352
|
-
if (decl.raws.between === null)
|
|
17353
|
-
throw new Error(`\`between\` must be present`);
|
|
17354
|
-
}
|
|
17051
|
+
if (decl.raws.between === null) throw new Error(`\`between\` must be present`);
|
|
17355
17052
|
return decl.prop.length + decl.raws.between.length - 1;
|
|
17356
17053
|
}
|
|
17357
17054
|
function rule$L(primary) {
|
|
@@ -17361,9 +17058,7 @@ function rule$L(primary) {
|
|
|
17361
17058
|
actual: primary,
|
|
17362
17059
|
possible: isNumber$1
|
|
17363
17060
|
});
|
|
17364
|
-
if (!validOptions)
|
|
17365
|
-
return;
|
|
17366
|
-
}
|
|
17061
|
+
if (!validOptions) return;
|
|
17367
17062
|
let violatedCRLFNewLinesRegex = new RegExp(`(?:\r
|
|
17368
17063
|
){${maxAdjacentNewlines + 1},}`);
|
|
17369
17064
|
let violatedLFNewLinesRegex = new RegExp(`
|
|
@@ -17373,20 +17068,14 @@ function rule$L(primary) {
|
|
|
17373
17068
|
let allowedCRLFNewLinesString = `\r
|
|
17374
17069
|
`.repeat(maxAdjacentNewlines);
|
|
17375
17070
|
root2.walkDecls((decl) => {
|
|
17376
|
-
if (!decl.value.includes(`(`))
|
|
17377
|
-
return;
|
|
17378
|
-
}
|
|
17071
|
+
if (!decl.value.includes(`(`)) return;
|
|
17379
17072
|
let stringValue = getDeclarationValue(decl);
|
|
17380
17073
|
let splittedValue = [];
|
|
17381
17074
|
let sourceIndexStart = 0;
|
|
17382
17075
|
valueParser(stringValue).walk((node2) => {
|
|
17383
|
-
if (node2.type !== `function` || node2.value.length === 0)
|
|
17384
|
-
return;
|
|
17385
|
-
}
|
|
17076
|
+
if (node2.type !== `function` || node2.value.length === 0) return;
|
|
17386
17077
|
let stringifiedNode = valueParser.stringify(node2);
|
|
17387
|
-
if (!violatedLFNewLinesRegex.test(stringifiedNode) && !violatedCRLFNewLinesRegex.test(stringifiedNode))
|
|
17388
|
-
return;
|
|
17389
|
-
}
|
|
17078
|
+
if (!violatedLFNewLinesRegex.test(stringifiedNode) && !violatedCRLFNewLinesRegex.test(stringifiedNode)) return;
|
|
17390
17079
|
const problemIndex = placeIndexOnValueStart(decl) + node2.sourceIndex;
|
|
17391
17080
|
report$A({
|
|
17392
17081
|
message: messages$L.expected,
|
|
@@ -17444,24 +17133,16 @@ function rule$K(primary, _secondaryOptions, context) {
|
|
|
17444
17133
|
actual: primary,
|
|
17445
17134
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
17446
17135
|
});
|
|
17447
|
-
if (!validOptions)
|
|
17448
|
-
return;
|
|
17449
|
-
}
|
|
17136
|
+
if (!validOptions) return;
|
|
17450
17137
|
root2.walkDecls((decl) => {
|
|
17451
|
-
if (!decl.value.includes(`(`))
|
|
17452
|
-
return;
|
|
17453
|
-
}
|
|
17138
|
+
if (!decl.value.includes(`(`)) return;
|
|
17454
17139
|
let fix = null;
|
|
17455
17140
|
let hasFixed = false;
|
|
17456
17141
|
let declValue = getDeclarationValue(decl);
|
|
17457
17142
|
let parsedValue = valueParser(declValue);
|
|
17458
17143
|
parsedValue.walk((valueNode) => {
|
|
17459
|
-
if (valueNode.type !== `function`)
|
|
17460
|
-
|
|
17461
|
-
}
|
|
17462
|
-
if (!isStandardSyntaxFunction(valueNode)) {
|
|
17463
|
-
return;
|
|
17464
|
-
}
|
|
17144
|
+
if (valueNode.type !== `function`) return;
|
|
17145
|
+
if (!isStandardSyntaxFunction(valueNode)) return;
|
|
17465
17146
|
let functionString = valueParser.stringify(valueNode);
|
|
17466
17147
|
let isMultiLine = !isSingleLineString(functionString);
|
|
17467
17148
|
function containsNewline(str) {
|
|
@@ -17515,9 +17196,7 @@ function rule$K(primary, _secondaryOptions, context) {
|
|
|
17515
17196
|
complain(messages$K.rejectedClosingMultiLine, closingIndex);
|
|
17516
17197
|
}
|
|
17517
17198
|
});
|
|
17518
|
-
if (hasFixed)
|
|
17519
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
17520
|
-
}
|
|
17199
|
+
if (hasFixed) setDeclarationValue(decl, parsedValue.toString());
|
|
17521
17200
|
function complain(message, offset) {
|
|
17522
17201
|
const problemIndex = declarationValueIndex(decl) + offset;
|
|
17523
17202
|
report$z({
|
|
@@ -17536,9 +17215,7 @@ function rule$K(primary, _secondaryOptions, context) {
|
|
|
17536
17215
|
function getCheckBefore(valueNode) {
|
|
17537
17216
|
let before = valueNode.before;
|
|
17538
17217
|
for (let node2 of valueNode.nodes) {
|
|
17539
|
-
if (node2.type === `comment`)
|
|
17540
|
-
continue;
|
|
17541
|
-
}
|
|
17218
|
+
if (node2.type === `comment`) continue;
|
|
17542
17219
|
if (node2.type === `space`) {
|
|
17543
17220
|
before += node2.value;
|
|
17544
17221
|
continue;
|
|
@@ -17550,9 +17227,7 @@ function getCheckBefore(valueNode) {
|
|
|
17550
17227
|
function getCheckAfter(valueNode) {
|
|
17551
17228
|
let after = ``;
|
|
17552
17229
|
for (let node2 of [...valueNode.nodes].reverse()) {
|
|
17553
|
-
if (node2.type === `comment`)
|
|
17554
|
-
continue;
|
|
17555
|
-
}
|
|
17230
|
+
if (node2.type === `comment`) continue;
|
|
17556
17231
|
if (node2.type === `space`) {
|
|
17557
17232
|
after = node2.value + after;
|
|
17558
17233
|
continue;
|
|
@@ -17565,27 +17240,20 @@ function getCheckAfter(valueNode) {
|
|
|
17565
17240
|
function fixBeforeForAlways(valueNode, newline) {
|
|
17566
17241
|
let target;
|
|
17567
17242
|
for (let node2 of valueNode.nodes) {
|
|
17568
|
-
if (node2.type === `comment`)
|
|
17569
|
-
continue;
|
|
17570
|
-
}
|
|
17243
|
+
if (node2.type === `comment`) continue;
|
|
17571
17244
|
if (node2.type === `space`) {
|
|
17572
17245
|
target = node2;
|
|
17573
17246
|
continue;
|
|
17574
17247
|
}
|
|
17575
17248
|
break;
|
|
17576
17249
|
}
|
|
17577
|
-
if (target)
|
|
17578
|
-
|
|
17579
|
-
} else {
|
|
17580
|
-
valueNode.before = newline + valueNode.before;
|
|
17581
|
-
}
|
|
17250
|
+
if (target) target.value = newline + target.value;
|
|
17251
|
+
else valueNode.before = newline + valueNode.before;
|
|
17582
17252
|
}
|
|
17583
17253
|
function fixBeforeForNever(valueNode) {
|
|
17584
17254
|
valueNode.before = ``;
|
|
17585
17255
|
for (let node2 of valueNode.nodes) {
|
|
17586
|
-
if (node2.type === `comment`)
|
|
17587
|
-
continue;
|
|
17588
|
-
}
|
|
17256
|
+
if (node2.type === `comment`) continue;
|
|
17589
17257
|
if (node2.type === `space`) {
|
|
17590
17258
|
node2.value = ``;
|
|
17591
17259
|
continue;
|
|
@@ -17599,9 +17267,7 @@ function fixAfterForAlways(valueNode, newline) {
|
|
|
17599
17267
|
function fixAfterForNever(valueNode) {
|
|
17600
17268
|
valueNode.after = ``;
|
|
17601
17269
|
for (let node2 of [...valueNode.nodes].reverse()) {
|
|
17602
|
-
if (node2.type === `comment`)
|
|
17603
|
-
continue;
|
|
17604
|
-
}
|
|
17270
|
+
if (node2.type === `comment`) continue;
|
|
17605
17271
|
if (node2.type === `space`) {
|
|
17606
17272
|
node2.value = ``;
|
|
17607
17273
|
continue;
|
|
@@ -17642,27 +17308,17 @@ function rule$J(primary) {
|
|
|
17642
17308
|
actual: primary,
|
|
17643
17309
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
17644
17310
|
});
|
|
17645
|
-
if (!validOptions)
|
|
17646
|
-
return;
|
|
17647
|
-
}
|
|
17311
|
+
if (!validOptions) return;
|
|
17648
17312
|
root2.walkDecls((decl) => {
|
|
17649
|
-
if (!decl.value.includes(`(`))
|
|
17650
|
-
return;
|
|
17651
|
-
}
|
|
17313
|
+
if (!decl.value.includes(`(`)) return;
|
|
17652
17314
|
let fix = null;
|
|
17653
17315
|
let hasFixed = false;
|
|
17654
17316
|
let declValue = getDeclarationValue(decl);
|
|
17655
17317
|
let parsedValue = valueParser(declValue);
|
|
17656
17318
|
parsedValue.walk((valueNode) => {
|
|
17657
|
-
if (valueNode.type !== `function`)
|
|
17658
|
-
|
|
17659
|
-
|
|
17660
|
-
if (!isStandardSyntaxFunction(valueNode)) {
|
|
17661
|
-
return;
|
|
17662
|
-
}
|
|
17663
|
-
if (!valueNode.nodes.length) {
|
|
17664
|
-
return;
|
|
17665
|
-
}
|
|
17319
|
+
if (valueNode.type !== `function`) return;
|
|
17320
|
+
if (!isStandardSyntaxFunction(valueNode)) return;
|
|
17321
|
+
if (!valueNode.nodes.length) return;
|
|
17666
17322
|
let functionString = valueParser.stringify(valueNode);
|
|
17667
17323
|
let isSingleLine = isSingleLineString(functionString);
|
|
17668
17324
|
let openingIndex = valueNode.sourceIndex + valueNode.value.length + 1;
|
|
@@ -17724,9 +17380,7 @@ function rule$J(primary) {
|
|
|
17724
17380
|
complain(messages$J.rejectedClosingSingleLine, closingIndex);
|
|
17725
17381
|
}
|
|
17726
17382
|
});
|
|
17727
|
-
if (hasFixed)
|
|
17728
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
17729
|
-
}
|
|
17383
|
+
if (hasFixed) setDeclarationValue(decl, parsedValue.toString());
|
|
17730
17384
|
function complain(message, offset) {
|
|
17731
17385
|
const problemIndex = declarationValueIndex(decl) + offset;
|
|
17732
17386
|
report$y({
|
|
@@ -17754,9 +17408,7 @@ const index$J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17754
17408
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
17755
17409
|
function atRuleParamIndex(atRule2) {
|
|
17756
17410
|
let index2 = 1 + atRule2.name.length;
|
|
17757
|
-
if (atRule2.raws.afterName)
|
|
17758
|
-
index2 += atRule2.raws.afterName.length;
|
|
17759
|
-
}
|
|
17411
|
+
if (atRule2.raws.afterName) index2 += atRule2.raws.afterName.length;
|
|
17760
17412
|
return index2;
|
|
17761
17413
|
}
|
|
17762
17414
|
let { utils: { report: report$x, ruleMessages: ruleMessages$I, validateOptions: validateOptions$I } } = stylelint;
|
|
@@ -17777,9 +17429,7 @@ function rule$I(primary) {
|
|
|
17777
17429
|
actual: primary,
|
|
17778
17430
|
possible: [`always`, `never`]
|
|
17779
17431
|
});
|
|
17780
|
-
if (!validOptions)
|
|
17781
|
-
return;
|
|
17782
|
-
}
|
|
17432
|
+
if (!validOptions) return;
|
|
17783
17433
|
function check(node2, value, nodeIndex, fix) {
|
|
17784
17434
|
styleSearch(
|
|
17785
17435
|
{
|
|
@@ -17794,25 +17444,15 @@ function rule$I(primary) {
|
|
|
17794
17444
|
}
|
|
17795
17445
|
function checkClosingParen(source, index2, node2, nodeIndex, fix) {
|
|
17796
17446
|
let nextChar = source.charAt(index2);
|
|
17797
|
-
if (!nextChar)
|
|
17798
|
-
return;
|
|
17799
|
-
}
|
|
17447
|
+
if (!nextChar) return;
|
|
17800
17448
|
const problemIndex = nodeIndex + index2;
|
|
17801
17449
|
if (primary === `always`) {
|
|
17802
|
-
if (nextChar === ` `)
|
|
17803
|
-
return;
|
|
17804
|
-
}
|
|
17450
|
+
if (nextChar === ` `) return;
|
|
17805
17451
|
if (nextChar === `
|
|
17806
|
-
`)
|
|
17807
|
-
return;
|
|
17808
|
-
}
|
|
17452
|
+
`) return;
|
|
17809
17453
|
if (source.slice(index2, index2 + 2) === `\r
|
|
17810
|
-
`)
|
|
17811
|
-
|
|
17812
|
-
}
|
|
17813
|
-
if (ACCEPTABLE_AFTER_CLOSING_PAREN.has(nextChar)) {
|
|
17814
|
-
return;
|
|
17815
|
-
}
|
|
17454
|
+
`) return;
|
|
17455
|
+
if (ACCEPTABLE_AFTER_CLOSING_PAREN.has(nextChar)) return;
|
|
17816
17456
|
report$x({
|
|
17817
17457
|
message: messages$I.expected,
|
|
17818
17458
|
node: node2,
|
|
@@ -17850,15 +17490,11 @@ function rule$I(primary) {
|
|
|
17850
17490
|
} else if (primary === `never`) {
|
|
17851
17491
|
applyFix = (index2) => {
|
|
17852
17492
|
let whitespaceEndIndex = index2 + 1;
|
|
17853
|
-
while (whitespaceEndIndex < value.length && isWhitespace$1(value.charAt(whitespaceEndIndex)))
|
|
17854
|
-
whitespaceEndIndex++;
|
|
17855
|
-
}
|
|
17493
|
+
while (whitespaceEndIndex < value.length && isWhitespace$1(value.charAt(whitespaceEndIndex))) whitespaceEndIndex++;
|
|
17856
17494
|
fixed += value.slice(lastIndex, index2);
|
|
17857
17495
|
lastIndex = whitespaceEndIndex;
|
|
17858
17496
|
};
|
|
17859
|
-
} else {
|
|
17860
|
-
throw new Error(`Unexpected option: "${primary}"`);
|
|
17861
|
-
}
|
|
17497
|
+
} else throw new Error(`Unexpected option: "${primary}"`);
|
|
17862
17498
|
return {
|
|
17863
17499
|
applyFix,
|
|
17864
17500
|
get hasFixed() {
|
|
@@ -17874,20 +17510,15 @@ function rule$I(primary) {
|
|
|
17874
17510
|
let fixer = createFixer(param);
|
|
17875
17511
|
check(atRule2, param, atRuleParamIndex(atRule2), fixer ? fixer.applyFix : void 0);
|
|
17876
17512
|
if (fixer && fixer.hasFixed) {
|
|
17877
|
-
if (atRule2.raws.params)
|
|
17878
|
-
|
|
17879
|
-
} else {
|
|
17880
|
-
atRule2.params = fixer.fixed;
|
|
17881
|
-
}
|
|
17513
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = fixer.fixed;
|
|
17514
|
+
else atRule2.params = fixer.fixed;
|
|
17882
17515
|
}
|
|
17883
17516
|
});
|
|
17884
17517
|
root2.walkDecls((decl) => {
|
|
17885
17518
|
let value = getDeclarationValue(decl);
|
|
17886
17519
|
let fixer = createFixer(value);
|
|
17887
17520
|
check(decl, value, declarationValueIndex(decl), fixer ? fixer.applyFix : void 0);
|
|
17888
|
-
if (fixer && fixer.hasFixed)
|
|
17889
|
-
setDeclarationValue(decl, fixer.fixed);
|
|
17890
|
-
}
|
|
17521
|
+
if (fixer && fixer.hasFixed) setDeclarationValue(decl, fixer.fixed);
|
|
17891
17522
|
});
|
|
17892
17523
|
};
|
|
17893
17524
|
}
|
|
@@ -17904,9 +17535,7 @@ const index$I = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17904
17535
|
function isStyledSyntaxDeclaration(declaration2) {
|
|
17905
17536
|
let parent = declaration2.parent;
|
|
17906
17537
|
while (parent) {
|
|
17907
|
-
if (parent.raws.styledSyntaxRangeStart !== void 0)
|
|
17908
|
-
return true;
|
|
17909
|
-
}
|
|
17538
|
+
if (parent.raws.styledSyntaxRangeStart !== void 0) return true;
|
|
17910
17539
|
parent = parent.parent;
|
|
17911
17540
|
}
|
|
17912
17541
|
return false;
|
|
@@ -17945,9 +17574,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
17945
17574
|
optional: true
|
|
17946
17575
|
}
|
|
17947
17576
|
);
|
|
17948
|
-
if (!validOptions)
|
|
17949
|
-
return;
|
|
17950
|
-
}
|
|
17577
|
+
if (!validOptions) return;
|
|
17951
17578
|
let spaceCount = isNumber$1(primary) ? primary : null;
|
|
17952
17579
|
let indentChar = spaceCount === null ? ` ` : ` `.repeat(spaceCount);
|
|
17953
17580
|
let warningWord = primary === `tab` ? `tab` : `space`;
|
|
@@ -17967,9 +17594,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
17967
17594
|
let before = (node2.raws.before || ``).replace(/[*_]$/, ``);
|
|
17968
17595
|
let after = typeof node2.raws.after === `string` ? node2.raws.after : ``;
|
|
17969
17596
|
let parent = node2.parent;
|
|
17970
|
-
if (!parent)
|
|
17971
|
-
throw new Error(`A parent node must be present`);
|
|
17972
|
-
}
|
|
17597
|
+
if (!parent) throw new Error(`A parent node must be present`);
|
|
17973
17598
|
let expectedOpeningBraceIndentation = indentChar.repeat(nodeLevel);
|
|
17974
17599
|
let isFirstChild = parent.type === `root` && parent.first === node2;
|
|
17975
17600
|
let lastIndexOfNewline = before.lastIndexOf(`
|
|
@@ -17983,9 +17608,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
17983
17608
|
result: result2,
|
|
17984
17609
|
ruleName: ruleName$H,
|
|
17985
17610
|
fix() {
|
|
17986
|
-
if (isFirstChild && isString(node2.raws.before))
|
|
17987
|
-
node2.raws.before = node2.raws.before.replace(/^[ \t]*(?=\S|$)/, expectedOpeningBraceIndentation);
|
|
17988
|
-
}
|
|
17611
|
+
if (isFirstChild && isString(node2.raws.before)) node2.raws.before = node2.raws.before.replace(/^[ \t]*(?=\S|$)/, expectedOpeningBraceIndentation);
|
|
17989
17612
|
node2.raws.before = fixIndentation(node2.raws.before, expectedOpeningBraceIndentation);
|
|
17990
17613
|
}
|
|
17991
17614
|
});
|
|
@@ -18009,15 +17632,9 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18009
17632
|
}
|
|
18010
17633
|
});
|
|
18011
17634
|
}
|
|
18012
|
-
if (isDeclaration(node2))
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
if (isRule(node2)) {
|
|
18016
|
-
checkSelector(node2, nodeLevel);
|
|
18017
|
-
}
|
|
18018
|
-
if (isAtRule(node2)) {
|
|
18019
|
-
checkAtRuleParams(node2, nodeLevel);
|
|
18020
|
-
}
|
|
17635
|
+
if (isDeclaration(node2)) checkValue(node2, nodeLevel);
|
|
17636
|
+
if (isRule(node2)) checkSelector(node2, nodeLevel);
|
|
17637
|
+
if (isAtRule(node2)) checkAtRuleParams(node2, nodeLevel);
|
|
18021
17638
|
});
|
|
18022
17639
|
function getStyledDeclarationLevel(node2) {
|
|
18023
17640
|
const expressionStartLine = node2.parent.parent.source.input.css.split(`
|
|
@@ -18026,62 +17643,42 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18026
17643
|
return Math.ceil(indentCharacters.length / indentChar.length);
|
|
18027
17644
|
}
|
|
18028
17645
|
function indentationLevel(node2, level = 0) {
|
|
18029
|
-
if (!node2.parent)
|
|
18030
|
-
throw new Error(`A parent node must be present`);
|
|
18031
|
-
}
|
|
17646
|
+
if (!node2.parent) throw new Error(`A parent node must be present`);
|
|
18032
17647
|
if (isStyledSyntaxNode(node2)) {
|
|
18033
17648
|
const isMultilineDeclaration = !!node2.parent.source?.input.css.includes(`
|
|
18034
17649
|
`);
|
|
18035
17650
|
if (isMultilineDeclaration) level++;
|
|
18036
17651
|
level += getStyledDeclarationLevel(node2);
|
|
18037
17652
|
}
|
|
18038
|
-
if (isRoot(node2.parent))
|
|
18039
|
-
return level + getRootBaseIndentLevel(node2.parent, baseIndentLevel, primary);
|
|
18040
|
-
}
|
|
17653
|
+
if (isRoot(node2.parent)) return level + getRootBaseIndentLevel(node2.parent, baseIndentLevel, primary);
|
|
18041
17654
|
let calculatedLevel;
|
|
18042
17655
|
calculatedLevel = indentationLevel(node2.parent, level + 1);
|
|
18043
|
-
if (optionsMatches(secondaryOptions, `except`, `block`) && (isRule(node2) || isAtRule(node2)) && hasBlock(node2))
|
|
18044
|
-
calculatedLevel--;
|
|
18045
|
-
}
|
|
17656
|
+
if (optionsMatches(secondaryOptions, `except`, `block`) && (isRule(node2) || isAtRule(node2)) && hasBlock(node2)) calculatedLevel--;
|
|
18046
17657
|
return calculatedLevel;
|
|
18047
17658
|
}
|
|
18048
17659
|
function checkValue(decl, declLevel) {
|
|
18049
17660
|
if (!decl.value.includes(`
|
|
18050
|
-
`))
|
|
18051
|
-
|
|
18052
|
-
|
|
18053
|
-
if (isStyledSyntaxDeclaration(decl) && decl.value.includes(`\${`)) {
|
|
18054
|
-
return;
|
|
18055
|
-
}
|
|
18056
|
-
if (optionsMatches(secondaryOptions, `ignore`, `value`)) {
|
|
18057
|
-
return;
|
|
18058
|
-
}
|
|
17661
|
+
`)) return;
|
|
17662
|
+
if (isStyledSyntaxDeclaration(decl) && decl.value.includes(`\${`)) return;
|
|
17663
|
+
if (optionsMatches(secondaryOptions, `ignore`, `value`)) return;
|
|
18059
17664
|
let declString = decl.toString();
|
|
18060
17665
|
let valueLevel = optionsMatches(secondaryOptions, `except`, `value`) ? declLevel : declLevel + 1;
|
|
18061
17666
|
checkMultilineBit(declString, valueLevel, decl);
|
|
18062
17667
|
}
|
|
18063
17668
|
function checkSelector(ruleNode, ruleLevel) {
|
|
18064
17669
|
let selector2 = ruleNode.selector;
|
|
18065
|
-
if (ruleNode.params)
|
|
18066
|
-
|
|
18067
|
-
}
|
|
18068
|
-
if (selector2.match(/:\w+\(\s*\r?\n/)) {
|
|
18069
|
-
ruleLevel += 1;
|
|
18070
|
-
}
|
|
17670
|
+
if (ruleNode.params) ruleLevel += 1;
|
|
17671
|
+
if (selector2.match(/:\w+\(\s*\r?\n/)) ruleLevel += 1;
|
|
18071
17672
|
checkMultilineBit(selector2, ruleLevel, ruleNode);
|
|
18072
17673
|
}
|
|
18073
17674
|
function checkAtRuleParams(atRule2, ruleLevel) {
|
|
18074
|
-
if (optionsMatches(secondaryOptions, `ignore`, `param`))
|
|
18075
|
-
return;
|
|
18076
|
-
}
|
|
17675
|
+
if (optionsMatches(secondaryOptions, `ignore`, `param`)) return;
|
|
18077
17676
|
let paramLevel = optionsMatches(secondaryOptions, `except`, `param`) || atRule2.name === `nest` || atRule2.name === `at-root` ? ruleLevel : ruleLevel + 1;
|
|
18078
17677
|
checkMultilineBit(beforeBlockString(atRule2).trim(), paramLevel, atRule2);
|
|
18079
17678
|
}
|
|
18080
17679
|
function checkMultilineBit(source, newlineIndentLevel, node2) {
|
|
18081
17680
|
if (!source.includes(`
|
|
18082
|
-
`))
|
|
18083
|
-
return;
|
|
18084
|
-
}
|
|
17681
|
+
`)) return;
|
|
18085
17682
|
let fixPositions = [];
|
|
18086
17683
|
let parentheticalDepth = 0;
|
|
18087
17684
|
let ignoreInsideParans = optionsMatches(secondaryOptions, `ignore`, `inside-parens`);
|
|
@@ -18095,61 +17692,37 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18095
17692
|
},
|
|
18096
17693
|
(match, matchCount) => {
|
|
18097
17694
|
let precedesClosingParenthesis = /^[ \t]*\)/.test(source.slice(match.startIndex + 1));
|
|
18098
|
-
if (ignoreInsideParans && (precedesClosingParenthesis || match.insideParens))
|
|
18099
|
-
return;
|
|
18100
|
-
}
|
|
17695
|
+
if (ignoreInsideParans && (precedesClosingParenthesis || match.insideParens)) return;
|
|
18101
17696
|
let expectedIndentLevel = newlineIndentLevel;
|
|
18102
17697
|
if (!ignoreInsideParans && match.insideParens) {
|
|
18103
|
-
if (matchCount === 1)
|
|
18104
|
-
parentheticalDepth -= 1;
|
|
18105
|
-
}
|
|
17698
|
+
if (matchCount === 1) parentheticalDepth -= 1;
|
|
18106
17699
|
let newlineIndex = match.startIndex;
|
|
18107
|
-
if (source[match.startIndex - 1] === `\r`)
|
|
18108
|
-
newlineIndex--;
|
|
18109
|
-
}
|
|
17700
|
+
if (source[match.startIndex - 1] === `\r`) newlineIndex--;
|
|
18110
17701
|
let followsOpeningParenthesis = /\([ \t]*$/.test(source.slice(0, newlineIndex));
|
|
18111
|
-
if (followsOpeningParenthesis)
|
|
18112
|
-
parentheticalDepth += 1;
|
|
18113
|
-
}
|
|
17702
|
+
if (followsOpeningParenthesis) parentheticalDepth += 1;
|
|
18114
17703
|
let followsOpeningBrace = /\{[ \t]*$/.test(source.slice(0, newlineIndex));
|
|
18115
|
-
if (followsOpeningBrace)
|
|
18116
|
-
parentheticalDepth += 1;
|
|
18117
|
-
}
|
|
17704
|
+
if (followsOpeningBrace) parentheticalDepth += 1;
|
|
18118
17705
|
let startingClosingBrace = /^[ \t]*\}/.test(source.slice(match.startIndex + 1));
|
|
18119
|
-
if (startingClosingBrace)
|
|
18120
|
-
parentheticalDepth -= 1;
|
|
18121
|
-
}
|
|
17706
|
+
if (startingClosingBrace) parentheticalDepth -= 1;
|
|
18122
17707
|
expectedIndentLevel += parentheticalDepth;
|
|
18123
|
-
if (precedesClosingParenthesis)
|
|
18124
|
-
parentheticalDepth -= 1;
|
|
18125
|
-
}
|
|
17708
|
+
if (precedesClosingParenthesis) parentheticalDepth -= 1;
|
|
18126
17709
|
switch (secondaryOptions.indentInsideParens) {
|
|
18127
17710
|
case `twice`:
|
|
18128
|
-
if (!precedesClosingParenthesis || indentClosingBrace)
|
|
18129
|
-
expectedIndentLevel += 1;
|
|
18130
|
-
}
|
|
17711
|
+
if (!precedesClosingParenthesis || indentClosingBrace) expectedIndentLevel += 1;
|
|
18131
17712
|
break;
|
|
18132
17713
|
case `once-at-root-twice-in-block`:
|
|
18133
17714
|
if (node2.parent === node2.root()) {
|
|
18134
|
-
if (precedesClosingParenthesis && !indentClosingBrace)
|
|
18135
|
-
expectedIndentLevel -= 1;
|
|
18136
|
-
}
|
|
17715
|
+
if (precedesClosingParenthesis && !indentClosingBrace) expectedIndentLevel -= 1;
|
|
18137
17716
|
break;
|
|
18138
17717
|
}
|
|
18139
|
-
if (!precedesClosingParenthesis || indentClosingBrace)
|
|
18140
|
-
expectedIndentLevel += 1;
|
|
18141
|
-
}
|
|
17718
|
+
if (!precedesClosingParenthesis || indentClosingBrace) expectedIndentLevel += 1;
|
|
18142
17719
|
break;
|
|
18143
17720
|
default:
|
|
18144
|
-
if (precedesClosingParenthesis && !indentClosingBrace)
|
|
18145
|
-
expectedIndentLevel -= 1;
|
|
18146
|
-
}
|
|
17721
|
+
if (precedesClosingParenthesis && !indentClosingBrace) expectedIndentLevel -= 1;
|
|
18147
17722
|
}
|
|
18148
17723
|
}
|
|
18149
17724
|
let afterNewlineSpaceMatches = /^([ \t]*)\S/.exec(source.slice(match.startIndex + 1));
|
|
18150
|
-
if (!afterNewlineSpaceMatches)
|
|
18151
|
-
return;
|
|
18152
|
-
}
|
|
17725
|
+
if (!afterNewlineSpaceMatches) return;
|
|
18153
17726
|
let afterNewlineSpace = afterNewlineSpaceMatches[1] || ``;
|
|
18154
17727
|
let expectedIndentation = indentChar.repeat(
|
|
18155
17728
|
expectedIndentLevel > 0 ? expectedIndentLevel : 0
|
|
@@ -18189,9 +17762,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18189
17762
|
if (isDeclaration(node2)) {
|
|
18190
17763
|
let declProp = node2.prop;
|
|
18191
17764
|
let declBetween = node2.raws.between;
|
|
18192
|
-
if (!isString(declBetween))
|
|
18193
|
-
throw new TypeError(`The \`between\` property must be a string`);
|
|
18194
|
-
}
|
|
17765
|
+
if (!isString(declBetween)) throw new TypeError(`The \`between\` property must be a string`);
|
|
18195
17766
|
for (let fixPosition of fixPositions) {
|
|
18196
17767
|
if (fixPosition.startIndex < declProp.length + declBetween.length) {
|
|
18197
17768
|
node2.raws.between = replaceIndentation(
|
|
@@ -18214,9 +17785,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18214
17785
|
let atRuleName = node2.name;
|
|
18215
17786
|
let atRuleAfterName = node2.raws.afterName;
|
|
18216
17787
|
let atRuleParams = node2.params;
|
|
18217
|
-
if (!isString(atRuleAfterName))
|
|
18218
|
-
throw new TypeError(`The \`afterName\` property must be a string`);
|
|
18219
|
-
}
|
|
17788
|
+
if (!isString(atRuleAfterName)) throw new TypeError(`The \`afterName\` property must be a string`);
|
|
18220
17789
|
for (let fixPosition of fixPositions) {
|
|
18221
17790
|
if (fixPosition.startIndex < 1 + atRuleName.length + atRuleAfterName.length) {
|
|
18222
17791
|
node2.raws.afterName = replaceIndentation(
|
|
@@ -18241,38 +17810,26 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18241
17810
|
}
|
|
18242
17811
|
function getRootBaseIndentLevel(root2, baseIndentLevel, space) {
|
|
18243
17812
|
let document2 = getDocument(root2);
|
|
18244
|
-
if (!document2)
|
|
18245
|
-
|
|
18246
|
-
}
|
|
18247
|
-
if (!root2.source) {
|
|
18248
|
-
throw new Error(`The root node must have a source`);
|
|
18249
|
-
}
|
|
17813
|
+
if (!document2) return 0;
|
|
17814
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
18250
17815
|
let source = root2.source;
|
|
18251
17816
|
let indentLevel = source.baseIndentLevel;
|
|
18252
|
-
if (isNumber$1(indentLevel) && Number.isSafeInteger(indentLevel))
|
|
18253
|
-
return indentLevel;
|
|
18254
|
-
}
|
|
17817
|
+
if (isNumber$1(indentLevel) && Number.isSafeInteger(indentLevel)) return indentLevel;
|
|
18255
17818
|
let newIndentLevel = inferRootIndentLevel(root2, baseIndentLevel, () => inferDocIndentSize(document2, space));
|
|
18256
17819
|
source.baseIndentLevel = newIndentLevel;
|
|
18257
17820
|
return newIndentLevel;
|
|
18258
17821
|
}
|
|
18259
17822
|
function getDocument(node2) {
|
|
18260
17823
|
let document2 = node2.document;
|
|
18261
|
-
if (document2)
|
|
18262
|
-
return document2;
|
|
18263
|
-
}
|
|
17824
|
+
if (document2) return document2;
|
|
18264
17825
|
let root2 = node2.root();
|
|
18265
17826
|
return root2 && root2.document;
|
|
18266
17827
|
}
|
|
18267
17828
|
function inferDocIndentSize(document2, space) {
|
|
18268
|
-
if (!document2.source)
|
|
18269
|
-
throw new Error(`The document node must have a source`);
|
|
18270
|
-
}
|
|
17829
|
+
if (!document2.source) throw new Error(`The document node must have a source`);
|
|
18271
17830
|
let docSource = document2.source;
|
|
18272
17831
|
let indentSize = docSource.indentSize;
|
|
18273
|
-
if (isNumber$1(indentSize) && Number.isSafeInteger(indentSize))
|
|
18274
|
-
return indentSize;
|
|
18275
|
-
}
|
|
17832
|
+
if (isNumber$1(indentSize) && Number.isSafeInteger(indentSize)) return indentSize;
|
|
18276
17833
|
let source = document2.source.input.css;
|
|
18277
17834
|
let indents = source.match(/^ *(?=\S)/gm);
|
|
18278
17835
|
if (indents) {
|
|
@@ -18281,23 +17838,16 @@ function inferDocIndentSize(document2, space) {
|
|
|
18281
17838
|
lastIndentSize = Math.abs(leadingSpacesLength - lastLeadingSpacesLength) || lastIndentSize;
|
|
18282
17839
|
if (lastIndentSize > 1) {
|
|
18283
17840
|
let score = scores.get(lastIndentSize);
|
|
18284
|
-
if (score)
|
|
18285
|
-
|
|
18286
|
-
} else {
|
|
18287
|
-
scores.set(lastIndentSize, 1);
|
|
18288
|
-
}
|
|
17841
|
+
if (score) scores.set(lastIndentSize, score + 1);
|
|
17842
|
+
else scores.set(lastIndentSize, 1);
|
|
18289
17843
|
}
|
|
18290
|
-
} else
|
|
18291
|
-
lastIndentSize = 0;
|
|
18292
|
-
}
|
|
17844
|
+
} else lastIndentSize = 0;
|
|
18293
17845
|
lastLeadingSpacesLength = leadingSpacesLength;
|
|
18294
17846
|
};
|
|
18295
17847
|
let scores = /* @__PURE__ */ new Map();
|
|
18296
17848
|
let lastIndentSize = 0;
|
|
18297
17849
|
let lastLeadingSpacesLength = 0;
|
|
18298
|
-
for (let leadingSpaces of indents)
|
|
18299
|
-
vote(leadingSpaces.length);
|
|
18300
|
-
}
|
|
17850
|
+
for (let leadingSpaces of indents) vote(leadingSpaces.length);
|
|
18301
17851
|
let bestScore = 0;
|
|
18302
17852
|
for (let [indentSizeDate, score] of scores.entries()) {
|
|
18303
17853
|
if (score > bestScore) {
|
|
@@ -18320,25 +17870,17 @@ function inferRootIndentLevel(root2, baseIndentLevel, indentSize) {
|
|
|
18320
17870
|
}
|
|
18321
17871
|
let newBaseIndentLevel = 0;
|
|
18322
17872
|
if (!isNumber$1(baseIndentLevel) || !Number.isSafeInteger(baseIndentLevel)) {
|
|
18323
|
-
if (!root2.source)
|
|
18324
|
-
throw new Error(`The root node must have a source`);
|
|
18325
|
-
}
|
|
17873
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
18326
17874
|
let source = root2.source.input.css;
|
|
18327
17875
|
source = source.replace(/^[^\r\n]+/, (firstLine) => {
|
|
18328
17876
|
let match = root2.raws.codeBefore && /(?:^|\n)([ \t]*)$/.exec(root2.raws.codeBefore);
|
|
18329
|
-
if (match)
|
|
18330
|
-
return match[1] + firstLine;
|
|
18331
|
-
}
|
|
17877
|
+
if (match) return match[1] + firstLine;
|
|
18332
17878
|
return ``;
|
|
18333
17879
|
});
|
|
18334
17880
|
let indentions = source.match(/^[ \t]*(?=\S)/gm);
|
|
18335
|
-
if (indentions)
|
|
18336
|
-
return Math.min(...indentions.map((indent) => getIndentLevel(indent)));
|
|
18337
|
-
}
|
|
17881
|
+
if (indentions) return Math.min(...indentions.map((indent) => getIndentLevel(indent)));
|
|
18338
17882
|
newBaseIndentLevel = 1;
|
|
18339
|
-
} else
|
|
18340
|
-
newBaseIndentLevel = baseIndentLevel;
|
|
18341
|
-
}
|
|
17883
|
+
} else newBaseIndentLevel = baseIndentLevel;
|
|
18342
17884
|
let indents = [];
|
|
18343
17885
|
let foundIndents = root2.raws.codeBefore?.match(/(?:^|\n)([\t ]*)\S/gm);
|
|
18344
17886
|
if (foundIndents) {
|
|
@@ -18365,28 +17907,18 @@ function inferRootIndentLevel(root2, baseIndentLevel, indentSize) {
|
|
|
18365
17907
|
afterEnd = nextRoot ? nextRoot.raws.codeBefore : document2.raws.codeAfter;
|
|
18366
17908
|
} else {
|
|
18367
17909
|
let parent = root2.parent;
|
|
18368
|
-
if (!parent)
|
|
18369
|
-
throw new Error(`The root node must have a parent`);
|
|
18370
|
-
}
|
|
17910
|
+
if (!parent) throw new Error(`The root node must have a parent`);
|
|
18371
17911
|
let nextRoot = parent.nodes[parent.nodes.indexOf(root2) + 1];
|
|
18372
17912
|
afterEnd = nextRoot ? nextRoot.raws.codeBefore : root2.raws.codeAfter;
|
|
18373
17913
|
}
|
|
18374
|
-
} else
|
|
18375
|
-
|
|
18376
|
-
}
|
|
18377
|
-
if (afterEnd) {
|
|
18378
|
-
indents.push(afterEnd.match(/^[ \t]*/)[0]);
|
|
18379
|
-
}
|
|
18380
|
-
}
|
|
18381
|
-
if (indents.length) {
|
|
18382
|
-
return Math.max(...indents.map((indent) => getIndentLevel(indent))) + newBaseIndentLevel;
|
|
17914
|
+
} else afterEnd = after;
|
|
17915
|
+
if (afterEnd) indents.push(afterEnd.match(/^[ \t]*/)[0]);
|
|
18383
17916
|
}
|
|
17917
|
+
if (indents.length) return Math.max(...indents.map((indent) => getIndentLevel(indent))) + newBaseIndentLevel;
|
|
18384
17918
|
return newBaseIndentLevel;
|
|
18385
17919
|
}
|
|
18386
17920
|
function fixIndentation(str, whitespace) {
|
|
18387
|
-
if (!isString(str))
|
|
18388
|
-
return str;
|
|
18389
|
-
}
|
|
17921
|
+
if (!isString(str)) return str;
|
|
18390
17922
|
return str.replace(/\n[ \t]*(?=\S|$)/g, `
|
|
18391
17923
|
${whitespace}`);
|
|
18392
17924
|
}
|
|
@@ -18422,42 +17954,24 @@ function rule$G(primary) {
|
|
|
18422
17954
|
actual: primary,
|
|
18423
17955
|
possible: [`unix`, `windows`]
|
|
18424
17956
|
});
|
|
18425
|
-
if (!validOptions)
|
|
18426
|
-
return;
|
|
18427
|
-
}
|
|
17957
|
+
if (!validOptions) return;
|
|
18428
17958
|
let shouldHaveCR = primary === `windows`;
|
|
18429
17959
|
function fix() {
|
|
18430
17960
|
root2.walk((node2) => {
|
|
18431
|
-
if (`selector` in node2)
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
if (
|
|
18435
|
-
|
|
18436
|
-
}
|
|
18437
|
-
if (`text` in node2) {
|
|
18438
|
-
node2.text = fixData(node2.text);
|
|
18439
|
-
}
|
|
18440
|
-
if (node2.raws.before) {
|
|
18441
|
-
node2.raws.before = fixData(node2.raws.before);
|
|
18442
|
-
}
|
|
18443
|
-
if (typeof node2.raws.after === `string`) {
|
|
18444
|
-
node2.raws.after = fixData(node2.raws.after);
|
|
18445
|
-
}
|
|
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);
|
|
18446
17966
|
});
|
|
18447
|
-
if (typeof root2.raws.after === `string`)
|
|
18448
|
-
root2.raws.after = fixData(root2.raws.after);
|
|
18449
|
-
}
|
|
18450
|
-
}
|
|
18451
|
-
if (root2.source === null) {
|
|
18452
|
-
throw new Error(`The root node must have a source`);
|
|
17967
|
+
if (typeof root2.raws.after === `string`) root2.raws.after = fixData(root2.raws.after);
|
|
18453
17968
|
}
|
|
17969
|
+
if (root2.source === null) throw new Error(`The root node must have a source`);
|
|
18454
17970
|
let lines = root2.source.input.css.split(`
|
|
18455
17971
|
`);
|
|
18456
17972
|
for (let [i2, line] of lines.entries()) {
|
|
18457
|
-
if (i2 < lines.length - 1 && !line.includes(`\r`))
|
|
18458
|
-
line += `
|
|
17973
|
+
if (i2 < lines.length - 1 && !line.includes(`\r`)) line += `
|
|
18459
17974
|
`;
|
|
18460
|
-
}
|
|
18461
17975
|
if (hasError(line)) {
|
|
18462
17976
|
let lineNum = i2 + 1;
|
|
18463
17977
|
let colNum = line.length;
|
|
@@ -18472,10 +17986,8 @@ function rule$G(primary) {
|
|
|
18472
17986
|
function fixData(data) {
|
|
18473
17987
|
if (data) {
|
|
18474
17988
|
let res = data.replace(/\r/g, ``);
|
|
18475
|
-
if (shouldHaveCR)
|
|
18476
|
-
res = res.replace(/\n/g, `\r
|
|
17989
|
+
if (shouldHaveCR) res = res.replace(/\n/g, `\r
|
|
18477
17990
|
`);
|
|
18478
|
-
}
|
|
18479
17991
|
return res;
|
|
18480
17992
|
}
|
|
18481
17993
|
return data;
|
|
@@ -18537,9 +18049,7 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18537
18049
|
optional: true
|
|
18538
18050
|
}
|
|
18539
18051
|
);
|
|
18540
|
-
if (!validOptions)
|
|
18541
|
-
return;
|
|
18542
|
-
}
|
|
18052
|
+
if (!validOptions) return;
|
|
18543
18053
|
let ignoreComments = optionsMatches(secondaryOptions, `ignore`, `comments`);
|
|
18544
18054
|
let getChars = replaceEmptyLines.bind(null, primary);
|
|
18545
18055
|
function fix() {
|
|
@@ -18548,16 +18058,12 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18548
18058
|
node2.raws.left = getChars(node2.raws.left);
|
|
18549
18059
|
node2.raws.right = getChars(node2.raws.right);
|
|
18550
18060
|
}
|
|
18551
|
-
if (node2.raws.before)
|
|
18552
|
-
node2.raws.before = getChars(node2.raws.before);
|
|
18553
|
-
}
|
|
18061
|
+
if (node2.raws.before) node2.raws.before = getChars(node2.raws.before);
|
|
18554
18062
|
});
|
|
18555
18063
|
let firstNodeRawsBefore = root2.first && root2.first.raws.before;
|
|
18556
18064
|
let rootRawsAfter = root2.raws.after;
|
|
18557
18065
|
if ((root2.document && root2.document.constructor.name) !== `Document`) {
|
|
18558
|
-
if (firstNodeRawsBefore)
|
|
18559
|
-
root2.first.raws.before = getChars(firstNodeRawsBefore, true);
|
|
18560
|
-
}
|
|
18066
|
+
if (firstNodeRawsBefore) root2.first.raws.before = getChars(firstNodeRawsBefore, true);
|
|
18561
18067
|
if (rootRawsAfter) {
|
|
18562
18068
|
root2.raws.after = replaceEmptyLines(primary === 0 ? 1 : primary, rootRawsAfter, true);
|
|
18563
18069
|
}
|
|
@@ -18583,18 +18089,11 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18583
18089
|
function checkMatch(source, matchStartIndex, matchEndIndex, node2) {
|
|
18584
18090
|
let eof = matchEndIndex === source.length;
|
|
18585
18091
|
let problem = false;
|
|
18586
|
-
if (!matchStartIndex || lastIndex === matchStartIndex)
|
|
18587
|
-
|
|
18588
|
-
} else {
|
|
18589
|
-
emptyLines = 0;
|
|
18590
|
-
}
|
|
18092
|
+
if (!matchStartIndex || lastIndex === matchStartIndex) emptyLines++;
|
|
18093
|
+
else emptyLines = 0;
|
|
18591
18094
|
lastIndex = matchEndIndex;
|
|
18592
|
-
if (emptyLines > primary)
|
|
18593
|
-
|
|
18594
|
-
}
|
|
18595
|
-
if (!eof && !problem) {
|
|
18596
|
-
return;
|
|
18597
|
-
}
|
|
18095
|
+
if (emptyLines > primary) problem = true;
|
|
18096
|
+
if (!eof && !problem) return;
|
|
18598
18097
|
if (problem) {
|
|
18599
18098
|
report$u({
|
|
18600
18099
|
message: messages$F.expected,
|
|
@@ -18625,35 +18124,26 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18625
18124
|
}
|
|
18626
18125
|
function replaceEmptyLines(maxLines, str, isSpecialCase = false) {
|
|
18627
18126
|
let repeatTimes = isSpecialCase ? maxLines : maxLines + 1;
|
|
18628
|
-
if (repeatTimes === 0 || typeof str !== `string`)
|
|
18629
|
-
return ``;
|
|
18630
|
-
}
|
|
18127
|
+
if (repeatTimes === 0 || typeof str !== `string`) return ``;
|
|
18631
18128
|
let emptyLFLines = `
|
|
18632
18129
|
`.repeat(repeatTimes);
|
|
18633
18130
|
let emptyCRLFLines = `\r
|
|
18634
18131
|
`.repeat(repeatTimes);
|
|
18635
18132
|
return /(?:\r\n)+/.test(str) ? str.replace(/(\r\n)+/g, ($1) => {
|
|
18636
|
-
if ($1.length / 2 > repeatTimes)
|
|
18637
|
-
return emptyCRLFLines;
|
|
18638
|
-
}
|
|
18133
|
+
if ($1.length / 2 > repeatTimes) return emptyCRLFLines;
|
|
18639
18134
|
return $1;
|
|
18640
18135
|
}) : str.replace(/(\n)+/g, ($1) => {
|
|
18641
|
-
if ($1.length > repeatTimes)
|
|
18642
|
-
return emptyLFLines;
|
|
18643
|
-
}
|
|
18136
|
+
if ($1.length > repeatTimes) return emptyLFLines;
|
|
18644
18137
|
return $1;
|
|
18645
18138
|
});
|
|
18646
18139
|
}
|
|
18647
18140
|
};
|
|
18648
18141
|
}
|
|
18649
18142
|
function isEofNode(document2, root2) {
|
|
18650
|
-
if (!document2 || document2.constructor.name !== `Document` || !(`type` in document2))
|
|
18651
|
-
return true;
|
|
18652
|
-
}
|
|
18143
|
+
if (!document2 || document2.constructor.name !== `Document` || !(`type` in document2)) return true;
|
|
18653
18144
|
let after;
|
|
18654
|
-
if (root2 === document2.last)
|
|
18655
|
-
|
|
18656
|
-
} else {
|
|
18145
|
+
if (root2 === document2.last) after = document2.raws && document2.raws.codeAfter;
|
|
18146
|
+
else {
|
|
18657
18147
|
let rootIndex = document2.index(root2);
|
|
18658
18148
|
let nextNode = document2.nodes[rootIndex + 1];
|
|
18659
18149
|
after = nextNode && nextNode.raws && nextNode.raws.codeBefore;
|
|
@@ -18697,12 +18187,8 @@ function rule$E(primary, secondaryOptions) {
|
|
|
18697
18187
|
optional: true
|
|
18698
18188
|
}
|
|
18699
18189
|
);
|
|
18700
|
-
if (!validOptions)
|
|
18701
|
-
|
|
18702
|
-
}
|
|
18703
|
-
if (root2.source === null) {
|
|
18704
|
-
throw new Error(`The root node must have a source`);
|
|
18705
|
-
}
|
|
18190
|
+
if (!validOptions) return;
|
|
18191
|
+
if (root2.source === null) throw new Error(`The root node must have a source`);
|
|
18706
18192
|
let EXCLUDED_PATTERNS = [
|
|
18707
18193
|
/url\(\s*(\S.*\S)\s*\)/gi,
|
|
18708
18194
|
// allow tab, whitespace in url content
|
|
@@ -18739,57 +18225,35 @@ function rule$E(primary, secondaryOptions) {
|
|
|
18739
18225
|
let skippedSubString = skippedSubStrings[skippedSubStringsIndex];
|
|
18740
18226
|
assert(skippedSubString);
|
|
18741
18227
|
let [startSubString, endSubString] = skippedSubString;
|
|
18742
|
-
if (end < startSubString)
|
|
18743
|
-
return 0;
|
|
18744
|
-
}
|
|
18228
|
+
if (end < startSubString) return 0;
|
|
18745
18229
|
let excluded = Math.min(end, endSubString) - Math.max(start, startSubString);
|
|
18746
|
-
if (endSubString <= end)
|
|
18747
|
-
skippedSubStringsIndex++;
|
|
18748
|
-
}
|
|
18230
|
+
if (endSubString <= end) skippedSubStringsIndex++;
|
|
18749
18231
|
return excluded;
|
|
18750
18232
|
}
|
|
18751
18233
|
function checkNewline(match) {
|
|
18752
18234
|
let nextNewlineIndex = rootString.indexOf(`
|
|
18753
18235
|
`, match.endIndex);
|
|
18754
|
-
if (rootString[nextNewlineIndex - 1] === `\r`)
|
|
18755
|
-
|
|
18756
|
-
}
|
|
18757
|
-
if (nextNewlineIndex === -1) {
|
|
18758
|
-
nextNewlineIndex = rootString.length;
|
|
18759
|
-
}
|
|
18236
|
+
if (rootString[nextNewlineIndex - 1] === `\r`) nextNewlineIndex -= 1;
|
|
18237
|
+
if (nextNewlineIndex === -1) nextNewlineIndex = rootString.length;
|
|
18760
18238
|
let rawLineLength = nextNewlineIndex - match.endIndex;
|
|
18761
18239
|
let excludedLength = skippedSubStrings[skippedSubStringsIndex] ? tryToPopSubString(match.endIndex, nextNewlineIndex) : 0;
|
|
18762
18240
|
let lineText = rootString.slice(match.endIndex, nextNewlineIndex);
|
|
18763
|
-
if (optionsMatches(secondaryOptions, `ignorePattern`, lineText))
|
|
18764
|
-
|
|
18765
|
-
}
|
|
18766
|
-
if (rawLineLength - excludedLength <= primary) {
|
|
18767
|
-
return;
|
|
18768
|
-
}
|
|
18241
|
+
if (optionsMatches(secondaryOptions, `ignorePattern`, lineText)) return;
|
|
18242
|
+
if (rawLineLength - excludedLength <= primary) return;
|
|
18769
18243
|
let complaintIndex = nextNewlineIndex - 1;
|
|
18770
18244
|
if (ignoreComments) {
|
|
18771
|
-
if (`insideComment` in match && match.insideComment)
|
|
18772
|
-
return;
|
|
18773
|
-
}
|
|
18245
|
+
if (`insideComment` in match && match.insideComment) return;
|
|
18774
18246
|
let nextTwoChars = rootString.slice(match.endIndex).trim().slice(0, 2);
|
|
18775
|
-
if (nextTwoChars === `/*` || nextTwoChars === `//`)
|
|
18776
|
-
return;
|
|
18777
|
-
}
|
|
18247
|
+
if (nextTwoChars === `/*` || nextTwoChars === `//`) return;
|
|
18778
18248
|
}
|
|
18779
18249
|
if (ignoreNonComments) {
|
|
18780
|
-
if (`insideComment` in match && match.insideComment)
|
|
18781
|
-
return complain(complaintIndex);
|
|
18782
|
-
}
|
|
18250
|
+
if (`insideComment` in match && match.insideComment) return complain(complaintIndex);
|
|
18783
18251
|
let nextTwoChars = rootString.slice(match.endIndex).trim().slice(0, 2);
|
|
18784
|
-
if (nextTwoChars !== `/*` && nextTwoChars !== `//`)
|
|
18785
|
-
return;
|
|
18786
|
-
}
|
|
18252
|
+
if (nextTwoChars !== `/*` && nextTwoChars !== `//`) return;
|
|
18787
18253
|
return complain(complaintIndex);
|
|
18788
18254
|
}
|
|
18789
18255
|
let lineString = rootString.slice(match.endIndex, nextNewlineIndex);
|
|
18790
|
-
if (!lineString.replace(/^\s+/, ``).includes(` `))
|
|
18791
|
-
return;
|
|
18792
|
-
}
|
|
18256
|
+
if (!lineString.replace(/^\s+/, ``).includes(` `)) return;
|
|
18793
18257
|
return complain(complaintIndex);
|
|
18794
18258
|
}
|
|
18795
18259
|
};
|
|
@@ -18849,9 +18313,7 @@ function rule$D(primary) {
|
|
|
18849
18313
|
actual: primary,
|
|
18850
18314
|
possible: [`always`, `never`]
|
|
18851
18315
|
});
|
|
18852
|
-
if (!validOptions)
|
|
18853
|
-
return;
|
|
18854
|
-
}
|
|
18316
|
+
if (!validOptions) return;
|
|
18855
18317
|
let fixData;
|
|
18856
18318
|
mediaFeatureColonSpaceChecker({
|
|
18857
18319
|
root: root2,
|
|
@@ -18873,17 +18335,11 @@ function rule$D(primary) {
|
|
|
18873
18335
|
for (let index2 of colonIndices.sort((a2, b2) => b2 - a2)) {
|
|
18874
18336
|
let beforeColon = params.slice(0, index2 + 1);
|
|
18875
18337
|
let afterColon = params.slice(index2 + 1);
|
|
18876
|
-
if (primary === `always`)
|
|
18877
|
-
|
|
18878
|
-
} else if (primary === `never`) {
|
|
18879
|
-
params = beforeColon + afterColon.replace(/^\s*/, ``);
|
|
18880
|
-
}
|
|
18881
|
-
}
|
|
18882
|
-
if (atRule2.raws.params) {
|
|
18883
|
-
atRule2.raws.params.raw = params;
|
|
18884
|
-
} else {
|
|
18885
|
-
atRule2.params = params;
|
|
18338
|
+
if (primary === `always`) params = beforeColon + afterColon.replace(/^\s*/, ` `);
|
|
18339
|
+
else if (primary === `never`) params = beforeColon + afterColon.replace(/^\s*/, ``);
|
|
18886
18340
|
}
|
|
18341
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
18342
|
+
else atRule2.params = params;
|
|
18887
18343
|
}
|
|
18888
18344
|
}
|
|
18889
18345
|
};
|
|
@@ -18916,9 +18372,7 @@ function rule$C(primary) {
|
|
|
18916
18372
|
actual: primary,
|
|
18917
18373
|
possible: [`always`, `never`]
|
|
18918
18374
|
});
|
|
18919
|
-
if (!validOptions)
|
|
18920
|
-
return;
|
|
18921
|
-
}
|
|
18375
|
+
if (!validOptions) return;
|
|
18922
18376
|
let fixData;
|
|
18923
18377
|
mediaFeatureColonSpaceChecker({
|
|
18924
18378
|
root: root2,
|
|
@@ -18940,17 +18394,11 @@ function rule$C(primary) {
|
|
|
18940
18394
|
for (let index2 of colonIndices.sort((a2, b2) => b2 - a2)) {
|
|
18941
18395
|
let beforeColon = params.slice(0, index2);
|
|
18942
18396
|
let afterColon = params.slice(index2);
|
|
18943
|
-
if (primary === `always`)
|
|
18944
|
-
|
|
18945
|
-
} else if (primary === `never`) {
|
|
18946
|
-
params = beforeColon.replace(/\s*$/, ``) + afterColon;
|
|
18947
|
-
}
|
|
18948
|
-
}
|
|
18949
|
-
if (atRule2.raws.params) {
|
|
18950
|
-
atRule2.raws.params.raw = params;
|
|
18951
|
-
} else {
|
|
18952
|
-
atRule2.params = params;
|
|
18397
|
+
if (primary === `always`) params = beforeColon.replace(/\s*$/, ` `) + afterColon;
|
|
18398
|
+
else if (primary === `never`) params = beforeColon.replace(/\s*$/, ``) + afterColon;
|
|
18953
18399
|
}
|
|
18400
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
18401
|
+
else atRule2.params = params;
|
|
18954
18402
|
}
|
|
18955
18403
|
}
|
|
18956
18404
|
};
|
|
@@ -20956,9 +20404,7 @@ function findMediaFeatureNames(mediaQueryParams, callback) {
|
|
|
20956
20404
|
let tokens = tokenize$1({ css: mediaQueryParams });
|
|
20957
20405
|
let list = parseCommaSeparatedListOfComponentValues(tokens);
|
|
20958
20406
|
let mediaQueryConditions = list.flatMap((listItem) => listItem.flatMap((componentValue) => {
|
|
20959
|
-
if (!isSimpleBlockNode(componentValue) || componentValue.startToken[0] !== c.OpenParen)
|
|
20960
|
-
return [];
|
|
20961
|
-
}
|
|
20407
|
+
if (!isSimpleBlockNode(componentValue) || componentValue.startToken[0] !== c.OpenParen) return [];
|
|
20962
20408
|
let blockTokens = componentValue.tokens();
|
|
20963
20409
|
let mediaQueryList = parseFromTokens(blockTokens, {
|
|
20964
20410
|
preserveInvalidMediaQueries: true
|
|
@@ -20969,24 +20415,18 @@ function findMediaFeatureNames(mediaQueryParams, callback) {
|
|
|
20969
20415
|
mediaQuery.walk(({ node: node2 }) => {
|
|
20970
20416
|
if (isMediaFeature(node2)) {
|
|
20971
20417
|
let token = node2.getNameToken();
|
|
20972
|
-
if (token[0] !== c.Ident)
|
|
20973
|
-
return;
|
|
20974
|
-
}
|
|
20418
|
+
if (token[0] !== c.Ident) return;
|
|
20975
20419
|
callback(token);
|
|
20976
20420
|
}
|
|
20977
20421
|
if (isGeneralEnclosed(node2)) {
|
|
20978
20422
|
topLevelTokenNodes(node2).forEach((token, i2, topLevelTokens) => {
|
|
20979
|
-
if (token[0] !== c.Ident)
|
|
20980
|
-
return;
|
|
20981
|
-
}
|
|
20423
|
+
if (token[0] !== c.Ident) return;
|
|
20982
20424
|
let nextToken = topLevelTokens[i2 + 1];
|
|
20983
20425
|
let prevToken = topLevelTokens[i2 - 1];
|
|
20984
20426
|
if (
|
|
20985
20427
|
// Media Feature
|
|
20986
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)
|
|
20987
|
-
)
|
|
20988
|
-
callback(token);
|
|
20989
|
-
}
|
|
20429
|
+
) callback(token);
|
|
20990
20430
|
});
|
|
20991
20431
|
}
|
|
20992
20432
|
});
|
|
@@ -20999,9 +20439,7 @@ function findMediaFeatureNames(mediaQueryParams, callback) {
|
|
|
20999
20439
|
}
|
|
21000
20440
|
function topLevelTokenNodes(node2) {
|
|
21001
20441
|
let components = node2.value.value;
|
|
21002
|
-
if (isToken(components) || components.length === 0 || isToken(components[0]))
|
|
21003
|
-
return [];
|
|
21004
|
-
}
|
|
20442
|
+
if (isToken(components) || components.length === 0 || isToken(components[0])) return [];
|
|
21005
20443
|
let relevantTokens = [];
|
|
21006
20444
|
let lastWasDollarSign = false;
|
|
21007
20445
|
components.forEach((component) => {
|
|
@@ -21038,22 +20476,16 @@ function rule$B(primary) {
|
|
|
21038
20476
|
actual: primary,
|
|
21039
20477
|
possible: [`lower`, `upper`]
|
|
21040
20478
|
});
|
|
21041
|
-
if (!validOptions)
|
|
21042
|
-
return;
|
|
21043
|
-
}
|
|
20479
|
+
if (!validOptions) return;
|
|
21044
20480
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21045
20481
|
let hasComments = atRule2.raws.params?.raw;
|
|
21046
20482
|
let mediaRule = hasComments ? hasComments : atRule2.params;
|
|
21047
20483
|
let hasFixes = false;
|
|
21048
20484
|
mediaRule = findMediaFeatureNames(mediaRule, (mediaFeatureNameToken) => {
|
|
21049
20485
|
let [, , startIndex, endIndex, { value: featureName }] = mediaFeatureNameToken;
|
|
21050
|
-
if (isCustomMediaQuery(featureName))
|
|
21051
|
-
return;
|
|
21052
|
-
}
|
|
20486
|
+
if (isCustomMediaQuery(featureName)) return;
|
|
21053
20487
|
let expectedFeatureName = primary === `lower` ? featureName.toLowerCase() : featureName.toUpperCase();
|
|
21054
|
-
if (featureName === expectedFeatureName)
|
|
21055
|
-
return;
|
|
21056
|
-
}
|
|
20488
|
+
if (featureName === expectedFeatureName) return;
|
|
21057
20489
|
let atRuleIndex = atRuleParamIndex(atRule2);
|
|
21058
20490
|
report$r({
|
|
21059
20491
|
message: messages$B.expected,
|
|
@@ -21071,13 +20503,9 @@ function rule$B(primary) {
|
|
|
21071
20503
|
}).stringify();
|
|
21072
20504
|
if (hasFixes) {
|
|
21073
20505
|
if (hasComments) {
|
|
21074
|
-
if (atRule2.raws.params === null)
|
|
21075
|
-
throw new Error(`The \`AtRuleRaws\` node must have a \`params\` property`);
|
|
21076
|
-
}
|
|
20506
|
+
if (atRule2.raws.params === null) throw new Error(`The \`AtRuleRaws\` node must have a \`params\` property`);
|
|
21077
20507
|
atRule2.raws.params.raw = mediaRule;
|
|
21078
|
-
} else
|
|
21079
|
-
atRule2.params = mediaRule;
|
|
21080
|
-
}
|
|
20508
|
+
} else atRule2.params = mediaRule;
|
|
21081
20509
|
}
|
|
21082
20510
|
});
|
|
21083
20511
|
};
|
|
@@ -21111,9 +20539,7 @@ function rule$A(primary) {
|
|
|
21111
20539
|
actual: primary,
|
|
21112
20540
|
possible: [`always`, `never`]
|
|
21113
20541
|
});
|
|
21114
|
-
if (!validOptions)
|
|
21115
|
-
return;
|
|
21116
|
-
}
|
|
20542
|
+
if (!validOptions) return;
|
|
21117
20543
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21118
20544
|
let params = atRule2.raws.params && atRule2.raws.params.raw || atRule2.params;
|
|
21119
20545
|
let indexBoost = atRuleParamIndex(atRule2);
|
|
@@ -21174,9 +20600,7 @@ function rule$A(primary) {
|
|
|
21174
20600
|
fix: err.fix
|
|
21175
20601
|
});
|
|
21176
20602
|
}
|
|
21177
|
-
if (problems.some((problem) => problem.fix))
|
|
21178
|
-
atRule2.params = parsedParams.toString();
|
|
21179
|
-
}
|
|
20603
|
+
if (problems.some((problem) => problem.fix)) atRule2.params = parsedParams.toString();
|
|
21180
20604
|
}
|
|
21181
20605
|
});
|
|
21182
20606
|
};
|
|
@@ -21193,15 +20617,11 @@ const index$A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
21193
20617
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
21194
20618
|
let rangeOperators = [`>=`, `<=`, `>`, `<`, `=`];
|
|
21195
20619
|
function findMediaOperator(atRule2, cb) {
|
|
21196
|
-
if (atRule2.name.toLowerCase() !== `media`)
|
|
21197
|
-
return;
|
|
21198
|
-
}
|
|
20620
|
+
if (atRule2.name.toLowerCase() !== `media`) return;
|
|
21199
20621
|
let params = atRule2.raws.params ? atRule2.raws.params.raw : atRule2.params;
|
|
21200
20622
|
styleSearch({ source: params, target: rangeOperators }, (match) => {
|
|
21201
20623
|
let before = params[match.startIndex - 1];
|
|
21202
|
-
if (before === `>` || before === `<`)
|
|
21203
|
-
return;
|
|
21204
|
-
}
|
|
20624
|
+
if (before === `>` || before === `<`) return;
|
|
21205
20625
|
cb(match, params, atRule2);
|
|
21206
20626
|
});
|
|
21207
20627
|
}
|
|
@@ -21223,9 +20643,7 @@ function rule$z(primary) {
|
|
|
21223
20643
|
actual: primary,
|
|
21224
20644
|
possible: [`always`, `never`]
|
|
21225
20645
|
});
|
|
21226
|
-
if (!validOptions)
|
|
21227
|
-
return;
|
|
21228
|
-
}
|
|
20646
|
+
if (!validOptions) return;
|
|
21229
20647
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21230
20648
|
let fixOperatorIndices = [];
|
|
21231
20649
|
findMediaOperator(atRule2, (match, params, node2) => {
|
|
@@ -21254,17 +20672,11 @@ function rule$z(primary) {
|
|
|
21254
20672
|
for (let index2 of fixOperatorIndices.sort((a2, b2) => b2 - a2)) {
|
|
21255
20673
|
let beforeOperator = params.slice(0, index2 + 1);
|
|
21256
20674
|
let afterOperator = params.slice(index2 + 1);
|
|
21257
|
-
if (primary === `always`)
|
|
21258
|
-
|
|
21259
|
-
} else if (primary === `never`) {
|
|
21260
|
-
params = beforeOperator + afterOperator.replace(/^\s*/, ``);
|
|
21261
|
-
}
|
|
21262
|
-
}
|
|
21263
|
-
if (atRule2.raws.params) {
|
|
21264
|
-
atRule2.raws.params.raw = params;
|
|
21265
|
-
} else {
|
|
21266
|
-
atRule2.params = params;
|
|
20675
|
+
if (primary === `always`) params = beforeOperator + afterOperator.replace(/^\s*/, ` `);
|
|
20676
|
+
else if (primary === `never`) params = beforeOperator + afterOperator.replace(/^\s*/, ``);
|
|
21267
20677
|
}
|
|
20678
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20679
|
+
else atRule2.params = params;
|
|
21268
20680
|
}
|
|
21269
20681
|
});
|
|
21270
20682
|
};
|
|
@@ -21297,9 +20709,7 @@ function rule$y(primary) {
|
|
|
21297
20709
|
actual: primary,
|
|
21298
20710
|
possible: [`always`, `never`]
|
|
21299
20711
|
});
|
|
21300
|
-
if (!validOptions)
|
|
21301
|
-
return;
|
|
21302
|
-
}
|
|
20712
|
+
if (!validOptions) return;
|
|
21303
20713
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21304
20714
|
let fixOperatorIndices = [];
|
|
21305
20715
|
findMediaOperator(atRule2, (match, params, node2) => {
|
|
@@ -21327,17 +20737,11 @@ function rule$y(primary) {
|
|
|
21327
20737
|
for (let index2 of fixOperatorIndices.sort((a2, b2) => b2 - a2)) {
|
|
21328
20738
|
let beforeOperator = params.slice(0, index2);
|
|
21329
20739
|
let afterOperator = params.slice(index2);
|
|
21330
|
-
if (primary === `always`)
|
|
21331
|
-
|
|
21332
|
-
} else if (primary === `never`) {
|
|
21333
|
-
params = beforeOperator.replace(/\s*$/, ``) + afterOperator;
|
|
21334
|
-
}
|
|
21335
|
-
}
|
|
21336
|
-
if (atRule2.raws.params) {
|
|
21337
|
-
atRule2.raws.params.raw = params;
|
|
21338
|
-
} else {
|
|
21339
|
-
atRule2.params = params;
|
|
20740
|
+
if (primary === `always`) params = beforeOperator.replace(/\s*$/, ` `) + afterOperator;
|
|
20741
|
+
else if (primary === `never`) params = beforeOperator.replace(/\s*$/, ``) + afterOperator;
|
|
21340
20742
|
}
|
|
20743
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20744
|
+
else atRule2.params = params;
|
|
21341
20745
|
}
|
|
21342
20746
|
});
|
|
21343
20747
|
};
|
|
@@ -21412,9 +20816,7 @@ function rule$x(primary, _secondaryOptions, context) {
|
|
|
21412
20816
|
actual: primary,
|
|
21413
20817
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
21414
20818
|
});
|
|
21415
|
-
if (!validOptions)
|
|
21416
|
-
return;
|
|
21417
|
-
}
|
|
20819
|
+
if (!validOptions) return;
|
|
21418
20820
|
let fixData;
|
|
21419
20821
|
mediaQueryListCommaWhitespaceChecker({
|
|
21420
20822
|
root: root2,
|
|
@@ -21437,17 +20839,11 @@ function rule$x(primary, _secondaryOptions, context) {
|
|
|
21437
20839
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
21438
20840
|
let beforeComma = params.slice(0, index2 + 1);
|
|
21439
20841
|
let afterComma = params.slice(index2 + 1);
|
|
21440
|
-
if (primary.startsWith(`always`))
|
|
21441
|
-
|
|
21442
|
-
} else if (primary.startsWith(`never`)) {
|
|
21443
|
-
params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21444
|
-
}
|
|
21445
|
-
}
|
|
21446
|
-
if (atRule2.raws.params) {
|
|
21447
|
-
atRule2.raws.params.raw = params;
|
|
21448
|
-
} else {
|
|
21449
|
-
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*/, ``);
|
|
21450
20844
|
}
|
|
20845
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20846
|
+
else atRule2.params = params;
|
|
21451
20847
|
}
|
|
21452
20848
|
}
|
|
21453
20849
|
};
|
|
@@ -21480,9 +20876,7 @@ function rule$w(primary) {
|
|
|
21480
20876
|
actual: primary,
|
|
21481
20877
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
21482
20878
|
});
|
|
21483
|
-
if (!validOptions)
|
|
21484
|
-
return;
|
|
21485
|
-
}
|
|
20879
|
+
if (!validOptions) return;
|
|
21486
20880
|
mediaQueryListCommaWhitespaceChecker({
|
|
21487
20881
|
root: root2,
|
|
21488
20882
|
result: result2,
|
|
@@ -21521,9 +20915,7 @@ function rule$v(primary) {
|
|
|
21521
20915
|
actual: primary,
|
|
21522
20916
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
21523
20917
|
});
|
|
21524
|
-
if (!validOptions)
|
|
21525
|
-
return;
|
|
21526
|
-
}
|
|
20918
|
+
if (!validOptions) return;
|
|
21527
20919
|
let fixData;
|
|
21528
20920
|
mediaQueryListCommaWhitespaceChecker({
|
|
21529
20921
|
root: root2,
|
|
@@ -21545,17 +20937,11 @@ function rule$v(primary) {
|
|
|
21545
20937
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
21546
20938
|
let beforeComma = params.slice(0, index2 + 1);
|
|
21547
20939
|
let afterComma = params.slice(index2 + 1);
|
|
21548
|
-
if (primary.startsWith(`always`))
|
|
21549
|
-
|
|
21550
|
-
} else if (primary.startsWith(`never`)) {
|
|
21551
|
-
params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21552
|
-
}
|
|
21553
|
-
}
|
|
21554
|
-
if (atRule2.raws.params) {
|
|
21555
|
-
atRule2.raws.params.raw = params;
|
|
21556
|
-
} else {
|
|
21557
|
-
atRule2.params = params;
|
|
20940
|
+
if (primary.startsWith(`always`)) params = beforeComma + afterComma.replace(/^\s*/, ` `);
|
|
20941
|
+
else if (primary.startsWith(`never`)) params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21558
20942
|
}
|
|
20943
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20944
|
+
else atRule2.params = params;
|
|
21559
20945
|
}
|
|
21560
20946
|
}
|
|
21561
20947
|
};
|
|
@@ -21590,9 +20976,7 @@ function rule$u(primary) {
|
|
|
21590
20976
|
actual: primary,
|
|
21591
20977
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
21592
20978
|
});
|
|
21593
|
-
if (!validOptions)
|
|
21594
|
-
return;
|
|
21595
|
-
}
|
|
20979
|
+
if (!validOptions) return;
|
|
21596
20980
|
let fixData;
|
|
21597
20981
|
mediaQueryListCommaWhitespaceChecker({
|
|
21598
20982
|
root: root2,
|
|
@@ -21614,17 +20998,11 @@ function rule$u(primary) {
|
|
|
21614
20998
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
21615
20999
|
let beforeComma = params.slice(0, index2);
|
|
21616
21000
|
let afterComma = params.slice(index2);
|
|
21617
|
-
if (primary.startsWith(`always`))
|
|
21618
|
-
|
|
21619
|
-
} else if (primary.startsWith(`never`)) {
|
|
21620
|
-
params = beforeComma.replace(/\s*$/, ``) + afterComma;
|
|
21621
|
-
}
|
|
21622
|
-
}
|
|
21623
|
-
if (atRule2.raws.params) {
|
|
21624
|
-
atRule2.raws.params.raw = params;
|
|
21625
|
-
} else {
|
|
21626
|
-
atRule2.params = params;
|
|
21001
|
+
if (primary.startsWith(`always`)) params = beforeComma.replace(/\s*$/, ` `) + afterComma;
|
|
21002
|
+
else if (primary.startsWith(`never`)) params = beforeComma.replace(/\s*$/, ``) + afterComma;
|
|
21627
21003
|
}
|
|
21004
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
21005
|
+
else atRule2.params = params;
|
|
21628
21006
|
}
|
|
21629
21007
|
}
|
|
21630
21008
|
};
|
|
@@ -21664,9 +21042,7 @@ function rule$t(primary, secondaryOptions = {}) {
|
|
|
21664
21042
|
optional: true
|
|
21665
21043
|
}
|
|
21666
21044
|
);
|
|
21667
|
-
if (!validOptions)
|
|
21668
|
-
return;
|
|
21669
|
-
}
|
|
21045
|
+
if (!validOptions) return;
|
|
21670
21046
|
let gap = secondaryOptions.gap ?? 1;
|
|
21671
21047
|
let alignQuotes = secondaryOptions.alignQuotes ?? false;
|
|
21672
21048
|
let referenceGap = ` `.repeat(gap);
|
|
@@ -21698,17 +21074,13 @@ function rule$t(primary, secondaryOptions = {}) {
|
|
|
21698
21074
|
});
|
|
21699
21075
|
if (alignQuotes && isMultilineDeclaration) {
|
|
21700
21076
|
formatted = formatted.map((row) => {
|
|
21701
|
-
if (row.length === maxRowLength)
|
|
21702
|
-
return row;
|
|
21703
|
-
}
|
|
21077
|
+
if (row.length === maxRowLength) return row;
|
|
21704
21078
|
let cleanRowValue = row.trimEnd();
|
|
21705
21079
|
return `${cleanRowValue}${` `.repeat(maxRowLength - cleanRowValue.length)}`;
|
|
21706
21080
|
});
|
|
21707
21081
|
}
|
|
21708
21082
|
let isValid = originalRows.every((row, index2) => row === formatted[index2]);
|
|
21709
|
-
if (isValid)
|
|
21710
|
-
return;
|
|
21711
|
-
}
|
|
21083
|
+
if (isValid) return;
|
|
21712
21084
|
let extraStartLines = declaration2.raws.between.match(/[\r\n?|\n]*/g)?.reduce((acc, newLineBlock) => acc + newLineBlock.length, 0);
|
|
21713
21085
|
let extraStartColumns = extraStartLines === 0 ? declarationValueIndex(declaration2) + declaration2.source.start.column : declaration2.raws.between.match(/[^\r\n?|\n]+$/)?.[0].length + 1 || 0;
|
|
21714
21086
|
report$m({
|
|
@@ -21767,13 +21139,9 @@ let meta$s = {
|
|
|
21767
21139
|
function rule$s(primary) {
|
|
21768
21140
|
return (root2, result2) => {
|
|
21769
21141
|
let validOptions = validateOptions$s(result2, ruleName$s, { actual: primary });
|
|
21770
|
-
if (!validOptions || root2.source.inline || root2.source.lang === `object-literal`)
|
|
21771
|
-
return;
|
|
21772
|
-
}
|
|
21142
|
+
if (!validOptions || root2.source.inline || root2.source.lang === `object-literal`) return;
|
|
21773
21143
|
let rootString = root2.source && root2.source.input.css || ``;
|
|
21774
|
-
if (!rootString.trim())
|
|
21775
|
-
return;
|
|
21776
|
-
}
|
|
21144
|
+
if (!rootString.trim()) return;
|
|
21777
21145
|
if (noEmptyFirstLineTest.test(rootString)) {
|
|
21778
21146
|
report$l({
|
|
21779
21147
|
message: messages$s.rejected,
|
|
@@ -21781,12 +21149,8 @@ function rule$s(primary) {
|
|
|
21781
21149
|
result: result2,
|
|
21782
21150
|
ruleName: ruleName$s,
|
|
21783
21151
|
fix() {
|
|
21784
|
-
if (root2.first === null)
|
|
21785
|
-
|
|
21786
|
-
}
|
|
21787
|
-
if (root2.first.raws.before === null) {
|
|
21788
|
-
throw new Error(`The first node must have spaces before.`);
|
|
21789
|
-
}
|
|
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.`);
|
|
21790
21154
|
root2.first.raws.before = root2.first.raws.before.replace(noEmptyFirstLineTest, ``);
|
|
21791
21155
|
}
|
|
21792
21156
|
});
|
|
@@ -21804,20 +21168,12 @@ const index$s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
21804
21168
|
ruleName: ruleName$s
|
|
21805
21169
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
21806
21170
|
function isOnlyWhitespace(input2) {
|
|
21807
|
-
for (let element of input2)
|
|
21808
|
-
if (!isWhitespace$1(element)) {
|
|
21809
|
-
return false;
|
|
21810
|
-
}
|
|
21811
|
-
}
|
|
21171
|
+
for (let element of input2) if (!isWhitespace$1(element)) return false;
|
|
21812
21172
|
return true;
|
|
21813
21173
|
}
|
|
21814
21174
|
function isStandardSyntaxComment(comment2) {
|
|
21815
|
-
if (`inline` in comment2)
|
|
21816
|
-
|
|
21817
|
-
}
|
|
21818
|
-
if (`inline` in comment2.raws) {
|
|
21819
|
-
return false;
|
|
21820
|
-
}
|
|
21175
|
+
if (`inline` in comment2) return false;
|
|
21176
|
+
if (`inline` in comment2.raws) return false;
|
|
21821
21177
|
return true;
|
|
21822
21178
|
}
|
|
21823
21179
|
let { utils: { report: report$k, ruleMessages: ruleMessages$r, validateOptions: validateOptions$r } } = stylelint;
|
|
@@ -21836,17 +21192,13 @@ function fixString(str) {
|
|
|
21836
21192
|
}
|
|
21837
21193
|
function findErrorStartIndex(lastEOLIndex, string2, { ignoreEmptyLines, isRootFirst }) {
|
|
21838
21194
|
let eolWhitespaceIndex = lastEOLIndex - 1;
|
|
21839
|
-
if (!whitespacesToReject.has(string2.charAt(eolWhitespaceIndex)))
|
|
21840
|
-
return -1;
|
|
21841
|
-
}
|
|
21195
|
+
if (!whitespacesToReject.has(string2.charAt(eolWhitespaceIndex))) return -1;
|
|
21842
21196
|
if (ignoreEmptyLines) {
|
|
21843
21197
|
let beforeNewlineIndex = string2.lastIndexOf(`
|
|
21844
21198
|
`, eolWhitespaceIndex);
|
|
21845
21199
|
if (beforeNewlineIndex >= 0 || isRootFirst) {
|
|
21846
21200
|
let line = string2.substring(beforeNewlineIndex, eolWhitespaceIndex);
|
|
21847
|
-
if (isOnlyWhitespace(line))
|
|
21848
|
-
return -1;
|
|
21849
|
-
}
|
|
21201
|
+
if (isOnlyWhitespace(line)) return -1;
|
|
21850
21202
|
}
|
|
21851
21203
|
}
|
|
21852
21204
|
return eolWhitespaceIndex;
|
|
@@ -21867,9 +21219,7 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21867
21219
|
}
|
|
21868
21220
|
}
|
|
21869
21221
|
);
|
|
21870
|
-
if (!validOptions)
|
|
21871
|
-
return;
|
|
21872
|
-
}
|
|
21222
|
+
if (!validOptions) return;
|
|
21873
21223
|
let ignoreEmptyLines = optionsMatches(secondaryOptions, `ignore`, `empty-lines`);
|
|
21874
21224
|
let rootString = root2.source && root2.source.input.css || ``;
|
|
21875
21225
|
function reportFromIndex(index2) {
|
|
@@ -21888,9 +21238,7 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21888
21238
|
ignoreEmptyLines,
|
|
21889
21239
|
isRootFirst: true
|
|
21890
21240
|
});
|
|
21891
|
-
if (errorIndex > -1)
|
|
21892
|
-
reportFromIndex(errorIndex);
|
|
21893
|
-
}
|
|
21241
|
+
if (errorIndex > -1) reportFromIndex(errorIndex);
|
|
21894
21242
|
function eachEolWhitespace(string2, callback, isRootFirst) {
|
|
21895
21243
|
styleSearch(
|
|
21896
21244
|
{
|
|
@@ -21904,9 +21252,7 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21904
21252
|
ignoreEmptyLines,
|
|
21905
21253
|
isRootFirst
|
|
21906
21254
|
});
|
|
21907
|
-
if (index2 > -1)
|
|
21908
|
-
callback(index2);
|
|
21909
|
-
}
|
|
21255
|
+
if (index2 > -1) callback(index2);
|
|
21910
21256
|
}
|
|
21911
21257
|
);
|
|
21912
21258
|
}
|
|
@@ -21969,9 +21315,8 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21969
21315
|
fixText(node2.raws.left, (fixed) => {
|
|
21970
21316
|
node2.raws.left = fixed;
|
|
21971
21317
|
});
|
|
21972
|
-
if (!isStandardSyntaxComment(node2))
|
|
21973
|
-
|
|
21974
|
-
} else {
|
|
21318
|
+
if (!isStandardSyntaxComment(node2)) node2.raws.right = node2.raws.right && fixString(node2.raws.right);
|
|
21319
|
+
else {
|
|
21975
21320
|
fixText(node2.raws.right, (fixed) => {
|
|
21976
21321
|
node2.raws.right = fixed;
|
|
21977
21322
|
});
|
|
@@ -21999,15 +21344,11 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21999
21344
|
`),
|
|
22000
21345
|
root2.raws.after.lastIndexOf(`\r`)
|
|
22001
21346
|
);
|
|
22002
|
-
if (lastEOL !== root2.raws.after.length - 1)
|
|
22003
|
-
root2.raws.after = root2.raws.after.slice(0, lastEOL + 1) + fixString(root2.raws.after.slice(lastEOL + 1));
|
|
22004
|
-
}
|
|
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));
|
|
22005
21348
|
}
|
|
22006
21349
|
}
|
|
22007
21350
|
function fixText(value, fixFn, isRootFirst = false) {
|
|
22008
|
-
if (!value)
|
|
22009
|
-
return;
|
|
22010
|
-
}
|
|
21351
|
+
if (!value) return;
|
|
22011
21352
|
let fixed = ``;
|
|
22012
21353
|
let lastIndex = 0;
|
|
22013
21354
|
eachEolWhitespace(
|
|
@@ -22053,51 +21394,25 @@ function hasTplInterpolation(string2) {
|
|
|
22053
21394
|
return HAS_TPL_INTERPOLATION.test(string2);
|
|
22054
21395
|
}
|
|
22055
21396
|
function hasInterpolation(string2) {
|
|
22056
|
-
if (hasLessInterpolation(string2) || hasScssInterpolation(string2) || hasTplInterpolation(string2) || hasPsvInterpolation(string2))
|
|
22057
|
-
return true;
|
|
22058
|
-
}
|
|
21397
|
+
if (hasLessInterpolation(string2) || hasScssInterpolation(string2) || hasTplInterpolation(string2) || hasPsvInterpolation(string2)) return true;
|
|
22059
21398
|
return false;
|
|
22060
21399
|
}
|
|
22061
21400
|
function isStandardSyntaxSelector(selector2) {
|
|
22062
|
-
if (hasInterpolation(selector2))
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
if (
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
if (
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
if (/:extend(?:\(.*?\))?/.test(selector2)) {
|
|
22072
|
-
return false;
|
|
22073
|
-
}
|
|
22074
|
-
if (/\.[\w-]+\(.*\).+/.test(selector2)) {
|
|
22075
|
-
return false;
|
|
22076
|
-
}
|
|
22077
|
-
if (selector2.endsWith(`)`) && !selector2.includes(`:`)) {
|
|
22078
|
-
return false;
|
|
22079
|
-
}
|
|
22080
|
-
if (/\(@.*\)$/.test(selector2)) {
|
|
22081
|
-
return false;
|
|
22082
|
-
}
|
|
22083
|
-
if (selector2.includes(`<%`) || selector2.includes(`%>`)) {
|
|
22084
|
-
return false;
|
|
22085
|
-
}
|
|
22086
|
-
if (selector2.includes(`//`)) {
|
|
22087
|
-
return false;
|
|
22088
|
-
}
|
|
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;
|
|
22089
21410
|
return true;
|
|
22090
21411
|
}
|
|
22091
21412
|
function isStandardSyntaxRule(rule2) {
|
|
22092
|
-
if (rule2.type !== `rule`)
|
|
22093
|
-
|
|
22094
|
-
|
|
22095
|
-
if (`extend` in rule2 && rule2.extend) {
|
|
22096
|
-
return false;
|
|
22097
|
-
}
|
|
22098
|
-
if (!isStandardSyntaxSelector(rule2.selector)) {
|
|
22099
|
-
return false;
|
|
22100
|
-
}
|
|
21413
|
+
if (rule2.type !== `rule`) return false;
|
|
21414
|
+
if (`extend` in rule2 && rule2.extend) return false;
|
|
21415
|
+
if (!isStandardSyntaxSelector(rule2.selector)) return false;
|
|
22101
21416
|
return true;
|
|
22102
21417
|
}
|
|
22103
21418
|
let { utils: { report: report$j, ruleMessages: ruleMessages$q, validateOptions: validateOptions$q } } = stylelint;
|
|
@@ -22111,19 +21426,11 @@ let meta$q = {
|
|
|
22111
21426
|
fixable: true
|
|
22112
21427
|
};
|
|
22113
21428
|
function getOffsetByNode(node2) {
|
|
22114
|
-
if (node2.parent && node2.parent.document)
|
|
22115
|
-
return 0;
|
|
22116
|
-
}
|
|
21429
|
+
if (node2.parent && node2.parent.document) return 0;
|
|
22117
21430
|
let root2 = node2.root();
|
|
22118
|
-
if (!root2.source)
|
|
22119
|
-
|
|
22120
|
-
|
|
22121
|
-
if (!node2.source) {
|
|
22122
|
-
throw new Error(`The node must have a source`);
|
|
22123
|
-
}
|
|
22124
|
-
if (!node2.source.start) {
|
|
22125
|
-
throw new Error(`The source must have a start position`);
|
|
22126
|
-
}
|
|
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`);
|
|
22127
21434
|
let string2 = root2.source.input.css;
|
|
22128
21435
|
let nodeColumn = node2.source.start.column;
|
|
22129
21436
|
let nodeLine = node2.source.start.line;
|
|
@@ -22139,18 +21446,14 @@ function getOffsetByNode(node2) {
|
|
|
22139
21446
|
`) {
|
|
22140
21447
|
column = 1;
|
|
22141
21448
|
line += 1;
|
|
22142
|
-
} else
|
|
22143
|
-
column += 1;
|
|
22144
|
-
}
|
|
21449
|
+
} else column += 1;
|
|
22145
21450
|
}
|
|
22146
21451
|
return index2;
|
|
22147
21452
|
}
|
|
22148
21453
|
function rule$q(primary) {
|
|
22149
21454
|
return (root2, result2) => {
|
|
22150
21455
|
let validOptions = validateOptions$q(result2, ruleName$q, { actual: primary });
|
|
22151
|
-
if (!validOptions)
|
|
22152
|
-
return;
|
|
22153
|
-
}
|
|
21456
|
+
if (!validOptions) return;
|
|
22154
21457
|
let fix = null;
|
|
22155
21458
|
if (root2.raws.after && root2.raws.after.trim().length !== 0) {
|
|
22156
21459
|
let rawAfterRoot = root2.raws.after;
|
|
@@ -22159,45 +21462,31 @@ function rule$q(primary) {
|
|
|
22159
21462
|
fix = () => {
|
|
22160
21463
|
fixSemiIndices.push(match.startIndex);
|
|
22161
21464
|
};
|
|
22162
|
-
if (!root2.source)
|
|
22163
|
-
throw new Error(`The root node must have a source`);
|
|
22164
|
-
}
|
|
21465
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
22165
21466
|
complain(root2.source.input.css.length - rawAfterRoot.length + match.startIndex);
|
|
22166
21467
|
});
|
|
22167
|
-
if (fixSemiIndices.length)
|
|
22168
|
-
root2.raws.after = removeIndices(rawAfterRoot, fixSemiIndices);
|
|
22169
|
-
}
|
|
21468
|
+
if (fixSemiIndices.length) root2.raws.after = removeIndices(rawAfterRoot, fixSemiIndices);
|
|
22170
21469
|
}
|
|
22171
21470
|
root2.walk((node2) => {
|
|
22172
|
-
if (isAtRule(node2) && !isStandardSyntaxAtRule(node2))
|
|
22173
|
-
|
|
22174
|
-
}
|
|
22175
|
-
if (node2.type === `rule` && !isStandardSyntaxRule(node2)) {
|
|
22176
|
-
return;
|
|
22177
|
-
}
|
|
21471
|
+
if (isAtRule(node2) && !isStandardSyntaxAtRule(node2)) return;
|
|
21472
|
+
if (node2.type === `rule` && !isStandardSyntaxRule(node2)) return;
|
|
22178
21473
|
if (node2.raws.before && node2.raws.before.trim().length !== 0) {
|
|
22179
21474
|
let rawBeforeNode = node2.raws.before;
|
|
22180
21475
|
let allowedSemi = 0;
|
|
22181
21476
|
let rawBeforeIndexStart = 0;
|
|
22182
21477
|
let fixSemiIndices = [];
|
|
22183
21478
|
styleSearch({ source: rawBeforeNode, target: `;` }, (match, count) => {
|
|
22184
|
-
if (count === allowedSemi)
|
|
22185
|
-
return;
|
|
22186
|
-
}
|
|
21479
|
+
if (count === allowedSemi) return;
|
|
22187
21480
|
fix = () => {
|
|
22188
21481
|
fixSemiIndices.push(match.startIndex - rawBeforeIndexStart);
|
|
22189
21482
|
};
|
|
22190
21483
|
complain(getOffsetByNode(node2) - rawBeforeNode.length + match.startIndex);
|
|
22191
21484
|
});
|
|
22192
|
-
if (fixSemiIndices.length)
|
|
22193
|
-
node2.raws.before = removeIndices(rawBeforeNode, fixSemiIndices);
|
|
22194
|
-
}
|
|
21485
|
+
if (fixSemiIndices.length) node2.raws.before = removeIndices(rawBeforeNode, fixSemiIndices);
|
|
22195
21486
|
}
|
|
22196
21487
|
if (typeof node2.raws.after === `string` && node2.raws.after.trim().length !== 0) {
|
|
22197
21488
|
let rawAfterNode = node2.raws.after;
|
|
22198
|
-
if (`last` in node2 && node2.last && node2.last.type === `atrule` && !isStandardSyntaxAtRule(node2.last))
|
|
22199
|
-
return;
|
|
22200
|
-
}
|
|
21489
|
+
if (`last` in node2 && node2.last && node2.last.type === `atrule` && !isStandardSyntaxAtRule(node2.last)) return;
|
|
22201
21490
|
let fixSemiIndices = [];
|
|
22202
21491
|
styleSearch({ source: rawAfterNode, target: `;` }, (match) => {
|
|
22203
21492
|
fix = () => {
|
|
@@ -22206,27 +21495,21 @@ function rule$q(primary) {
|
|
|
22206
21495
|
let index2 = getOffsetByNode(node2) + node2.toString().length - 1 - rawAfterNode.length + match.startIndex;
|
|
22207
21496
|
complain(index2);
|
|
22208
21497
|
});
|
|
22209
|
-
if (fixSemiIndices.length)
|
|
22210
|
-
node2.raws.after = removeIndices(rawAfterNode, fixSemiIndices);
|
|
22211
|
-
}
|
|
21498
|
+
if (fixSemiIndices.length) node2.raws.after = removeIndices(rawAfterNode, fixSemiIndices);
|
|
22212
21499
|
}
|
|
22213
21500
|
if (typeof node2.raws.ownSemicolon === `string`) {
|
|
22214
21501
|
let rawOwnSemicolon = node2.raws.ownSemicolon;
|
|
22215
21502
|
let allowedSemi = 0;
|
|
22216
21503
|
let fixSemiIndices = [];
|
|
22217
21504
|
styleSearch({ source: rawOwnSemicolon, target: `;` }, (match, count) => {
|
|
22218
|
-
if (count === allowedSemi)
|
|
22219
|
-
return;
|
|
22220
|
-
}
|
|
21505
|
+
if (count === allowedSemi) return;
|
|
22221
21506
|
fix = () => {
|
|
22222
21507
|
fixSemiIndices.push(match.startIndex);
|
|
22223
21508
|
};
|
|
22224
21509
|
let index2 = getOffsetByNode(node2) + node2.toString().length - rawOwnSemicolon.length + match.startIndex;
|
|
22225
21510
|
complain(index2);
|
|
22226
21511
|
});
|
|
22227
|
-
if (fixSemiIndices.length)
|
|
22228
|
-
node2.raws.ownSemicolon = removeIndices(rawOwnSemicolon, fixSemiIndices);
|
|
22229
|
-
}
|
|
21512
|
+
if (fixSemiIndices.length) node2.raws.ownSemicolon = removeIndices(rawOwnSemicolon, fixSemiIndices);
|
|
22230
21513
|
}
|
|
22231
21514
|
});
|
|
22232
21515
|
function complain(index2) {
|
|
@@ -22241,9 +21524,7 @@ function rule$q(primary) {
|
|
|
22241
21524
|
});
|
|
22242
21525
|
}
|
|
22243
21526
|
function removeIndices(str, indices) {
|
|
22244
|
-
for (let index2 of indices.reverse())
|
|
22245
|
-
str = str.slice(0, index2) + str.slice(index2 + 1);
|
|
22246
|
-
}
|
|
21527
|
+
for (let index2 of indices.reverse()) str = str.slice(0, index2) + str.slice(index2 + 1);
|
|
22247
21528
|
return str;
|
|
22248
21529
|
}
|
|
22249
21530
|
};
|
|
@@ -22271,20 +21552,12 @@ let meta$p = {
|
|
|
22271
21552
|
function rule$p(primary, _secondaryOptions, context) {
|
|
22272
21553
|
return (root2, result2) => {
|
|
22273
21554
|
let validOptions = validateOptions$p(result2, ruleName$p, { actual: primary });
|
|
22274
|
-
if (!validOptions)
|
|
22275
|
-
|
|
22276
|
-
|
|
22277
|
-
if (root2.source === null) {
|
|
22278
|
-
throw new Error(`The root node must have a source property`);
|
|
22279
|
-
}
|
|
22280
|
-
if (root2.source.inline || root2.source.lang === `object-literal`) {
|
|
22281
|
-
return;
|
|
22282
|
-
}
|
|
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;
|
|
22283
21558
|
let rootString = root2.source.input.css;
|
|
22284
21559
|
if (!rootString.trim() || rootString.endsWith(`
|
|
22285
|
-
`))
|
|
22286
|
-
return;
|
|
22287
|
-
}
|
|
21560
|
+
`)) return;
|
|
22288
21561
|
const problemIndex = rootString.length - 1;
|
|
22289
21562
|
report$i({
|
|
22290
21563
|
message: messages$p.rejected,
|
|
@@ -22326,35 +21599,23 @@ function rule$o(primary) {
|
|
|
22326
21599
|
actual: primary,
|
|
22327
21600
|
possible: [`always`, `never`]
|
|
22328
21601
|
});
|
|
22329
|
-
if (!validOptions)
|
|
22330
|
-
return;
|
|
22331
|
-
}
|
|
21602
|
+
if (!validOptions) return;
|
|
22332
21603
|
let fix = null;
|
|
22333
21604
|
root2.walkAtRules((atRule2) => {
|
|
22334
|
-
if (atRule2.name.toLowerCase() === `import`)
|
|
22335
|
-
return;
|
|
22336
|
-
}
|
|
21605
|
+
if (atRule2.name.toLowerCase() === `import`) return;
|
|
22337
21606
|
check(atRule2, atRule2.params);
|
|
22338
21607
|
});
|
|
22339
21608
|
root2.walkDecls((decl) => check(decl, decl.value));
|
|
22340
21609
|
function check(node2, value) {
|
|
22341
21610
|
let neverFixPositions = [];
|
|
22342
21611
|
let alwaysFixPositions = [];
|
|
22343
|
-
if (!value.includes(`.`))
|
|
22344
|
-
return;
|
|
22345
|
-
}
|
|
21612
|
+
if (!value.includes(`.`)) return;
|
|
22346
21613
|
valueParser(value).walk((valueNode) => {
|
|
22347
|
-
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`)
|
|
22348
|
-
|
|
22349
|
-
}
|
|
22350
|
-
if (valueNode.type !== `word`) {
|
|
22351
|
-
return;
|
|
22352
|
-
}
|
|
21614
|
+
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`) return false;
|
|
21615
|
+
if (valueNode.type !== `word`) return;
|
|
22353
21616
|
if (primary === `always`) {
|
|
22354
21617
|
let match = /(?:\D|^)(\.\d+)/.exec(valueNode.value);
|
|
22355
|
-
if (match === null || match[0] === null || match[1] === null)
|
|
22356
|
-
return;
|
|
22357
|
-
}
|
|
21618
|
+
if (match === null || match[0] === null || match[1] === null) return;
|
|
22358
21619
|
let capturingGroupIndex = match[0].length - match[1].length;
|
|
22359
21620
|
let index2 = valueNode.sourceIndex + match.index + capturingGroupIndex;
|
|
22360
21621
|
fix = () => {
|
|
@@ -22367,9 +21628,7 @@ function rule$o(primary) {
|
|
|
22367
21628
|
}
|
|
22368
21629
|
if (primary === `never`) {
|
|
22369
21630
|
let match = /(?:\D|^)(0+)(\.\d+)/.exec(valueNode.value);
|
|
22370
|
-
if (match === null || match[0] === null || match[1] === null || match[2] === null)
|
|
22371
|
-
return;
|
|
22372
|
-
}
|
|
21631
|
+
if (match === null || match[0] === null || match[1] === null || match[2] === null) return;
|
|
22373
21632
|
let capturingGroupIndex = match[0].length - (match[1].length + match[2].length);
|
|
22374
21633
|
let index2 = valueNode.sourceIndex + match.index + capturingGroupIndex;
|
|
22375
21634
|
fix = () => {
|
|
@@ -22386,22 +21645,16 @@ function rule$o(primary) {
|
|
|
22386
21645
|
if (alwaysFixPositions.length) {
|
|
22387
21646
|
for (let fixPosition of alwaysFixPositions) {
|
|
22388
21647
|
let index2 = fixPosition.index;
|
|
22389
|
-
if (isAtRule(node2))
|
|
22390
|
-
|
|
22391
|
-
} else {
|
|
22392
|
-
node2.value = addLeadingZero(node2.value, index2);
|
|
22393
|
-
}
|
|
21648
|
+
if (isAtRule(node2)) node2.params = addLeadingZero(node2.params, index2);
|
|
21649
|
+
else node2.value = addLeadingZero(node2.value, index2);
|
|
22394
21650
|
}
|
|
22395
21651
|
}
|
|
22396
21652
|
if (neverFixPositions.length) {
|
|
22397
21653
|
for (let fixPosition of neverFixPositions) {
|
|
22398
21654
|
let startIndex = fixPosition.startIndex;
|
|
22399
21655
|
let endIndex = fixPosition.endIndex;
|
|
22400
|
-
if (isAtRule(node2))
|
|
22401
|
-
|
|
22402
|
-
} else {
|
|
22403
|
-
node2.value = removeLeadingZeros(node2.value, startIndex, endIndex);
|
|
22404
|
-
}
|
|
21656
|
+
if (isAtRule(node2)) node2.params = removeLeadingZeros(node2.params, startIndex, endIndex);
|
|
21657
|
+
else node2.value = removeLeadingZeros(node2.value, startIndex, endIndex);
|
|
22405
21658
|
}
|
|
22406
21659
|
}
|
|
22407
21660
|
}
|
|
@@ -22447,32 +21700,20 @@ let meta$n = {
|
|
|
22447
21700
|
function rule$n(primary) {
|
|
22448
21701
|
return (root2, result2) => {
|
|
22449
21702
|
let validOptions = validateOptions$n(result2, ruleName$n, { actual: primary });
|
|
22450
|
-
if (!validOptions)
|
|
22451
|
-
return;
|
|
22452
|
-
}
|
|
21703
|
+
if (!validOptions) return;
|
|
22453
21704
|
root2.walkAtRules((atRule2) => {
|
|
22454
|
-
if (atRule2.name.toLowerCase() === `import`)
|
|
22455
|
-
return;
|
|
22456
|
-
}
|
|
21705
|
+
if (atRule2.name.toLowerCase() === `import`) return;
|
|
22457
21706
|
check(atRule2, atRule2.params);
|
|
22458
21707
|
});
|
|
22459
21708
|
root2.walkDecls((decl) => check(decl, decl.value));
|
|
22460
21709
|
function check(node2, value) {
|
|
22461
21710
|
let fixPositions = [];
|
|
22462
|
-
if (!value.includes(`.`))
|
|
22463
|
-
return;
|
|
22464
|
-
}
|
|
21711
|
+
if (!value.includes(`.`)) return;
|
|
22465
21712
|
valueParser(value).walk((valueNode) => {
|
|
22466
|
-
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`)
|
|
22467
|
-
|
|
22468
|
-
}
|
|
22469
|
-
if (valueNode.type !== `word`) {
|
|
22470
|
-
return;
|
|
22471
|
-
}
|
|
21713
|
+
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`) return false;
|
|
21714
|
+
if (valueNode.type !== `word`) return;
|
|
22472
21715
|
let match = /\.(\d{0,100}?)(0+)(?:\D|$)/.exec(valueNode.value);
|
|
22473
|
-
if (match === null || match[1] === null || match[2] === null)
|
|
22474
|
-
return;
|
|
22475
|
-
}
|
|
21716
|
+
if (match === null || match[1] === null || match[2] === null) return;
|
|
22476
21717
|
let index2 = valueNode.sourceIndex + match.index + 1 + match[1].length;
|
|
22477
21718
|
let startIndex = match[1].length > 0 ? index2 : index2 - 1;
|
|
22478
21719
|
let endIndex = index2 + match[2].length;
|
|
@@ -22497,11 +21738,8 @@ function rule$n(primary) {
|
|
|
22497
21738
|
for (let fixPosition of fixPositions) {
|
|
22498
21739
|
let startIndex = fixPosition.startIndex;
|
|
22499
21740
|
let endIndex = fixPosition.endIndex;
|
|
22500
|
-
if (isAtRule(node2))
|
|
22501
|
-
|
|
22502
|
-
} else {
|
|
22503
|
-
node2.value = removeTrailingZeros(node2.value, startIndex, endIndex);
|
|
22504
|
-
}
|
|
21741
|
+
if (isAtRule(node2)) node2.params = removeTrailingZeros(node2.params, startIndex, endIndex);
|
|
21742
|
+
else node2.value = removeTrailingZeros(node2.value, startIndex, endIndex);
|
|
22505
21743
|
}
|
|
22506
21744
|
}
|
|
22507
21745
|
}
|
|
@@ -22521,18 +21759,10 @@ const index$n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
22521
21759
|
ruleName: ruleName$n
|
|
22522
21760
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
22523
21761
|
function isStandardSyntaxProperty(property) {
|
|
22524
|
-
if (isScssVariable(property))
|
|
22525
|
-
|
|
22526
|
-
|
|
22527
|
-
if (property
|
|
22528
|
-
return false;
|
|
22529
|
-
}
|
|
22530
|
-
if (property.endsWith(`+`) || property.endsWith(`+_`)) {
|
|
22531
|
-
return false;
|
|
22532
|
-
}
|
|
22533
|
-
if (hasInterpolation(property)) {
|
|
22534
|
-
return false;
|
|
22535
|
-
}
|
|
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;
|
|
22536
21766
|
return true;
|
|
22537
21767
|
}
|
|
22538
21768
|
let { utils: { report: report$f, ruleMessages: ruleMessages$m, validateOptions: validateOptions$m } } = stylelint;
|
|
@@ -22562,31 +21792,19 @@ function rule$m(primary, secondaryOptions) {
|
|
|
22562
21792
|
optional: true
|
|
22563
21793
|
}
|
|
22564
21794
|
);
|
|
22565
|
-
if (!validOptions)
|
|
22566
|
-
return;
|
|
22567
|
-
}
|
|
21795
|
+
if (!validOptions) return;
|
|
22568
21796
|
root2.walkDecls((decl) => {
|
|
22569
21797
|
let prop = decl.prop;
|
|
22570
|
-
if (!isStandardSyntaxProperty(prop))
|
|
22571
|
-
|
|
22572
|
-
}
|
|
22573
|
-
if (isCustomProperty(prop)) {
|
|
22574
|
-
return;
|
|
22575
|
-
}
|
|
21798
|
+
if (!isStandardSyntaxProperty(prop)) return;
|
|
21799
|
+
if (isCustomProperty(prop)) return;
|
|
22576
21800
|
let { parent } = decl;
|
|
22577
|
-
if (!parent)
|
|
22578
|
-
throw new Error(`A parent node must be present`);
|
|
22579
|
-
}
|
|
21801
|
+
if (!parent) throw new Error(`A parent node must be present`);
|
|
22580
21802
|
if (isRule(parent)) {
|
|
22581
21803
|
let { selector: selector2 } = parent;
|
|
22582
|
-
if (selector2 && optionsMatches(secondaryOptions, `ignoreSelectors`, selector2))
|
|
22583
|
-
return;
|
|
22584
|
-
}
|
|
21804
|
+
if (selector2 && optionsMatches(secondaryOptions, `ignoreSelectors`, selector2)) return;
|
|
22585
21805
|
}
|
|
22586
21806
|
let expectedProp = primary === `lower` ? prop.toLowerCase() : prop.toUpperCase();
|
|
22587
|
-
if (prop === expectedProp)
|
|
22588
|
-
return;
|
|
22589
|
-
}
|
|
21807
|
+
if (prop === expectedProp) return;
|
|
22590
21808
|
report$f({
|
|
22591
21809
|
message: messages$m.expected,
|
|
22592
21810
|
messageArgs: [prop, expectedProp],
|
|
@@ -26265,16 +25483,10 @@ function rule$l(primary) {
|
|
|
26265
25483
|
actual: primary,
|
|
26266
25484
|
possible: [`always`, `never`]
|
|
26267
25485
|
});
|
|
26268
|
-
if (!validOptions)
|
|
26269
|
-
return;
|
|
26270
|
-
}
|
|
25486
|
+
if (!validOptions) return;
|
|
26271
25487
|
root2.walkRules((ruleNode) => {
|
|
26272
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
26273
|
-
|
|
26274
|
-
}
|
|
26275
|
-
if (!ruleNode.selector.includes(`[`)) {
|
|
26276
|
-
return;
|
|
26277
|
-
}
|
|
25488
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
25489
|
+
if (!ruleNode.selector.includes(`[`)) return;
|
|
26278
25490
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
26279
25491
|
let fix = null;
|
|
26280
25492
|
let hasFixed;
|
|
@@ -26320,11 +25532,8 @@ function rule$l(primary) {
|
|
|
26320
25532
|
});
|
|
26321
25533
|
});
|
|
26322
25534
|
if (hasFixed && fixedSelector) {
|
|
26323
|
-
if (!ruleNode.raws.selector)
|
|
26324
|
-
|
|
26325
|
-
} else {
|
|
26326
|
-
ruleNode.raws.selector.raw = fixedSelector;
|
|
26327
|
-
}
|
|
25535
|
+
if (!ruleNode.raws.selector) ruleNode.selector = fixedSelector;
|
|
25536
|
+
else ruleNode.raws.selector.raw = fixedSelector;
|
|
26328
25537
|
}
|
|
26329
25538
|
function complain(message, index2) {
|
|
26330
25539
|
report$e({
|
|
@@ -26350,17 +25559,12 @@ function rule$l(primary) {
|
|
|
26350
25559
|
} : {
|
|
26351
25560
|
attrBefore: attributeNode.spaces.attribute && attributeNode.spaces.attribute.before || ``,
|
|
26352
25561
|
setAttrBefore(fixed) {
|
|
26353
|
-
if (!attributeNode.spaces.attribute) {
|
|
26354
|
-
attributeNode.spaces.attribute = {};
|
|
26355
|
-
}
|
|
25562
|
+
if (!attributeNode.spaces.attribute) attributeNode.spaces.attribute = {};
|
|
26356
25563
|
attributeNode.spaces.attribute.before = fixed;
|
|
26357
25564
|
}
|
|
26358
25565
|
};
|
|
26359
|
-
if (primary === `always`)
|
|
26360
|
-
|
|
26361
|
-
} else if (primary === `never`) {
|
|
26362
|
-
setAttrBefore(attrBefore.replace(/^\s*/, ``));
|
|
26363
|
-
}
|
|
25566
|
+
if (primary === `always`) setAttrBefore(attrBefore.replace(/^\s*/, ` `));
|
|
25567
|
+
else if (primary === `never`) setAttrBefore(attrBefore.replace(/^\s*/, ``));
|
|
26364
25568
|
}
|
|
26365
25569
|
function fixAfter(attributeNode) {
|
|
26366
25570
|
let key = attributeNode.operator ? attributeNode.insensitive ? `insensitive` : `value` : `attribute`;
|
|
@@ -26375,17 +25579,12 @@ function rule$l(primary) {
|
|
|
26375
25579
|
} : {
|
|
26376
25580
|
after: spaces && spaces.after || ``,
|
|
26377
25581
|
setAfter(fixed) {
|
|
26378
|
-
if (!attributeNode.spaces[key]) {
|
|
26379
|
-
attributeNode.spaces[key] = {};
|
|
26380
|
-
}
|
|
25582
|
+
if (!attributeNode.spaces[key]) attributeNode.spaces[key] = {};
|
|
26381
25583
|
attributeNode.spaces[key].after = fixed;
|
|
26382
25584
|
}
|
|
26383
25585
|
};
|
|
26384
|
-
if (primary === `always`)
|
|
26385
|
-
|
|
26386
|
-
} else if (primary === `never`) {
|
|
26387
|
-
setAfter(after.replace(/\s*$/, ``));
|
|
26388
|
-
}
|
|
25586
|
+
if (primary === `always`) setAfter(after.replace(/\s*$/, ` `));
|
|
25587
|
+
else if (primary === `never`) setAfter(after.replace(/\s*$/, ``));
|
|
26389
25588
|
}
|
|
26390
25589
|
}
|
|
26391
25590
|
rule$l.ruleName = ruleName$l;
|
|
@@ -26401,20 +25600,14 @@ const index$l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
26401
25600
|
let { utils: { report: report$d } } = stylelint;
|
|
26402
25601
|
function selectorAttributeOperatorSpaceChecker(options) {
|
|
26403
25602
|
options.root.walkRules((rule2) => {
|
|
26404
|
-
if (!isStandardSyntaxRule(rule2))
|
|
26405
|
-
|
|
26406
|
-
}
|
|
26407
|
-
if (!rule2.selector.includes(`[`) || !rule2.selector.includes(`=`)) {
|
|
26408
|
-
return;
|
|
26409
|
-
}
|
|
25603
|
+
if (!isStandardSyntaxRule(rule2)) return;
|
|
25604
|
+
if (!rule2.selector.includes(`[`) || !rule2.selector.includes(`=`)) return;
|
|
26410
25605
|
let hasFixed = false;
|
|
26411
25606
|
let selector2 = rule2.raws.selector ? rule2.raws.selector.raw : rule2.selector;
|
|
26412
25607
|
let fixedSelector = parseSelector(selector2, options.result, rule2, (selectorTree) => {
|
|
26413
25608
|
selectorTree.walkAttributes((attributeNode) => {
|
|
26414
25609
|
let operator = attributeNode.operator;
|
|
26415
|
-
if (!operator)
|
|
26416
|
-
return;
|
|
26417
|
-
}
|
|
25610
|
+
if (!operator) return;
|
|
26418
25611
|
let attributeNodeString = attributeNode.toString();
|
|
26419
25612
|
styleSearch({ source: attributeNodeString, target: operator }, (match) => {
|
|
26420
25613
|
let index2 = options.checkBeforeOperator ? match.startIndex : match.endIndex - 1;
|
|
@@ -26423,11 +25616,8 @@ function selectorAttributeOperatorSpaceChecker(options) {
|
|
|
26423
25616
|
});
|
|
26424
25617
|
});
|
|
26425
25618
|
if (hasFixed && fixedSelector) {
|
|
26426
|
-
if (!rule2.raws.selector)
|
|
26427
|
-
|
|
26428
|
-
} else {
|
|
26429
|
-
rule2.raws.selector.raw = fixedSelector;
|
|
26430
|
-
}
|
|
25619
|
+
if (!rule2.raws.selector) rule2.selector = fixedSelector;
|
|
25620
|
+
else rule2.raws.selector.raw = fixedSelector;
|
|
26431
25621
|
}
|
|
26432
25622
|
function checkOperator(source, index2, node2, attributeNode, operator) {
|
|
26433
25623
|
options.locationChecker({
|
|
@@ -26473,9 +25663,7 @@ function rule$k(primary) {
|
|
|
26473
25663
|
actual: primary,
|
|
26474
25664
|
possible: [`always`, `never`]
|
|
26475
25665
|
});
|
|
26476
|
-
if (!validOptions)
|
|
26477
|
-
return;
|
|
26478
|
-
}
|
|
25666
|
+
if (!validOptions) return;
|
|
26479
25667
|
selectorAttributeOperatorSpaceChecker({
|
|
26480
25668
|
root: root2,
|
|
26481
25669
|
result: result2,
|
|
@@ -26492,12 +25680,8 @@ function rule$k(primary) {
|
|
|
26492
25680
|
),
|
|
26493
25681
|
setOperatorAfter(fixed) {
|
|
26494
25682
|
delete attributeNode.raws.operator;
|
|
26495
|
-
if (!attributeNode.raws.spaces) {
|
|
26496
|
-
|
|
26497
|
-
}
|
|
26498
|
-
if (!attributeNode.raws.spaces.operator) {
|
|
26499
|
-
attributeNode.raws.spaces.operator = {};
|
|
26500
|
-
}
|
|
25683
|
+
if (!attributeNode.raws.spaces) attributeNode.raws.spaces = {};
|
|
25684
|
+
if (!attributeNode.raws.spaces.operator) attributeNode.raws.spaces.operator = {};
|
|
26501
25685
|
attributeNode.raws.spaces.operator.after = fixed;
|
|
26502
25686
|
}
|
|
26503
25687
|
};
|
|
@@ -26515,9 +25699,7 @@ function rule$k(primary) {
|
|
|
26515
25699
|
return {
|
|
26516
25700
|
operatorAfter: attributeNode.spaces.operator && attributeNode.spaces.operator.after || ``,
|
|
26517
25701
|
setOperatorAfter(fixed) {
|
|
26518
|
-
if (!attributeNode.spaces.operator) {
|
|
26519
|
-
attributeNode.spaces.operator = {};
|
|
26520
|
-
}
|
|
25702
|
+
if (!attributeNode.spaces.operator) attributeNode.spaces.operator = {};
|
|
26521
25703
|
attributeNode.spaces.operator.after = fixed;
|
|
26522
25704
|
}
|
|
26523
25705
|
};
|
|
@@ -26563,9 +25745,7 @@ function rule$j(primary) {
|
|
|
26563
25745
|
actual: primary,
|
|
26564
25746
|
possible: [`always`, `never`]
|
|
26565
25747
|
});
|
|
26566
|
-
if (!validOptions)
|
|
26567
|
-
return;
|
|
26568
|
-
}
|
|
25748
|
+
if (!validOptions) return;
|
|
26569
25749
|
selectorAttributeOperatorSpaceChecker({
|
|
26570
25750
|
root: root2,
|
|
26571
25751
|
result: result2,
|
|
@@ -26583,9 +25763,7 @@ function rule$j(primary) {
|
|
|
26583
25763
|
} : {
|
|
26584
25764
|
attrAfter: attributeNode.spaces.attribute && attributeNode.spaces.attribute.after || ``,
|
|
26585
25765
|
setAttrAfter(fixed) {
|
|
26586
|
-
if (!attributeNode.spaces.attribute) {
|
|
26587
|
-
attributeNode.spaces.attribute = {};
|
|
26588
|
-
}
|
|
25766
|
+
if (!attributeNode.spaces.attribute) attributeNode.spaces.attribute = {};
|
|
26589
25767
|
attributeNode.spaces.attribute.after = fixed;
|
|
26590
25768
|
}
|
|
26591
25769
|
};
|
|
@@ -26613,20 +25791,12 @@ const index$j = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
26613
25791
|
ruleName: ruleName$j
|
|
26614
25792
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
26615
25793
|
function isStandardSyntaxCombinator(node2) {
|
|
26616
|
-
if (node2.type !== `combinator`)
|
|
26617
|
-
|
|
26618
|
-
}
|
|
26619
|
-
if (node2.value.startsWith(`/`) || node2.value.endsWith(`/`)) {
|
|
26620
|
-
return false;
|
|
26621
|
-
}
|
|
25794
|
+
if (node2.type !== `combinator`) return false;
|
|
25795
|
+
if (node2.value.startsWith(`/`) || node2.value.endsWith(`/`)) return false;
|
|
26622
25796
|
if (node2.parent !== void 0 && node2.parent !== null) {
|
|
26623
25797
|
let parent = node2.parent;
|
|
26624
|
-
if (node2 === parent.first)
|
|
26625
|
-
|
|
26626
|
-
}
|
|
26627
|
-
if (node2 === parent.last) {
|
|
26628
|
-
return false;
|
|
26629
|
-
}
|
|
25798
|
+
if (node2 === parent.first) return false;
|
|
25799
|
+
if (node2 === parent.last) return false;
|
|
26630
25800
|
}
|
|
26631
25801
|
return true;
|
|
26632
25802
|
}
|
|
@@ -26634,37 +25804,24 @@ let { utils: { report: report$c } } = stylelint;
|
|
|
26634
25804
|
function selectorCombinatorSpaceChecker(opts) {
|
|
26635
25805
|
let hasFixed;
|
|
26636
25806
|
opts.root.walkRules((rule2) => {
|
|
26637
|
-
if (!isStandardSyntaxRule(rule2))
|
|
26638
|
-
return;
|
|
26639
|
-
}
|
|
25807
|
+
if (!isStandardSyntaxRule(rule2)) return;
|
|
26640
25808
|
hasFixed = false;
|
|
26641
25809
|
let selector2 = rule2.raws.selector ? rule2.raws.selector.raw : rule2.selector;
|
|
26642
25810
|
let fixedSelector = parseSelector(selector2, opts.result, rule2, (selectorTree) => {
|
|
26643
25811
|
selectorTree.walkCombinators((node2) => {
|
|
26644
|
-
if (!isStandardSyntaxCombinator(node2))
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
if (/\s/.test(node2.value)) {
|
|
26648
|
-
return;
|
|
26649
|
-
}
|
|
26650
|
-
if (opts.locationType === `before` && !node2.prev()) {
|
|
26651
|
-
return;
|
|
26652
|
-
}
|
|
25812
|
+
if (!isStandardSyntaxCombinator(node2)) return;
|
|
25813
|
+
if (/\s/.test(node2.value)) return;
|
|
25814
|
+
if (opts.locationType === `before` && !node2.prev()) return;
|
|
26653
25815
|
let parentParentNode = node2.parent && node2.parent.parent;
|
|
26654
|
-
if (parentParentNode && parentParentNode.type === `pseudo`)
|
|
26655
|
-
return;
|
|
26656
|
-
}
|
|
25816
|
+
if (parentParentNode && parentParentNode.type === `pseudo`) return;
|
|
26657
25817
|
let sourceIndex = node2.sourceIndex;
|
|
26658
25818
|
let index2 = node2.value.length > 1 && opts.locationType === `before` ? sourceIndex : sourceIndex + node2.value.length - 1;
|
|
26659
25819
|
check(selector2, node2, index2, rule2, sourceIndex);
|
|
26660
25820
|
});
|
|
26661
25821
|
});
|
|
26662
25822
|
if (hasFixed && fixedSelector) {
|
|
26663
|
-
if (!rule2.raws.selector)
|
|
26664
|
-
|
|
26665
|
-
} else {
|
|
26666
|
-
rule2.raws.selector.raw = fixedSelector;
|
|
26667
|
-
}
|
|
25823
|
+
if (!rule2.raws.selector) rule2.selector = fixedSelector;
|
|
25824
|
+
else rule2.raws.selector.raw = fixedSelector;
|
|
26668
25825
|
}
|
|
26669
25826
|
});
|
|
26670
25827
|
function check(source, combinator2, index2, node2, sourceIndex) {
|
|
@@ -26707,9 +25864,7 @@ function rule$i(primary) {
|
|
|
26707
25864
|
actual: primary,
|
|
26708
25865
|
possible: [`always`, `never`]
|
|
26709
25866
|
});
|
|
26710
|
-
if (!validOptions)
|
|
26711
|
-
return;
|
|
26712
|
-
}
|
|
25867
|
+
if (!validOptions) return;
|
|
26713
25868
|
selectorCombinatorSpaceChecker({
|
|
26714
25869
|
root: root2,
|
|
26715
25870
|
result: result2,
|
|
@@ -26758,9 +25913,7 @@ function rule$h(primary) {
|
|
|
26758
25913
|
actual: primary,
|
|
26759
25914
|
possible: [`always`, `never`]
|
|
26760
25915
|
});
|
|
26761
|
-
if (!validOptions)
|
|
26762
|
-
return;
|
|
26763
|
-
}
|
|
25916
|
+
if (!validOptions) return;
|
|
26764
25917
|
selectorCombinatorSpaceChecker({
|
|
26765
25918
|
root: root2,
|
|
26766
25919
|
result: result2,
|
|
@@ -26806,23 +25959,15 @@ function rule$g(primary) {
|
|
|
26806
25959
|
let validOptions = validateOptions$g(result2, ruleName$g, {
|
|
26807
25960
|
actual: primary
|
|
26808
25961
|
});
|
|
26809
|
-
if (!validOptions)
|
|
26810
|
-
return;
|
|
26811
|
-
}
|
|
25962
|
+
if (!validOptions) return;
|
|
26812
25963
|
root2.walkRules((ruleNode) => {
|
|
26813
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
26814
|
-
return;
|
|
26815
|
-
}
|
|
25964
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26816
25965
|
let hasFixed = false;
|
|
26817
25966
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
26818
|
-
if (selector2.includes(`/*`))
|
|
26819
|
-
return;
|
|
26820
|
-
}
|
|
25967
|
+
if (selector2.includes(`/*`)) return;
|
|
26821
25968
|
let fixedSelector = parseSelector(selector2, result2, ruleNode, (fullSelector) => {
|
|
26822
25969
|
fullSelector.walkCombinators((combinatorNode) => {
|
|
26823
|
-
if (combinatorNode.value !== ` `)
|
|
26824
|
-
return;
|
|
26825
|
-
}
|
|
25970
|
+
if (combinatorNode.value !== ` `) return;
|
|
26826
25971
|
let value = combinatorNode.toString();
|
|
26827
25972
|
if (value.includes(` `) || value.includes(` `) || value.includes(`
|
|
26828
25973
|
`) || value.includes(`\r`)) {
|
|
@@ -26837,9 +25982,7 @@ function rule$g(primary) {
|
|
|
26837
25982
|
fix() {
|
|
26838
25983
|
if (/^\s+$/.test(value)) {
|
|
26839
25984
|
hasFixed = true;
|
|
26840
|
-
if (!combinatorNode.raws) {
|
|
26841
|
-
combinatorNode.raws = {};
|
|
26842
|
-
}
|
|
25985
|
+
if (!combinatorNode.raws) combinatorNode.raws = {};
|
|
26843
25986
|
combinatorNode.raws.value = ` `;
|
|
26844
25987
|
combinatorNode.rawSpaceBefore = combinatorNode.rawSpaceBefore.replace(/^\s+/, ``);
|
|
26845
25988
|
combinatorNode.rawSpaceAfter = combinatorNode.rawSpaceAfter.replace(/\s+$/, ``);
|
|
@@ -26850,11 +25993,8 @@ function rule$g(primary) {
|
|
|
26850
25993
|
});
|
|
26851
25994
|
});
|
|
26852
25995
|
if (hasFixed && fixedSelector) {
|
|
26853
|
-
if (!ruleNode.raws.selector)
|
|
26854
|
-
|
|
26855
|
-
} else {
|
|
26856
|
-
ruleNode.raws.selector.raw = fixedSelector;
|
|
26857
|
-
}
|
|
25996
|
+
if (!ruleNode.raws.selector) ruleNode.selector = fixedSelector;
|
|
25997
|
+
else ruleNode.raws.selector.raw = fixedSelector;
|
|
26858
25998
|
}
|
|
26859
25999
|
});
|
|
26860
26000
|
};
|
|
@@ -26888,13 +26028,9 @@ function rule$f(primary, _secondaryOptions, context) {
|
|
|
26888
26028
|
actual: primary,
|
|
26889
26029
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
26890
26030
|
});
|
|
26891
|
-
if (!validOptions)
|
|
26892
|
-
return;
|
|
26893
|
-
}
|
|
26031
|
+
if (!validOptions) return;
|
|
26894
26032
|
root2.walkRules((ruleNode) => {
|
|
26895
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
26896
|
-
return;
|
|
26897
|
-
}
|
|
26033
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26898
26034
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
26899
26035
|
let fixIndices = [];
|
|
26900
26036
|
styleSearch(
|
|
@@ -26905,9 +26041,7 @@ function rule$f(primary, _secondaryOptions, context) {
|
|
|
26905
26041
|
},
|
|
26906
26042
|
(match) => {
|
|
26907
26043
|
let nextChars = selector2.slice(match.endIndex);
|
|
26908
|
-
if (/^\s+\/\//.test(nextChars))
|
|
26909
|
-
return;
|
|
26910
|
-
}
|
|
26044
|
+
if (/^\s+\/\//.test(nextChars)) return;
|
|
26911
26045
|
let indextoCheckAfter = /^\s+\/\*/.test(nextChars) ? selector2.indexOf(`*/`, match.endIndex) + 1 : match.startIndex;
|
|
26912
26046
|
checker.afterOneOnly({
|
|
26913
26047
|
source: selector2,
|
|
@@ -26933,18 +26067,12 @@ function rule$f(primary, _secondaryOptions, context) {
|
|
|
26933
26067
|
for (let index2 of fixIndices.sort((a2, b2) => b2 - a2)) {
|
|
26934
26068
|
let beforeSelector = fixedSelector.slice(0, index2);
|
|
26935
26069
|
let afterSelector = fixedSelector.slice(index2);
|
|
26936
|
-
if (primary.startsWith(`always`))
|
|
26937
|
-
|
|
26938
|
-
} else if (primary.startsWith(`never-multi-line`)) {
|
|
26939
|
-
afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
26940
|
-
}
|
|
26070
|
+
if (primary.startsWith(`always`)) afterSelector = context.newline + afterSelector;
|
|
26071
|
+
else if (primary.startsWith(`never-multi-line`)) afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
26941
26072
|
fixedSelector = beforeSelector + afterSelector;
|
|
26942
26073
|
}
|
|
26943
|
-
if (ruleNode.raws.selector)
|
|
26944
|
-
|
|
26945
|
-
} else {
|
|
26946
|
-
ruleNode.selector = fixedSelector;
|
|
26947
|
-
}
|
|
26074
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = fixedSelector;
|
|
26075
|
+
else ruleNode.selector = fixedSelector;
|
|
26948
26076
|
}
|
|
26949
26077
|
});
|
|
26950
26078
|
};
|
|
@@ -26962,9 +26090,7 @@ const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
26962
26090
|
let { utils: { report: report$9 } } = stylelint;
|
|
26963
26091
|
function selectorListCommaWhitespaceChecker(opts) {
|
|
26964
26092
|
opts.root.walkRules((rule2) => {
|
|
26965
|
-
if (!isStandardSyntaxRule(rule2))
|
|
26966
|
-
return;
|
|
26967
|
-
}
|
|
26093
|
+
if (!isStandardSyntaxRule(rule2)) return;
|
|
26968
26094
|
let selector2 = rule2.raws.selector ? rule2.raws.selector.raw : rule2.selector;
|
|
26969
26095
|
styleSearch(
|
|
26970
26096
|
{
|
|
@@ -27014,9 +26140,7 @@ function rule$e(primary, _secondaryOptions, context) {
|
|
|
27014
26140
|
actual: primary,
|
|
27015
26141
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
27016
26142
|
});
|
|
27017
|
-
if (!validOptions)
|
|
27018
|
-
return;
|
|
27019
|
-
}
|
|
26143
|
+
if (!validOptions) return;
|
|
27020
26144
|
let fixData;
|
|
27021
26145
|
selectorListCommaWhitespaceChecker({
|
|
27022
26146
|
root: root2,
|
|
@@ -27040,16 +26164,11 @@ function rule$e(primary, _secondaryOptions, context) {
|
|
|
27040
26164
|
if (primary.startsWith(`always`)) {
|
|
27041
26165
|
let spaceIndex = beforeSelector.search(/\s+$/);
|
|
27042
26166
|
beforeSelector = spaceIndex >= 0 ? beforeSelector.slice(0, spaceIndex) + context.newline + beforeSelector.slice(spaceIndex) : beforeSelector + context.newline;
|
|
27043
|
-
} else if (primary === `never-multi-line`)
|
|
27044
|
-
beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27045
|
-
}
|
|
26167
|
+
} else if (primary === `never-multi-line`) beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27046
26168
|
selector2 = beforeSelector + afterSelector;
|
|
27047
26169
|
}
|
|
27048
|
-
if (ruleNode.raws.selector)
|
|
27049
|
-
|
|
27050
|
-
} else {
|
|
27051
|
-
ruleNode.selector = selector2;
|
|
27052
|
-
}
|
|
26170
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = selector2;
|
|
26171
|
+
else ruleNode.selector = selector2;
|
|
27053
26172
|
}
|
|
27054
26173
|
}
|
|
27055
26174
|
};
|
|
@@ -27084,9 +26203,7 @@ function rule$d(primary) {
|
|
|
27084
26203
|
actual: primary,
|
|
27085
26204
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
27086
26205
|
});
|
|
27087
|
-
if (!validOptions)
|
|
27088
|
-
return;
|
|
27089
|
-
}
|
|
26206
|
+
if (!validOptions) return;
|
|
27090
26207
|
let fixData;
|
|
27091
26208
|
selectorListCommaWhitespaceChecker({
|
|
27092
26209
|
root: root2,
|
|
@@ -27107,18 +26224,12 @@ function rule$d(primary) {
|
|
|
27107
26224
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
27108
26225
|
let beforeSelector = selector2.slice(0, index2 + 1);
|
|
27109
26226
|
let afterSelector = selector2.slice(index2 + 1);
|
|
27110
|
-
if (primary.startsWith(`always`))
|
|
27111
|
-
|
|
27112
|
-
} else if (primary.startsWith(`never`)) {
|
|
27113
|
-
afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
27114
|
-
}
|
|
26227
|
+
if (primary.startsWith(`always`)) afterSelector = afterSelector.replace(/^\s*/, ` `);
|
|
26228
|
+
else if (primary.startsWith(`never`)) afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
27115
26229
|
selector2 = beforeSelector + afterSelector;
|
|
27116
26230
|
}
|
|
27117
|
-
if (ruleNode.raws.selector)
|
|
27118
|
-
|
|
27119
|
-
} else {
|
|
27120
|
-
ruleNode.selector = selector2;
|
|
27121
|
-
}
|
|
26231
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = selector2;
|
|
26232
|
+
else ruleNode.selector = selector2;
|
|
27122
26233
|
}
|
|
27123
26234
|
}
|
|
27124
26235
|
};
|
|
@@ -27153,9 +26264,7 @@ function rule$c(primary) {
|
|
|
27153
26264
|
actual: primary,
|
|
27154
26265
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
27155
26266
|
});
|
|
27156
|
-
if (!validOptions)
|
|
27157
|
-
return;
|
|
27158
|
-
}
|
|
26267
|
+
if (!validOptions) return;
|
|
27159
26268
|
let fixData;
|
|
27160
26269
|
selectorListCommaWhitespaceChecker({
|
|
27161
26270
|
root: root2,
|
|
@@ -27176,18 +26285,12 @@ function rule$c(primary) {
|
|
|
27176
26285
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
27177
26286
|
let beforeSelector = selector2.slice(0, index2);
|
|
27178
26287
|
let afterSelector = selector2.slice(index2);
|
|
27179
|
-
if (primary.includes(`always`))
|
|
27180
|
-
|
|
27181
|
-
} else if (primary.includes(`never`)) {
|
|
27182
|
-
beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27183
|
-
}
|
|
26288
|
+
if (primary.includes(`always`)) beforeSelector = beforeSelector.replace(/\s*$/, ` `);
|
|
26289
|
+
else if (primary.includes(`never`)) beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27184
26290
|
selector2 = beforeSelector + afterSelector;
|
|
27185
26291
|
}
|
|
27186
|
-
if (ruleNode.raws.selector)
|
|
27187
|
-
|
|
27188
|
-
} else {
|
|
27189
|
-
ruleNode.selector = selector2;
|
|
27190
|
-
}
|
|
26292
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = selector2;
|
|
26293
|
+
else ruleNode.selector = selector2;
|
|
27191
26294
|
}
|
|
27192
26295
|
}
|
|
27193
26296
|
};
|
|
@@ -27219,9 +26322,7 @@ function rule$b(primary) {
|
|
|
27219
26322
|
actual: primary,
|
|
27220
26323
|
possible: isNumber$1
|
|
27221
26324
|
});
|
|
27222
|
-
if (!validOptions)
|
|
27223
|
-
return;
|
|
27224
|
-
}
|
|
26325
|
+
if (!validOptions) return;
|
|
27225
26326
|
let violatedCRLFNewLinesRegex = new RegExp(`(?:\r
|
|
27226
26327
|
){${maxAdjacentNewlines + 1},}`);
|
|
27227
26328
|
let violatedLFNewLinesRegex = new RegExp(`
|
|
@@ -27243,11 +26344,8 @@ function rule$b(primary) {
|
|
|
27243
26344
|
ruleName: ruleName$b,
|
|
27244
26345
|
fix() {
|
|
27245
26346
|
let newSelectorString = selector2.replace(new RegExp(violatedLFNewLinesRegex, `gm`), allowedLFNewLinesString).replace(new RegExp(violatedCRLFNewLinesRegex, `gm`), allowedCRLFNewLinesString);
|
|
27246
|
-
if (ruleNode.raws.selector)
|
|
27247
|
-
|
|
27248
|
-
} else {
|
|
27249
|
-
ruleNode.selector = newSelectorString;
|
|
27250
|
-
}
|
|
26347
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = newSelectorString;
|
|
26348
|
+
else ruleNode.selector = newSelectorString;
|
|
27251
26349
|
}
|
|
27252
26350
|
});
|
|
27253
26351
|
}
|
|
@@ -27286,17 +26384,11 @@ function rule$a(primary) {
|
|
|
27286
26384
|
actual: primary,
|
|
27287
26385
|
possible: [`lower`, `upper`]
|
|
27288
26386
|
});
|
|
27289
|
-
if (!validOptions)
|
|
27290
|
-
return;
|
|
27291
|
-
}
|
|
26387
|
+
if (!validOptions) return;
|
|
27292
26388
|
root2.walkRules((ruleNode) => {
|
|
27293
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27294
|
-
return;
|
|
27295
|
-
}
|
|
26389
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
27296
26390
|
let selector2 = ruleNode.selector;
|
|
27297
|
-
if (!selector2.includes(`:`))
|
|
27298
|
-
return;
|
|
27299
|
-
}
|
|
26391
|
+
if (!selector2.includes(`:`)) return;
|
|
27300
26392
|
let fixedSelector = parseSelector(
|
|
27301
26393
|
ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector,
|
|
27302
26394
|
result2,
|
|
@@ -27304,16 +26396,10 @@ function rule$a(primary) {
|
|
|
27304
26396
|
(selectorTree) => {
|
|
27305
26397
|
selectorTree.walkPseudos((pseudoNode) => {
|
|
27306
26398
|
let pseudo2 = pseudoNode.value;
|
|
27307
|
-
if (!isStandardSyntaxSelector(pseudo2))
|
|
27308
|
-
|
|
27309
|
-
}
|
|
27310
|
-
if (pseudo2.includes(`::`) || levelOneAndTwoPseudoElements.has(pseudo2.toLowerCase().slice(1))) {
|
|
27311
|
-
return;
|
|
27312
|
-
}
|
|
26399
|
+
if (!isStandardSyntaxSelector(pseudo2)) return;
|
|
26400
|
+
if (pseudo2.includes(`::`) || levelOneAndTwoPseudoElements.has(pseudo2.toLowerCase().slice(1))) return;
|
|
27313
26401
|
let expectedPseudo = primary === `lower` ? pseudo2.toLowerCase() : pseudo2.toUpperCase();
|
|
27314
|
-
if (pseudo2 === expectedPseudo)
|
|
27315
|
-
return;
|
|
27316
|
-
}
|
|
26402
|
+
if (pseudo2 === expectedPseudo) return;
|
|
27317
26403
|
report$7({
|
|
27318
26404
|
message: messages$a.expected,
|
|
27319
26405
|
messageArgs: [pseudo2, expectedPseudo],
|
|
@@ -27330,11 +26416,8 @@ function rule$a(primary) {
|
|
|
27330
26416
|
}
|
|
27331
26417
|
);
|
|
27332
26418
|
if (fixedSelector) {
|
|
27333
|
-
if (ruleNode.raws.selector)
|
|
27334
|
-
|
|
27335
|
-
} else {
|
|
27336
|
-
ruleNode.selector = fixedSelector;
|
|
27337
|
-
}
|
|
26419
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = fixedSelector;
|
|
26420
|
+
else ruleNode.selector = fixedSelector;
|
|
27338
26421
|
}
|
|
27339
26422
|
});
|
|
27340
26423
|
};
|
|
@@ -27368,25 +26451,19 @@ function rule$9(primary) {
|
|
|
27368
26451
|
actual: primary,
|
|
27369
26452
|
possible: [`always`, `never`]
|
|
27370
26453
|
});
|
|
27371
|
-
if (!validOptions)
|
|
27372
|
-
return;
|
|
27373
|
-
}
|
|
26454
|
+
if (!validOptions) return;
|
|
27374
26455
|
root2.walkRules((ruleNode) => {
|
|
27375
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27376
|
-
|
|
27377
|
-
}
|
|
27378
|
-
if (!ruleNode.selector.includes(`(`)) {
|
|
27379
|
-
return;
|
|
27380
|
-
}
|
|
26456
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26457
|
+
if (!ruleNode.selector.includes(`(`)) return;
|
|
27381
26458
|
let fix = null;
|
|
27382
26459
|
let hasFixed = false;
|
|
27383
26460
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
27384
26461
|
let fixedSelector = parseSelector(selector2, result2, ruleNode, (selectorTree) => {
|
|
27385
26462
|
selectorTree.walkPseudos((pseudoNode) => {
|
|
27386
|
-
if (!pseudoNode.length)
|
|
27387
|
-
return;
|
|
27388
|
-
}
|
|
26463
|
+
if (!pseudoNode.length) return;
|
|
27389
26464
|
let paramString = pseudoNode.map((node2) => String(node2)).join(`,`);
|
|
26465
|
+
let isParamStringMultiline = paramString.includes(`
|
|
26466
|
+
`);
|
|
27390
26467
|
let nextCharIsSpace = paramString.startsWith(` `);
|
|
27391
26468
|
let openIndex = pseudoNode.sourceIndex + pseudoNode.value.length + 1;
|
|
27392
26469
|
if (nextCharIsSpace && primary === `never`) {
|
|
@@ -27405,7 +26482,7 @@ function rule$9(primary) {
|
|
|
27405
26482
|
}
|
|
27406
26483
|
let prevCharIsSpace = paramString.endsWith(` `);
|
|
27407
26484
|
let closeIndex = openIndex + paramString.length - 1;
|
|
27408
|
-
if (prevCharIsSpace && primary === `never`) {
|
|
26485
|
+
if (prevCharIsSpace && primary === `never` && !isParamStringMultiline) {
|
|
27409
26486
|
fix = () => {
|
|
27410
26487
|
hasFixed = true;
|
|
27411
26488
|
setLastNodeSpaceAfter(pseudoNode, ``);
|
|
@@ -27422,11 +26499,8 @@ function rule$9(primary) {
|
|
|
27422
26499
|
});
|
|
27423
26500
|
});
|
|
27424
26501
|
if (hasFixed && fixedSelector) {
|
|
27425
|
-
if (!ruleNode.raws.selector)
|
|
27426
|
-
|
|
27427
|
-
} else {
|
|
27428
|
-
ruleNode.raws.selector.raw = fixedSelector;
|
|
27429
|
-
}
|
|
26502
|
+
if (!ruleNode.raws.selector) ruleNode.selector = fixedSelector;
|
|
26503
|
+
else ruleNode.raws.selector.raw = fixedSelector;
|
|
27430
26504
|
}
|
|
27431
26505
|
function complain(message, index2) {
|
|
27432
26506
|
report$6({
|
|
@@ -27444,19 +26518,13 @@ function rule$9(primary) {
|
|
|
27444
26518
|
}
|
|
27445
26519
|
function setFirstNodeSpaceBefore(node2, value) {
|
|
27446
26520
|
let target = node2.first;
|
|
27447
|
-
if (target.type === `selector`)
|
|
27448
|
-
|
|
27449
|
-
} else {
|
|
27450
|
-
target.spaces.before = value;
|
|
27451
|
-
}
|
|
26521
|
+
if (target.type === `selector`) setFirstNodeSpaceBefore(target, value);
|
|
26522
|
+
else target.spaces.before = value;
|
|
27452
26523
|
}
|
|
27453
26524
|
function setLastNodeSpaceAfter(node2, value) {
|
|
27454
26525
|
let target = node2.last;
|
|
27455
|
-
if (target.type === `selector`)
|
|
27456
|
-
|
|
27457
|
-
} else {
|
|
27458
|
-
target.spaces.after = value;
|
|
27459
|
-
}
|
|
26526
|
+
if (target.type === `selector`) setLastNodeSpaceAfter(target, value);
|
|
26527
|
+
else target.spaces.after = value;
|
|
27460
26528
|
}
|
|
27461
26529
|
rule$9.ruleName = ruleName$9;
|
|
27462
26530
|
rule$9.messages = messages$9;
|
|
@@ -27492,30 +26560,18 @@ function rule$8(primary) {
|
|
|
27492
26560
|
actual: primary,
|
|
27493
26561
|
possible: [`lower`, `upper`]
|
|
27494
26562
|
});
|
|
27495
|
-
if (!validOptions)
|
|
27496
|
-
return;
|
|
27497
|
-
}
|
|
26563
|
+
if (!validOptions) return;
|
|
27498
26564
|
root2.walkRules((ruleNode) => {
|
|
27499
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27500
|
-
return;
|
|
27501
|
-
}
|
|
26565
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
27502
26566
|
let selector2 = ruleNode.selector;
|
|
27503
|
-
if (!selector2.includes(`:`))
|
|
27504
|
-
return;
|
|
27505
|
-
}
|
|
26567
|
+
if (!selector2.includes(`:`)) return;
|
|
27506
26568
|
transformSelector(result2, ruleNode, (selectorTree) => {
|
|
27507
26569
|
selectorTree.walkPseudos((pseudoNode) => {
|
|
27508
26570
|
let pseudoElement = pseudoNode.value;
|
|
27509
|
-
if (!isStandardSyntaxSelector(pseudoElement))
|
|
27510
|
-
|
|
27511
|
-
}
|
|
27512
|
-
if (!pseudoElement.includes(`::`) && !levelOneAndTwoPseudoElements.has(pseudoElement.toLowerCase().slice(1))) {
|
|
27513
|
-
return;
|
|
27514
|
-
}
|
|
26571
|
+
if (!isStandardSyntaxSelector(pseudoElement)) return;
|
|
26572
|
+
if (!pseudoElement.includes(`::`) && !levelOneAndTwoPseudoElements.has(pseudoElement.toLowerCase().slice(1))) return;
|
|
27515
26573
|
let expectedPseudoElement = primary === `lower` ? pseudoElement.toLowerCase() : pseudoElement.toUpperCase();
|
|
27516
|
-
if (pseudoElement === expectedPseudoElement)
|
|
27517
|
-
return;
|
|
27518
|
-
}
|
|
26574
|
+
if (pseudoElement === expectedPseudoElement) return;
|
|
27519
26575
|
report$5({
|
|
27520
26576
|
message: messages$8.expected,
|
|
27521
26577
|
messageArgs: [pseudoElement, expectedPseudoElement],
|
|
@@ -27574,9 +26630,7 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27574
26630
|
optional: true
|
|
27575
26631
|
}
|
|
27576
26632
|
);
|
|
27577
|
-
if (!validOptions)
|
|
27578
|
-
return;
|
|
27579
|
-
}
|
|
26633
|
+
if (!validOptions) return;
|
|
27580
26634
|
let avoidEscape = secondaryOptions && secondaryOptions.avoidEscape !== void 0 ? secondaryOptions.avoidEscape : true;
|
|
27581
26635
|
root2.walk((node2) => {
|
|
27582
26636
|
switch (node2.type) {
|
|
@@ -27592,27 +26646,19 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27592
26646
|
}
|
|
27593
26647
|
});
|
|
27594
26648
|
function checkRule(ruleNode) {
|
|
27595
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27596
|
-
|
|
27597
|
-
}
|
|
27598
|
-
if (!ruleNode.selector.includes(`[`) || !ruleNode.selector.includes(`=`)) {
|
|
27599
|
-
return;
|
|
27600
|
-
}
|
|
26649
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26650
|
+
if (!ruleNode.selector.includes(`[`) || !ruleNode.selector.includes(`=`)) return;
|
|
27601
26651
|
let fixPositions = [];
|
|
27602
26652
|
parseSelector(ruleNode.selector, result2, ruleNode, (selectorTree) => {
|
|
27603
26653
|
let selectorFixed = false;
|
|
27604
26654
|
selectorTree.walkAttributes((attributeNode) => {
|
|
27605
|
-
if (!attributeNode.quoted)
|
|
27606
|
-
return;
|
|
27607
|
-
}
|
|
26655
|
+
if (!attributeNode.quoted) return;
|
|
27608
26656
|
const maybeProblemIndex = attributeNode.sourceIndex + attributeNode.offsetOf(`value`);
|
|
27609
26657
|
if (attributeNode.quoteMark === correctQuote && avoidEscape) {
|
|
27610
26658
|
assertString(attributeNode.value);
|
|
27611
26659
|
let needsCorrectEscape = attributeNode.value.includes(correctQuote);
|
|
27612
26660
|
let needsOtherEscape = attributeNode.value.includes(erroneousQuote);
|
|
27613
|
-
if (needsOtherEscape)
|
|
27614
|
-
return;
|
|
27615
|
-
}
|
|
26661
|
+
if (needsOtherEscape) return;
|
|
27616
26662
|
if (needsCorrectEscape) {
|
|
27617
26663
|
report$4({
|
|
27618
26664
|
message: messages$7.expected,
|
|
@@ -27650,9 +26696,7 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27650
26696
|
});
|
|
27651
26697
|
return;
|
|
27652
26698
|
}
|
|
27653
|
-
if (needsCorrectEscape)
|
|
27654
|
-
return;
|
|
27655
|
-
}
|
|
26699
|
+
if (needsCorrectEscape) return;
|
|
27656
26700
|
}
|
|
27657
26701
|
report$4({
|
|
27658
26702
|
message: messages$7.expected,
|
|
@@ -27669,24 +26713,16 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27669
26713
|
});
|
|
27670
26714
|
}
|
|
27671
26715
|
});
|
|
27672
|
-
if (selectorFixed)
|
|
27673
|
-
ruleNode.selector = selectorTree.toString();
|
|
27674
|
-
}
|
|
26716
|
+
if (selectorFixed) ruleNode.selector = selectorTree.toString();
|
|
27675
26717
|
});
|
|
27676
|
-
for (let fixIndex of fixPositions)
|
|
27677
|
-
ruleNode.selector = replaceQuote(ruleNode.selector, fixIndex, correctQuote);
|
|
27678
|
-
}
|
|
26718
|
+
for (let fixIndex of fixPositions) ruleNode.selector = replaceQuote(ruleNode.selector, fixIndex, correctQuote);
|
|
27679
26719
|
}
|
|
27680
26720
|
function checkDeclOrAtRule(node2, value, getIndex) {
|
|
27681
26721
|
let fixPositions = [];
|
|
27682
|
-
if (!value.includes(erroneousQuote))
|
|
27683
|
-
return;
|
|
27684
|
-
}
|
|
26722
|
+
if (!value.includes(erroneousQuote)) return;
|
|
27685
26723
|
if (isAtRule(node2) && node2.name === `charset`) {
|
|
27686
26724
|
let hasValidQuotes = node2.params.startsWith(`"`) && node2.params.endsWith(`"`);
|
|
27687
|
-
if (hasValidQuotes || correctQuote === `'`)
|
|
27688
|
-
return;
|
|
27689
|
-
}
|
|
26725
|
+
if (hasValidQuotes || correctQuote === `'`) return;
|
|
27690
26726
|
}
|
|
27691
26727
|
valueParser(value).walk((valueNode) => {
|
|
27692
26728
|
if (valueNode.type === `string` && valueNode.quote === erroneousQuote) {
|
|
@@ -27714,11 +26750,8 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27714
26750
|
}
|
|
27715
26751
|
});
|
|
27716
26752
|
for (let fixIndex of fixPositions) {
|
|
27717
|
-
if (isAtRule(node2))
|
|
27718
|
-
|
|
27719
|
-
} else {
|
|
27720
|
-
node2.value = replaceQuote(node2.value, fixIndex, correctQuote);
|
|
27721
|
-
}
|
|
26753
|
+
if (isAtRule(node2)) node2.params = replaceQuote(node2.params, fixIndex, correctQuote);
|
|
26754
|
+
else node2.value = replaceQuote(node2.value, fixIndex, correctQuote);
|
|
27722
26755
|
}
|
|
27723
26756
|
}
|
|
27724
26757
|
};
|
|
@@ -27752,9 +26785,7 @@ function rule$6(primary) {
|
|
|
27752
26785
|
actual: primary,
|
|
27753
26786
|
possible: [`always`, `never`]
|
|
27754
26787
|
});
|
|
27755
|
-
if (!validOptions || !root2.source || root2.source.inline || root2.source.lang === `object-literal` || root2.document !== void 0)
|
|
27756
|
-
return;
|
|
27757
|
-
}
|
|
26788
|
+
if (!validOptions || !root2.source || root2.source.inline || root2.source.lang === `object-literal` || root2.document !== void 0) return;
|
|
27758
26789
|
let { hasBOM } = root2.source.input;
|
|
27759
26790
|
if (primary === `always` && !hasBOM) {
|
|
27760
26791
|
report$3({
|
|
@@ -27789,27 +26820,13 @@ function blurInterpolation(source, blurChar = ` `) {
|
|
|
27789
26820
|
}
|
|
27790
26821
|
function isStandardSyntaxValue(value) {
|
|
27791
26822
|
let normalizedValue = value;
|
|
27792
|
-
if (/^[-+*/]/.test(value.charAt(0)))
|
|
27793
|
-
|
|
27794
|
-
|
|
27795
|
-
if (
|
|
27796
|
-
|
|
27797
|
-
|
|
27798
|
-
if (
|
|
27799
|
-
return false;
|
|
27800
|
-
}
|
|
27801
|
-
if (/^.+\.[-\w]+\(/.test(value)) {
|
|
27802
|
-
return false;
|
|
27803
|
-
}
|
|
27804
|
-
if (normalizedValue.startsWith(`@`)) {
|
|
27805
|
-
return false;
|
|
27806
|
-
}
|
|
27807
|
-
if (hasInterpolation(normalizedValue)) {
|
|
27808
|
-
return false;
|
|
27809
|
-
}
|
|
27810
|
-
if (/__MSG_\S+__/.test(value)) {
|
|
27811
|
-
return false;
|
|
27812
|
-
}
|
|
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;
|
|
27813
26830
|
return true;
|
|
27814
26831
|
}
|
|
27815
26832
|
function getDimension(node2) {
|
|
@@ -27863,20 +26880,14 @@ function rule$5(primary) {
|
|
|
27863
26880
|
actual: primary,
|
|
27864
26881
|
possible: [`lower`, `upper`]
|
|
27865
26882
|
});
|
|
27866
|
-
if (!validOptions)
|
|
27867
|
-
return;
|
|
27868
|
-
}
|
|
26883
|
+
if (!validOptions) return;
|
|
27869
26884
|
function check(node2, checkedValue, getIndex) {
|
|
27870
26885
|
let problems = [];
|
|
27871
26886
|
function processValue(valueNode) {
|
|
27872
26887
|
let { number, unit: unit2 } = getDimension(valueNode);
|
|
27873
|
-
if (!number || !unit2)
|
|
27874
|
-
return false;
|
|
27875
|
-
}
|
|
26888
|
+
if (!number || !unit2) return false;
|
|
27876
26889
|
let expectedUnit = primary === `lower` ? unit2.toLowerCase() : unit2.toUpperCase();
|
|
27877
|
-
if (unit2 === expectedUnit)
|
|
27878
|
-
return false;
|
|
27879
|
-
}
|
|
26890
|
+
if (unit2 === expectedUnit) return false;
|
|
27880
26891
|
let index2 = getIndex(node2);
|
|
27881
26892
|
problems.push({
|
|
27882
26893
|
index: index2 + valueNode.sourceIndex + number.length,
|
|
@@ -27888,9 +26899,7 @@ function rule$5(primary) {
|
|
|
27888
26899
|
}
|
|
27889
26900
|
let parsedValue = valueParser(checkedValue).walk((valueNode) => {
|
|
27890
26901
|
let value = valueNode.value;
|
|
27891
|
-
if (valueNode.type === `function` && value.toLowerCase() === `url`)
|
|
27892
|
-
return false;
|
|
27893
|
-
}
|
|
26902
|
+
if (valueNode.type === `function` && value.toLowerCase() === `url`) return false;
|
|
27894
26903
|
if (value.includes(`*`)) {
|
|
27895
26904
|
value.split(`*`).some((val) => processValue({
|
|
27896
26905
|
...valueNode,
|
|
@@ -27898,9 +26907,7 @@ function rule$5(primary) {
|
|
|
27898
26907
|
value: val
|
|
27899
26908
|
}));
|
|
27900
26909
|
}
|
|
27901
|
-
if (processValue(valueNode))
|
|
27902
|
-
valueNode.value = primary === `lower` ? value.toLowerCase() : value.toUpperCase();
|
|
27903
|
-
}
|
|
26910
|
+
if (processValue(valueNode)) valueNode.value = primary === `lower` ? value.toLowerCase() : value.toUpperCase();
|
|
27904
26911
|
});
|
|
27905
26912
|
if (problems.length) {
|
|
27906
26913
|
for (let err of problems) {
|
|
@@ -27913,20 +26920,15 @@ function rule$5(primary) {
|
|
|
27913
26920
|
result: result2,
|
|
27914
26921
|
ruleName: ruleName$5,
|
|
27915
26922
|
fix() {
|
|
27916
|
-
if (`name` in node2 && node2.name === `media`)
|
|
27917
|
-
|
|
27918
|
-
} else if (`value` in node2) {
|
|
27919
|
-
node2.value = parsedValue.toString();
|
|
27920
|
-
}
|
|
26923
|
+
if (`name` in node2 && node2.name === `media`) node2.params = parsedValue.toString();
|
|
26924
|
+
else if (`value` in node2) node2.value = parsedValue.toString();
|
|
27921
26925
|
}
|
|
27922
26926
|
});
|
|
27923
26927
|
}
|
|
27924
26928
|
}
|
|
27925
26929
|
}
|
|
27926
26930
|
root2.walkAtRules((atRule2) => {
|
|
27927
|
-
if (!/^media$/i.test(atRule2.name) && !(`variable` in atRule2))
|
|
27928
|
-
return;
|
|
27929
|
-
}
|
|
26931
|
+
if (!/^media$/i.test(atRule2.name) && !(`variable` in atRule2)) return;
|
|
27930
26932
|
check(atRule2, atRule2.params, atRuleParamIndex);
|
|
27931
26933
|
});
|
|
27932
26934
|
root2.walkDecls((decl) => check(decl, decl.value, declarationValueIndex));
|
|
@@ -27945,9 +26947,7 @@ const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
27945
26947
|
let { utils: { report: report$1 } } = stylelint;
|
|
27946
26948
|
function valueListCommaWhitespaceChecker(opts) {
|
|
27947
26949
|
opts.root.walkDecls((decl) => {
|
|
27948
|
-
if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop))
|
|
27949
|
-
return;
|
|
27950
|
-
}
|
|
26950
|
+
if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop)) return;
|
|
27951
26951
|
let declString = decl.toString();
|
|
27952
26952
|
styleSearch(
|
|
27953
26953
|
{
|
|
@@ -27957,9 +26957,7 @@ function valueListCommaWhitespaceChecker(opts) {
|
|
|
27957
26957
|
},
|
|
27958
26958
|
(match) => {
|
|
27959
26959
|
let indexToCheckAfter = opts.determineIndex ? opts.determineIndex(declString, match) : match.startIndex;
|
|
27960
|
-
if (indexToCheckAfter === false)
|
|
27961
|
-
return;
|
|
27962
|
-
}
|
|
26960
|
+
if (indexToCheckAfter === false) return;
|
|
27963
26961
|
checkComma(declString, indexToCheckAfter, decl);
|
|
27964
26962
|
}
|
|
27965
26963
|
);
|
|
@@ -28001,9 +26999,7 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28001
26999
|
actual: primary,
|
|
28002
27000
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
28003
27001
|
});
|
|
28004
|
-
if (!validOptions)
|
|
28005
|
-
return;
|
|
28006
|
-
}
|
|
27002
|
+
if (!validOptions) return;
|
|
28007
27003
|
let fixData;
|
|
28008
27004
|
valueListCommaWhitespaceChecker({
|
|
28009
27005
|
root: root2,
|
|
@@ -28012,9 +27008,7 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28012
27008
|
checkedRuleName: ruleName$4,
|
|
28013
27009
|
fix: (declNode, index2) => {
|
|
28014
27010
|
let valueIndex = declarationValueIndex(declNode);
|
|
28015
|
-
if (index2 <= valueIndex)
|
|
28016
|
-
return false;
|
|
28017
|
-
}
|
|
27011
|
+
if (index2 <= valueIndex) return false;
|
|
28018
27012
|
fixData = fixData || /* @__PURE__ */ new Map();
|
|
28019
27013
|
let commaIndices = fixData.get(declNode) || [];
|
|
28020
27014
|
commaIndices.push(index2);
|
|
@@ -28023,9 +27017,7 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28023
27017
|
},
|
|
28024
27018
|
determineIndex: (declString, match) => {
|
|
28025
27019
|
let nextChars = declString.substring(match.endIndex, declString.length);
|
|
28026
|
-
if (/^[ \t]*\/\//.test(nextChars))
|
|
28027
|
-
return false;
|
|
28028
|
-
}
|
|
27020
|
+
if (/^[ \t]*\/\//.test(nextChars)) return false;
|
|
28029
27021
|
return /^[ \t]*\/\*/.test(nextChars) ? declString.indexOf(`*/`, match.endIndex) + 1 : match.startIndex;
|
|
28030
27022
|
}
|
|
28031
27023
|
});
|
|
@@ -28036,11 +27028,8 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28036
27028
|
let valueIndex = index2 - declarationValueIndex(decl);
|
|
28037
27029
|
let beforeValue = value.slice(0, valueIndex + 1);
|
|
28038
27030
|
let afterValue = value.slice(valueIndex + 1);
|
|
28039
|
-
if (primary.startsWith(`always`))
|
|
28040
|
-
|
|
28041
|
-
} else if (primary.startsWith(`never-multi-line`)) {
|
|
28042
|
-
afterValue = afterValue.replace(/^\s*/, ``);
|
|
28043
|
-
}
|
|
27031
|
+
if (primary.startsWith(`always`)) afterValue = context.newline + afterValue;
|
|
27032
|
+
else if (primary.startsWith(`never-multi-line`)) afterValue = afterValue.replace(/^\s*/, ``);
|
|
28044
27033
|
setDeclarationValue(decl, beforeValue + afterValue);
|
|
28045
27034
|
}
|
|
28046
27035
|
}
|
|
@@ -28075,9 +27064,7 @@ function rule$3(primary) {
|
|
|
28075
27064
|
actual: primary,
|
|
28076
27065
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
28077
27066
|
});
|
|
28078
|
-
if (!validOptions)
|
|
28079
|
-
return;
|
|
28080
|
-
}
|
|
27067
|
+
if (!validOptions) return;
|
|
28081
27068
|
valueListCommaWhitespaceChecker({
|
|
28082
27069
|
root: root2,
|
|
28083
27070
|
result: result2,
|
|
@@ -28116,9 +27103,7 @@ function rule$2(primary) {
|
|
|
28116
27103
|
actual: primary,
|
|
28117
27104
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
28118
27105
|
});
|
|
28119
|
-
if (!validOptions)
|
|
28120
|
-
return;
|
|
28121
|
-
}
|
|
27106
|
+
if (!validOptions) return;
|
|
28122
27107
|
let fixData;
|
|
28123
27108
|
valueListCommaWhitespaceChecker({
|
|
28124
27109
|
root: root2,
|
|
@@ -28127,9 +27112,7 @@ function rule$2(primary) {
|
|
|
28127
27112
|
checkedRuleName: ruleName$2,
|
|
28128
27113
|
fix: (declNode, index2) => {
|
|
28129
27114
|
let valueIndex = declarationValueIndex(declNode);
|
|
28130
|
-
if (index2 <= valueIndex)
|
|
28131
|
-
return false;
|
|
28132
|
-
}
|
|
27115
|
+
if (index2 <= valueIndex) return false;
|
|
28133
27116
|
fixData = fixData || /* @__PURE__ */ new Map();
|
|
28134
27117
|
let commaIndices = fixData.get(declNode) || [];
|
|
28135
27118
|
commaIndices.push(index2);
|
|
@@ -28144,11 +27127,8 @@ function rule$2(primary) {
|
|
|
28144
27127
|
let valueIndex = index2 - declarationValueIndex(decl);
|
|
28145
27128
|
let beforeValue = value.slice(0, valueIndex + 1);
|
|
28146
27129
|
let afterValue = value.slice(valueIndex + 1);
|
|
28147
|
-
if (primary.startsWith(`always`))
|
|
28148
|
-
|
|
28149
|
-
} else if (primary.startsWith(`never`)) {
|
|
28150
|
-
afterValue = afterValue.replace(/^\s*/, ``);
|
|
28151
|
-
}
|
|
27130
|
+
if (primary.startsWith(`always`)) afterValue = afterValue.replace(/^\s*/, ` `);
|
|
27131
|
+
else if (primary.startsWith(`never`)) afterValue = afterValue.replace(/^\s*/, ``);
|
|
28152
27132
|
setDeclarationValue(decl, beforeValue + afterValue);
|
|
28153
27133
|
}
|
|
28154
27134
|
}
|
|
@@ -28185,9 +27165,7 @@ function rule$1(primary) {
|
|
|
28185
27165
|
actual: primary,
|
|
28186
27166
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
28187
27167
|
});
|
|
28188
|
-
if (!validOptions)
|
|
28189
|
-
return;
|
|
28190
|
-
}
|
|
27168
|
+
if (!validOptions) return;
|
|
28191
27169
|
let fixData;
|
|
28192
27170
|
valueListCommaWhitespaceChecker({
|
|
28193
27171
|
root: root2,
|
|
@@ -28196,9 +27174,7 @@ function rule$1(primary) {
|
|
|
28196
27174
|
checkedRuleName: ruleName$1,
|
|
28197
27175
|
fix: (declNode, index2) => {
|
|
28198
27176
|
let valueIndex = declarationValueIndex(declNode);
|
|
28199
|
-
if (index2 <= valueIndex)
|
|
28200
|
-
return false;
|
|
28201
|
-
}
|
|
27177
|
+
if (index2 <= valueIndex) return false;
|
|
28202
27178
|
fixData = fixData || /* @__PURE__ */ new Map();
|
|
28203
27179
|
let commaIndices = fixData.get(declNode) || [];
|
|
28204
27180
|
commaIndices.push(index2);
|
|
@@ -28213,11 +27189,8 @@ function rule$1(primary) {
|
|
|
28213
27189
|
let valueIndex = index2 - declarationValueIndex(decl);
|
|
28214
27190
|
let beforeValue = value.slice(0, valueIndex);
|
|
28215
27191
|
let afterValue = value.slice(valueIndex);
|
|
28216
|
-
if (primary.startsWith(`always`))
|
|
28217
|
-
|
|
28218
|
-
} else if (primary.startsWith(`never`)) {
|
|
28219
|
-
beforeValue = beforeValue.replace(/\s*$/, ``);
|
|
28220
|
-
}
|
|
27192
|
+
if (primary.startsWith(`always`)) beforeValue = beforeValue.replace(/\s*$/, ` `);
|
|
27193
|
+
else if (primary.startsWith(`never`)) beforeValue = beforeValue.replace(/\s*$/, ``);
|
|
28221
27194
|
setDeclarationValue(decl, beforeValue + afterValue);
|
|
28222
27195
|
}
|
|
28223
27196
|
}
|
|
@@ -28251,9 +27224,7 @@ function rule(primary) {
|
|
|
28251
27224
|
actual: primary,
|
|
28252
27225
|
possible: isNumber$1
|
|
28253
27226
|
});
|
|
28254
|
-
if (!validOptions)
|
|
28255
|
-
return;
|
|
28256
|
-
}
|
|
27227
|
+
if (!validOptions) return;
|
|
28257
27228
|
let violatedCRLFNewLinesRegex = new RegExp(`(?:\r
|
|
28258
27229
|
){${maxAdjacentNewlines + 1},}`);
|
|
28259
27230
|
let violatedLFNewLinesRegex = new RegExp(`
|