stylelint-config-silverwind 35.0.3 → 35.0.5
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 +854 -1982
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -997,315 +997,270 @@ const { utils: io } = stylelint, ao = { url: "https://github.com/AndyOGo/styleli
|
|
|
997
997
|
};
|
|
998
998
|
ho.primaryOptionArray = true, ho.ruleName = Dr, ho.messages = lo, ho.meta = ao;
|
|
999
999
|
const vo = stylelint.createPlugin(Dr, ho);
|
|
1000
|
-
function
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
hasRequiredMatchesStringOrRegExp = 1;
|
|
1009
|
-
matchesStringOrRegExp$1 = function matchesStringOrRegExp2(input2, comparison) {
|
|
1010
|
-
if (!Array.isArray(input2)) {
|
|
1011
|
-
return testAgainstStringOrArray(input2, comparison);
|
|
1012
|
-
}
|
|
1013
|
-
for (const inputItem of input2) {
|
|
1014
|
-
const testResult = testAgainstStringOrArray(inputItem, comparison);
|
|
1015
|
-
if (testResult) {
|
|
1016
|
-
return testResult;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
return false;
|
|
1020
|
-
};
|
|
1021
|
-
function testAgainstStringOrArray(value, comparison) {
|
|
1022
|
-
if (!Array.isArray(comparison)) {
|
|
1023
|
-
return testAgainstString(value, comparison);
|
|
1000
|
+
function matchesStringOrRegExp$1(input2, comparison) {
|
|
1001
|
+
if (!Array.isArray(input2)) {
|
|
1002
|
+
return testAgainstStringOrArray(input2, comparison);
|
|
1003
|
+
}
|
|
1004
|
+
for (const inputItem of input2) {
|
|
1005
|
+
const testResult = testAgainstStringOrArray(inputItem, comparison);
|
|
1006
|
+
if (testResult) {
|
|
1007
|
+
return testResult;
|
|
1024
1008
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1009
|
+
}
|
|
1010
|
+
return false;
|
|
1011
|
+
}
|
|
1012
|
+
function testAgainstStringOrArray(value, comparison) {
|
|
1013
|
+
if (!Array.isArray(comparison)) {
|
|
1014
|
+
return testAgainstString(value, comparison);
|
|
1015
|
+
}
|
|
1016
|
+
for (const comparisonItem of comparison) {
|
|
1017
|
+
const testResult = testAgainstString(value, comparisonItem);
|
|
1018
|
+
if (testResult) {
|
|
1019
|
+
return testResult;
|
|
1030
1020
|
}
|
|
1031
|
-
return false;
|
|
1032
1021
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
return
|
|
1044
|
-
}
|
|
1045
|
-
return
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
*/
|
|
1064
|
-
prefix(prop) {
|
|
1065
|
-
const match = prop.match(/^(-\w+-)/);
|
|
1066
|
-
if (match) {
|
|
1067
|
-
return match[0];
|
|
1068
|
-
}
|
|
1069
|
-
return "";
|
|
1070
|
-
},
|
|
1071
|
-
/**
|
|
1072
|
-
* Returns the input string stripped of its vendor prefix.
|
|
1073
|
-
*
|
|
1074
|
-
* @param {string} prop String with or without vendor prefix.
|
|
1075
|
-
*
|
|
1076
|
-
* @return {string} String name without vendor prefixes.
|
|
1077
|
-
*
|
|
1078
|
-
* @example
|
|
1079
|
-
* vendorPrefixes.unprefixed('-moz-tab-size') //=> 'tab-size'
|
|
1080
|
-
*/
|
|
1081
|
-
unprefixed(prop) {
|
|
1082
|
-
return prop.replace(/^-\w+-/, "");
|
|
1022
|
+
return false;
|
|
1023
|
+
}
|
|
1024
|
+
function testAgainstString(value, comparison) {
|
|
1025
|
+
const firstComparisonChar = comparison[0];
|
|
1026
|
+
const lastComparisonChar = comparison[comparison.length - 1];
|
|
1027
|
+
const secondToLastComparisonChar = comparison[comparison.length - 2];
|
|
1028
|
+
const comparisonIsRegex = firstComparisonChar === "/" && (lastComparisonChar === "/" || secondToLastComparisonChar === "/" && lastComparisonChar === "i");
|
|
1029
|
+
const hasCaseInsensitiveFlag = comparisonIsRegex && lastComparisonChar === "i";
|
|
1030
|
+
if (comparisonIsRegex) {
|
|
1031
|
+
const valueMatches = hasCaseInsensitiveFlag ? new RegExp(comparison.slice(1, -2), "i").test(value) : new RegExp(comparison.slice(1, -1)).test(value);
|
|
1032
|
+
return valueMatches ? { match: value, pattern: comparison } : false;
|
|
1033
|
+
}
|
|
1034
|
+
return value === comparison ? { match: value, pattern: comparison } : false;
|
|
1035
|
+
}
|
|
1036
|
+
const vendorPrefixes = {
|
|
1037
|
+
/**
|
|
1038
|
+
* Returns the vendor prefix extracted from an input string.
|
|
1039
|
+
*
|
|
1040
|
+
* @param {string} prop String with or without vendor prefix.
|
|
1041
|
+
*
|
|
1042
|
+
* @return {string} vendor prefix or empty string
|
|
1043
|
+
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* vendorPrefixes.prefix('-moz-tab-size') //=> '-moz-'
|
|
1046
|
+
* vendorPrefixes.prefix('tab-size') //=> ''
|
|
1047
|
+
*/
|
|
1048
|
+
prefix(prop) {
|
|
1049
|
+
const match = prop.match(/^(-\w+-)/);
|
|
1050
|
+
if (match) {
|
|
1051
|
+
return match[0];
|
|
1083
1052
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
{
|
|
1251
|
-
property: "overflow",
|
|
1252
|
-
value: "visible",
|
|
1253
|
-
ignoredProperties: ["resize"]
|
|
1053
|
+
return "";
|
|
1054
|
+
},
|
|
1055
|
+
/**
|
|
1056
|
+
* Returns the input string stripped of its vendor prefix.
|
|
1057
|
+
*
|
|
1058
|
+
* @param {string} prop String with or without vendor prefix.
|
|
1059
|
+
*
|
|
1060
|
+
* @return {string} String name without vendor prefixes.
|
|
1061
|
+
*
|
|
1062
|
+
* @example
|
|
1063
|
+
* vendorPrefixes.unprefixed('-moz-tab-size') //=> 'tab-size'
|
|
1064
|
+
*/
|
|
1065
|
+
unprefixed(prop) {
|
|
1066
|
+
return prop.replace(/^-\w+-/, "");
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
const report$Y = stylelint.utils.report;
|
|
1070
|
+
const ruleMessages$1d = stylelint.utils.ruleMessages;
|
|
1071
|
+
const validateOptions$1d = stylelint.utils.validateOptions;
|
|
1072
|
+
const ruleName$1e = "plugin/declaration-block-no-ignored-properties";
|
|
1073
|
+
const messages$1e = ruleMessages$1d(ruleName$1e, {
|
|
1074
|
+
rejected: (ignore, cause) => `Unexpected "${ignore}" with "${cause}"`
|
|
1075
|
+
});
|
|
1076
|
+
const ignored = [
|
|
1077
|
+
{
|
|
1078
|
+
property: "display",
|
|
1079
|
+
value: "inline",
|
|
1080
|
+
ignoredProperties: [
|
|
1081
|
+
"width",
|
|
1082
|
+
"min-width",
|
|
1083
|
+
"max-width",
|
|
1084
|
+
"height",
|
|
1085
|
+
"min-height",
|
|
1086
|
+
"max-height",
|
|
1087
|
+
"margin",
|
|
1088
|
+
"margin-top",
|
|
1089
|
+
"margin-bottom",
|
|
1090
|
+
"overflow",
|
|
1091
|
+
"overflow-x",
|
|
1092
|
+
"overflow-y",
|
|
1093
|
+
"inline-size",
|
|
1094
|
+
"min-inline-size",
|
|
1095
|
+
"max-inline-size",
|
|
1096
|
+
"block-size",
|
|
1097
|
+
"min-block-size",
|
|
1098
|
+
"max-block-size",
|
|
1099
|
+
"margin-block-start",
|
|
1100
|
+
"margin-block-end",
|
|
1101
|
+
"overflow-block",
|
|
1102
|
+
"overflow-inline"
|
|
1103
|
+
]
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
property: "display",
|
|
1107
|
+
value: "list-item",
|
|
1108
|
+
ignoredProperties: ["vertical-align"]
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
property: "display",
|
|
1112
|
+
value: "block",
|
|
1113
|
+
ignoredProperties: ["vertical-align"]
|
|
1114
|
+
},
|
|
1115
|
+
{ property: "display", value: "flex", ignoredProperties: ["vertical-align"] },
|
|
1116
|
+
{
|
|
1117
|
+
property: "display",
|
|
1118
|
+
value: "table",
|
|
1119
|
+
ignoredProperties: ["vertical-align"]
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
property: "display",
|
|
1123
|
+
value: "/^table-(row|row-group|column|column-group|header-group|footer-group|cell)$/",
|
|
1124
|
+
ignoredProperties: [
|
|
1125
|
+
"margin",
|
|
1126
|
+
"margin-top",
|
|
1127
|
+
"margin-right",
|
|
1128
|
+
"margin-bottom",
|
|
1129
|
+
"margin-left",
|
|
1130
|
+
"margin-block-start",
|
|
1131
|
+
"margin-inline-end",
|
|
1132
|
+
"margin-block-end",
|
|
1133
|
+
"margin-inline-start"
|
|
1134
|
+
]
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
property: "display",
|
|
1138
|
+
value: "/^table-(row|row-group|column|column-group|header-group|footer-group)$/",
|
|
1139
|
+
ignoredProperties: [
|
|
1140
|
+
"padding",
|
|
1141
|
+
"padding-top",
|
|
1142
|
+
"padding-right",
|
|
1143
|
+
"padding-bottom",
|
|
1144
|
+
"padding-left",
|
|
1145
|
+
"padding-block-start",
|
|
1146
|
+
"padding-inline-end",
|
|
1147
|
+
"padding-block-end",
|
|
1148
|
+
"padding-inline-start"
|
|
1149
|
+
]
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
property: "display",
|
|
1153
|
+
value: "/^table-(row|row-group|column|column-group|header-group|footer-group|caption)$/",
|
|
1154
|
+
ignoredProperties: ["vertical-align"]
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
property: "display",
|
|
1158
|
+
value: "/^table-(row|row-group)$/",
|
|
1159
|
+
ignoredProperties: [
|
|
1160
|
+
"width",
|
|
1161
|
+
"min-width",
|
|
1162
|
+
"max-width",
|
|
1163
|
+
"inline-size",
|
|
1164
|
+
"min-inline-size",
|
|
1165
|
+
"max-inline-size"
|
|
1166
|
+
]
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
property: "display",
|
|
1170
|
+
value: "/^table-(column|column-group)$/",
|
|
1171
|
+
ignoredProperties: [
|
|
1172
|
+
"height",
|
|
1173
|
+
"min-height",
|
|
1174
|
+
"max-height",
|
|
1175
|
+
"block-size",
|
|
1176
|
+
"min-block-size",
|
|
1177
|
+
"max-block-size"
|
|
1178
|
+
]
|
|
1179
|
+
},
|
|
1180
|
+
{ property: "float", value: "left", ignoredProperties: ["vertical-align"] },
|
|
1181
|
+
{ property: "float", value: "right", ignoredProperties: ["vertical-align"] },
|
|
1182
|
+
{
|
|
1183
|
+
property: "position",
|
|
1184
|
+
value: "static",
|
|
1185
|
+
ignoredProperties: [
|
|
1186
|
+
"top",
|
|
1187
|
+
"right",
|
|
1188
|
+
"bottom",
|
|
1189
|
+
"left",
|
|
1190
|
+
"z-index",
|
|
1191
|
+
"inset-block-start",
|
|
1192
|
+
"inset-inline-end",
|
|
1193
|
+
"inset-block-end",
|
|
1194
|
+
"inset-inline-start"
|
|
1195
|
+
]
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
property: "position",
|
|
1199
|
+
value: "absolute",
|
|
1200
|
+
ignoredProperties: ["float", "clear", "vertical-align"]
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
property: "position",
|
|
1204
|
+
value: "fixed",
|
|
1205
|
+
ignoredProperties: ["float", "clear", "vertical-align"]
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
property: "list-style-type",
|
|
1209
|
+
value: "none",
|
|
1210
|
+
ignoredProperties: ["list-style-image"]
|
|
1211
|
+
},
|
|
1212
|
+
{ property: "overflow", value: "visible", ignoredProperties: ["resize"] }
|
|
1213
|
+
];
|
|
1214
|
+
const rule$1f = (actual) => {
|
|
1215
|
+
return (root2, result2) => {
|
|
1216
|
+
const validOptions = validateOptions$1d(result2, ruleName$1e, { actual });
|
|
1217
|
+
if (!validOptions) {
|
|
1218
|
+
return;
|
|
1254
1219
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
const
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
);
|
|
1281
|
-
if (!matchProperty || !matchValue) {
|
|
1220
|
+
root2.walkRules((rule$) => {
|
|
1221
|
+
const uniqueDecls = {};
|
|
1222
|
+
rule$.walkDecls((decl) => {
|
|
1223
|
+
uniqueDecls[decl.prop] = decl;
|
|
1224
|
+
});
|
|
1225
|
+
function check(prop, index2) {
|
|
1226
|
+
const decl = uniqueDecls[prop];
|
|
1227
|
+
const value = decl.value;
|
|
1228
|
+
const unprefixedProp = vendorPrefixes.unprefixed(prop);
|
|
1229
|
+
const unprefixedValue = vendorPrefixes.unprefixed(value);
|
|
1230
|
+
ignored.forEach((ignore) => {
|
|
1231
|
+
const matchProperty = matchesStringOrRegExp$1(
|
|
1232
|
+
unprefixedProp.toLowerCase(),
|
|
1233
|
+
ignore.property
|
|
1234
|
+
);
|
|
1235
|
+
const matchValue = matchesStringOrRegExp$1(
|
|
1236
|
+
unprefixedValue.toLowerCase(),
|
|
1237
|
+
ignore.value
|
|
1238
|
+
);
|
|
1239
|
+
if (!matchProperty || !matchValue) {
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
const ignoredProperties = ignore.ignoredProperties;
|
|
1243
|
+
decl.parent.nodes.forEach((node2, nodeIndex) => {
|
|
1244
|
+
if (!node2.prop || ignoredProperties.indexOf(node2.prop.toLowerCase()) === -1 || index2 === nodeIndex) {
|
|
1282
1245
|
return;
|
|
1283
1246
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
report2({
|
|
1290
|
-
message: messages2.rejected(node2.prop, decl.toString()),
|
|
1291
|
-
node: node2,
|
|
1292
|
-
result: result2,
|
|
1293
|
-
ruleName: ruleName2
|
|
1294
|
-
});
|
|
1247
|
+
report$Y({
|
|
1248
|
+
message: messages$1e.rejected(node2.prop, decl.toString()),
|
|
1249
|
+
node: node2,
|
|
1250
|
+
result: result2,
|
|
1251
|
+
ruleName: ruleName$1e
|
|
1295
1252
|
});
|
|
1296
1253
|
});
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
};
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
Object.keys(uniqueDecls).forEach(check);
|
|
1257
|
+
});
|
|
1301
1258
|
};
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
return
|
|
1259
|
+
};
|
|
1260
|
+
const declarationBlockNoIgnoredProperties = stylelint.createPlugin(ruleName$1e, rule$1f);
|
|
1261
|
+
function getDefaultExportFromCjs(x2) {
|
|
1262
|
+
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
1306
1263
|
}
|
|
1307
|
-
var stylelintDeclarationBlockNoIgnoredPropertiesExports = requireStylelintDeclarationBlockNoIgnoredProperties();
|
|
1308
|
-
const declarationBlockNoIgnoredProperties = /* @__PURE__ */ getDefaultExportFromCjs(stylelintDeclarationBlockNoIgnoredPropertiesExports);
|
|
1309
1264
|
var picocolors = { exports: {} };
|
|
1310
1265
|
var hasRequiredPicocolors;
|
|
1311
1266
|
function requirePicocolors() {
|
|
@@ -9152,10 +9107,6 @@ ruleFunction.meta = meta$1d;
|
|
|
9152
9107
|
const valueNoUnknownCustomProperties = stylelint.createPlugin(ruleName$1d, ruleFunction);
|
|
9153
9108
|
const isMethodEnabled = (method) => method === true;
|
|
9154
9109
|
const isMethodDisabled = (method) => method === null || method === false;
|
|
9155
|
-
let namespace$1 = `@stylistic`;
|
|
9156
|
-
function addNamespace(ruleName2) {
|
|
9157
|
-
return `${namespace$1}/${ruleName2}`;
|
|
9158
|
-
}
|
|
9159
9110
|
const rules = {
|
|
9160
9111
|
get "at-rule-name-case"() {
|
|
9161
9112
|
return Promise.resolve().then(() => index$1c).then((m2) => m2.default);
|
|
@@ -9389,6 +9340,10 @@ const rules = {
|
|
|
9389
9340
|
return Promise.resolve().then(() => index).then((m2) => m2.default);
|
|
9390
9341
|
}
|
|
9391
9342
|
};
|
|
9343
|
+
let namespace$1 = `@stylistic`;
|
|
9344
|
+
function addNamespace(ruleName2) {
|
|
9345
|
+
return `${namespace$1}/${ruleName2}`;
|
|
9346
|
+
}
|
|
9392
9347
|
let rulesPlugins = Object.keys(rules).map((name) => stylelint.createPlugin(addNamespace(name), rules[name]));
|
|
9393
9348
|
var lib$6 = {};
|
|
9394
9349
|
var Parser = {};
|
|
@@ -14523,15 +14478,9 @@ function getRuleDocUrl(shortName2) {
|
|
|
14523
14478
|
return `https://github.com/stylelint-stylistic/stylelint-stylistic/blob/main/lib/rules/${shortName2}/README.md`;
|
|
14524
14479
|
}
|
|
14525
14480
|
function isStandardSyntaxAtRule(atRule2) {
|
|
14526
|
-
if (!atRule2.nodes && atRule2.params === ``)
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
if (`mixin` in atRule2 && atRule2.mixin) {
|
|
14530
|
-
return false;
|
|
14531
|
-
}
|
|
14532
|
-
if (`variable` in atRule2 && atRule2.variable || !atRule2.nodes && atRule2.raws.afterName === `` && atRule2.params[0] === `(`) {
|
|
14533
|
-
return false;
|
|
14534
|
-
}
|
|
14481
|
+
if (!atRule2.nodes && atRule2.params === ``) return false;
|
|
14482
|
+
if (`mixin` in atRule2 && atRule2.mixin) return false;
|
|
14483
|
+
if (`variable` in atRule2 && atRule2.variable || !atRule2.nodes && atRule2.raws.afterName === `` && atRule2.params[0] === `(`) return false;
|
|
14535
14484
|
return true;
|
|
14536
14485
|
}
|
|
14537
14486
|
let { utils: { report: report$X, ruleMessages: ruleMessages$1c, validateOptions: validateOptions$1c } } = stylelint;
|
|
@@ -14550,19 +14499,13 @@ function rule$1c(primary) {
|
|
|
14550
14499
|
actual: primary,
|
|
14551
14500
|
possible: [`lower`, `upper`]
|
|
14552
14501
|
});
|
|
14553
|
-
if (!validOptions)
|
|
14554
|
-
return;
|
|
14555
|
-
}
|
|
14502
|
+
if (!validOptions) return;
|
|
14556
14503
|
let expectation = primary;
|
|
14557
14504
|
root2.walkAtRules((atRule2) => {
|
|
14558
|
-
if (!isStandardSyntaxAtRule(atRule2))
|
|
14559
|
-
return;
|
|
14560
|
-
}
|
|
14505
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14561
14506
|
let name = atRule2.name;
|
|
14562
14507
|
let expectedName = expectation === `lower` ? name.toLowerCase() : name.toUpperCase();
|
|
14563
|
-
if (name === expectedName)
|
|
14564
|
-
return;
|
|
14565
|
-
}
|
|
14508
|
+
if (name === expectedName) return;
|
|
14566
14509
|
report$X({
|
|
14567
14510
|
message: messages$1c.expected,
|
|
14568
14511
|
messageArgs: [name, expectedName],
|
|
@@ -14589,9 +14532,7 @@ const index$1c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
|
14589
14532
|
let { utils: { report: report$W } } = stylelint;
|
|
14590
14533
|
function atRuleNameSpaceChecker(options) {
|
|
14591
14534
|
options.root.walkAtRules((atRule2) => {
|
|
14592
|
-
if (!isStandardSyntaxAtRule(atRule2))
|
|
14593
|
-
return;
|
|
14594
|
-
}
|
|
14535
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14595
14536
|
checkColon(
|
|
14596
14537
|
`@${atRule2.name}${atRule2.raws.afterName || ``}${atRule2.params}`,
|
|
14597
14538
|
atRule2.name.length,
|
|
@@ -14655,11 +14596,8 @@ function isString(value) {
|
|
|
14655
14596
|
return typeof value === `string` || value instanceof String;
|
|
14656
14597
|
}
|
|
14657
14598
|
function assert(value, message = void 0) {
|
|
14658
|
-
if (message)
|
|
14659
|
-
|
|
14660
|
-
} else {
|
|
14661
|
-
console.assert(value);
|
|
14662
|
-
}
|
|
14599
|
+
if (message) console.assert(value, message);
|
|
14600
|
+
else console.assert(value);
|
|
14663
14601
|
}
|
|
14664
14602
|
function assertFunction(value) {
|
|
14665
14603
|
console.assert(isFunction(value), `"${value}" must be a function`);
|
|
@@ -14694,27 +14632,19 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14694
14632
|
rejectBefore();
|
|
14695
14633
|
break;
|
|
14696
14634
|
case `always-single-line`:
|
|
14697
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14698
|
-
return;
|
|
14699
|
-
}
|
|
14635
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14700
14636
|
expectBefore(messages2.expectedBeforeSingleLine);
|
|
14701
14637
|
break;
|
|
14702
14638
|
case `never-single-line`:
|
|
14703
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14704
|
-
return;
|
|
14705
|
-
}
|
|
14639
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14706
14640
|
rejectBefore(messages2.rejectedBeforeSingleLine);
|
|
14707
14641
|
break;
|
|
14708
14642
|
case `always-multi-line`:
|
|
14709
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14710
|
-
return;
|
|
14711
|
-
}
|
|
14643
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14712
14644
|
expectBefore(messages2.expectedBeforeMultiLine);
|
|
14713
14645
|
break;
|
|
14714
14646
|
case `never-multi-line`:
|
|
14715
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14716
|
-
return;
|
|
14717
|
-
}
|
|
14647
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14718
14648
|
rejectBefore(messages2.rejectedBeforeMultiLine);
|
|
14719
14649
|
break;
|
|
14720
14650
|
default:
|
|
@@ -14731,27 +14661,19 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14731
14661
|
rejectAfter();
|
|
14732
14662
|
break;
|
|
14733
14663
|
case `always-single-line`:
|
|
14734
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14735
|
-
return;
|
|
14736
|
-
}
|
|
14664
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14737
14665
|
expectAfter(messages2.expectedAfterSingleLine);
|
|
14738
14666
|
break;
|
|
14739
14667
|
case `never-single-line`:
|
|
14740
|
-
if (!isSingleLineString(lineCheckStr || source))
|
|
14741
|
-
return;
|
|
14742
|
-
}
|
|
14668
|
+
if (!isSingleLineString(lineCheckStr || source)) return;
|
|
14743
14669
|
rejectAfter(messages2.rejectedAfterSingleLine);
|
|
14744
14670
|
break;
|
|
14745
14671
|
case `always-multi-line`:
|
|
14746
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14747
|
-
return;
|
|
14748
|
-
}
|
|
14672
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14749
14673
|
expectAfter(messages2.expectedAfterMultiLine);
|
|
14750
14674
|
break;
|
|
14751
14675
|
case `never-multi-line`:
|
|
14752
|
-
if (isSingleLineString(lineCheckStr || source))
|
|
14753
|
-
return;
|
|
14754
|
-
}
|
|
14676
|
+
if (isSingleLineString(lineCheckStr || source)) return;
|
|
14755
14677
|
rejectAfter(messages2.rejectedAfterMultiLine);
|
|
14756
14678
|
break;
|
|
14757
14679
|
default:
|
|
@@ -14771,12 +14693,8 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14771
14693
|
let index2 = _activeArgs.index;
|
|
14772
14694
|
let oneCharBefore = source[index2 - 1];
|
|
14773
14695
|
let twoCharsBefore = source[index2 - 2];
|
|
14774
|
-
if (isNullish(oneCharBefore))
|
|
14775
|
-
|
|
14776
|
-
}
|
|
14777
|
-
if (targetWhitespace === `space` && oneCharBefore === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsBefore) || !isWhitespace$1(twoCharsBefore))) {
|
|
14778
|
-
return;
|
|
14779
|
-
}
|
|
14696
|
+
if (isNullish(oneCharBefore)) return;
|
|
14697
|
+
if (targetWhitespace === `space` && oneCharBefore === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsBefore) || !isWhitespace$1(twoCharsBefore))) return;
|
|
14780
14698
|
assertFunction(messageFunc);
|
|
14781
14699
|
activeArgs.err(messageFunc(activeArgs.errTarget || source.charAt(index2)));
|
|
14782
14700
|
}
|
|
@@ -14818,22 +14736,14 @@ function whitespaceChecker(targetWhitespace, expectation, messages2) {
|
|
|
14818
14736
|
let oneCharAfter = source[index2 + 1];
|
|
14819
14737
|
let twoCharsAfter = source[index2 + 2];
|
|
14820
14738
|
let threeCharsAfter = source[index2 + 3];
|
|
14821
|
-
if (isNullish(oneCharAfter))
|
|
14822
|
-
return;
|
|
14823
|
-
}
|
|
14739
|
+
if (isNullish(oneCharAfter)) return;
|
|
14824
14740
|
if (targetWhitespace === `newline`) {
|
|
14825
14741
|
if (oneCharAfter === `\r` && twoCharsAfter === `
|
|
14826
|
-
` && (activeArgs.onlyOneChar || isNullish(threeCharsAfter) || !isWhitespace$1(threeCharsAfter)))
|
|
14827
|
-
return;
|
|
14828
|
-
}
|
|
14742
|
+
` && (activeArgs.onlyOneChar || isNullish(threeCharsAfter) || !isWhitespace$1(threeCharsAfter))) return;
|
|
14829
14743
|
if (oneCharAfter === `
|
|
14830
|
-
` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter)))
|
|
14831
|
-
return;
|
|
14832
|
-
}
|
|
14833
|
-
}
|
|
14834
|
-
if (targetWhitespace === `space` && oneCharAfter === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter))) {
|
|
14835
|
-
return;
|
|
14744
|
+
` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter))) return;
|
|
14836
14745
|
}
|
|
14746
|
+
if (targetWhitespace === `space` && oneCharAfter === ` ` && (activeArgs.onlyOneChar || isNullish(twoCharsAfter) || !isWhitespace$1(twoCharsAfter))) return;
|
|
14837
14747
|
assertFunction(messageFunc);
|
|
14838
14748
|
activeArgs.err(messageFunc(activeArgs.errTarget || source.charAt(index2)));
|
|
14839
14749
|
}
|
|
@@ -14870,9 +14780,7 @@ function rule$1b(primary) {
|
|
|
14870
14780
|
actual: primary,
|
|
14871
14781
|
possible: [`always`, `always-multi-line`]
|
|
14872
14782
|
});
|
|
14873
|
-
if (!validOptions)
|
|
14874
|
-
return;
|
|
14875
|
-
}
|
|
14783
|
+
if (!validOptions) return;
|
|
14876
14784
|
atRuleNameSpaceChecker({
|
|
14877
14785
|
root: root2,
|
|
14878
14786
|
result: result2,
|
|
@@ -14908,18 +14816,14 @@ function rule$1a(primary) {
|
|
|
14908
14816
|
actual: primary,
|
|
14909
14817
|
possible: [`always`, `always-single-line`]
|
|
14910
14818
|
});
|
|
14911
|
-
if (!validOptions)
|
|
14912
|
-
return;
|
|
14913
|
-
}
|
|
14819
|
+
if (!validOptions) return;
|
|
14914
14820
|
atRuleNameSpaceChecker({
|
|
14915
14821
|
root: root2,
|
|
14916
14822
|
result: result2,
|
|
14917
14823
|
locationChecker: checker.after,
|
|
14918
14824
|
checkedRuleName: ruleName$1a,
|
|
14919
14825
|
fix: (atRule2) => {
|
|
14920
|
-
if (typeof atRule2.raws.afterName === `string`)
|
|
14921
|
-
atRule2.raws.afterName = atRule2.raws.afterName.replace(/^\s*/, ` `);
|
|
14922
|
-
}
|
|
14826
|
+
if (typeof atRule2.raws.afterName === `string`) atRule2.raws.afterName = atRule2.raws.afterName.replace(/^\s*/, ` `);
|
|
14923
14827
|
}
|
|
14924
14828
|
});
|
|
14925
14829
|
};
|
|
@@ -14938,19 +14842,13 @@ function hasBlock(statement) {
|
|
|
14938
14842
|
return statement.nodes !== void 0;
|
|
14939
14843
|
}
|
|
14940
14844
|
function nextNonCommentNode(startNode) {
|
|
14941
|
-
if (!startNode || !startNode.next)
|
|
14942
|
-
|
|
14943
|
-
}
|
|
14944
|
-
if (startNode.type === `comment`) {
|
|
14945
|
-
return nextNonCommentNode(startNode.next());
|
|
14946
|
-
}
|
|
14845
|
+
if (!startNode || !startNode.next) return null;
|
|
14846
|
+
if (startNode.type === `comment`) return nextNonCommentNode(startNode.next());
|
|
14947
14847
|
return startNode;
|
|
14948
14848
|
}
|
|
14949
14849
|
function rawNodeString(node2) {
|
|
14950
14850
|
let result2 = ``;
|
|
14951
|
-
if (node2.raws.before)
|
|
14952
|
-
result2 += node2.raws.before;
|
|
14953
|
-
}
|
|
14851
|
+
if (node2.raws.before) result2 += node2.raws.before;
|
|
14954
14852
|
result2 += node2.toString();
|
|
14955
14853
|
return result2;
|
|
14956
14854
|
}
|
|
@@ -14971,24 +14869,14 @@ function rule$19(primary, _secondary, context) {
|
|
|
14971
14869
|
actual: primary,
|
|
14972
14870
|
possible: [`always`]
|
|
14973
14871
|
});
|
|
14974
|
-
if (!validOptions)
|
|
14975
|
-
return;
|
|
14976
|
-
}
|
|
14872
|
+
if (!validOptions) return;
|
|
14977
14873
|
root2.walkAtRules((atRule2) => {
|
|
14978
14874
|
let nextNode = atRule2.next();
|
|
14979
|
-
if (!nextNode)
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
if (hasBlock(atRule2)) {
|
|
14983
|
-
return;
|
|
14984
|
-
}
|
|
14985
|
-
if (!isStandardSyntaxAtRule(atRule2)) {
|
|
14986
|
-
return;
|
|
14987
|
-
}
|
|
14875
|
+
if (!nextNode) return;
|
|
14876
|
+
if (hasBlock(atRule2)) return;
|
|
14877
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
14988
14878
|
let nodeToCheck = nextNonCommentNode(nextNode);
|
|
14989
|
-
if (!nodeToCheck)
|
|
14990
|
-
return;
|
|
14991
|
-
}
|
|
14879
|
+
if (!nodeToCheck) return;
|
|
14992
14880
|
const problemIndex = atRule2.toString().length + 1;
|
|
14993
14881
|
checker.afterOneOnly({
|
|
14994
14882
|
source: rawNodeString(nodeToCheck),
|
|
@@ -15037,16 +14925,10 @@ function rule$18(primary) {
|
|
|
15037
14925
|
actual: primary,
|
|
15038
14926
|
possible: [`always`, `never`]
|
|
15039
14927
|
});
|
|
15040
|
-
if (!validOptions)
|
|
15041
|
-
return;
|
|
15042
|
-
}
|
|
14928
|
+
if (!validOptions) return;
|
|
15043
14929
|
root2.walkAtRules((atRule2) => {
|
|
15044
|
-
if (hasBlock(atRule2))
|
|
15045
|
-
|
|
15046
|
-
}
|
|
15047
|
-
if (!isStandardSyntaxAtRule(atRule2)) {
|
|
15048
|
-
return;
|
|
15049
|
-
}
|
|
14930
|
+
if (hasBlock(atRule2)) return;
|
|
14931
|
+
if (!isStandardSyntaxAtRule(atRule2)) return;
|
|
15050
14932
|
const nodeString = rawNodeString(atRule2);
|
|
15051
14933
|
const problemIndex = nodeString.length - 1;
|
|
15052
14934
|
checker.before({
|
|
@@ -15078,16 +14960,11 @@ const index$18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
|
15078
14960
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
15079
14961
|
function addEmptyLineAfter(node2, newline) {
|
|
15080
14962
|
let { raws } = node2;
|
|
15081
|
-
if (typeof raws.after !== `string`)
|
|
15082
|
-
return node2;
|
|
15083
|
-
}
|
|
14963
|
+
if (typeof raws.after !== `string`) return node2;
|
|
15084
14964
|
let spaces = raws.after.split(`;`);
|
|
15085
14965
|
let after = spaces[spaces.length - 1] || ``;
|
|
15086
|
-
if (!/\r?\n/.test(after))
|
|
15087
|
-
|
|
15088
|
-
} else {
|
|
15089
|
-
raws.after = raws.after.replace(/(\r?\n)/, `${newline}$1`);
|
|
15090
|
-
}
|
|
14966
|
+
if (!/\r?\n/.test(after)) raws.after += newline.repeat(2);
|
|
14967
|
+
else raws.after = raws.after.replace(/(\r?\n)/, `${newline}$1`);
|
|
15091
14968
|
return node2;
|
|
15092
14969
|
}
|
|
15093
14970
|
function isRoot(node2) {
|
|
@@ -15108,23 +14985,15 @@ function isDeclaration(node2) {
|
|
|
15108
14985
|
function beforeBlockString(statement, { noRawBefore } = { noRawBefore: false }) {
|
|
15109
14986
|
let result2 = ``;
|
|
15110
14987
|
let before = statement.raws.before || ``;
|
|
15111
|
-
if (!noRawBefore)
|
|
15112
|
-
|
|
15113
|
-
}
|
|
15114
|
-
|
|
15115
|
-
result2 += statement.selector;
|
|
15116
|
-
} else if (isAtRule(statement)) {
|
|
15117
|
-
result2 += `@${statement.name}${statement.raws.afterName || ``}${statement.params}`;
|
|
15118
|
-
} else {
|
|
15119
|
-
return ``;
|
|
15120
|
-
}
|
|
14988
|
+
if (!noRawBefore) result2 += before;
|
|
14989
|
+
if (isRule(statement)) result2 += statement.selector;
|
|
14990
|
+
else if (isAtRule(statement)) result2 += `@${statement.name}${statement.raws.afterName || ``}${statement.params}`;
|
|
14991
|
+
else return ``;
|
|
15121
14992
|
result2 += statement.raws.between || ``;
|
|
15122
14993
|
return result2;
|
|
15123
14994
|
}
|
|
15124
14995
|
function blockString(statement) {
|
|
15125
|
-
if (!hasBlock(statement))
|
|
15126
|
-
return ``;
|
|
15127
|
-
}
|
|
14996
|
+
if (!hasBlock(statement)) return ``;
|
|
15128
14997
|
return rawNodeString(statement).slice(beforeBlockString(statement).length);
|
|
15129
14998
|
}
|
|
15130
14999
|
function hasEmptyBlock(statement) {
|
|
@@ -15132,32 +15001,22 @@ function hasEmptyBlock(statement) {
|
|
|
15132
15001
|
}
|
|
15133
15002
|
const HAS_EMPTY_LINE = /\n[\r\t ]*\n/;
|
|
15134
15003
|
function hasEmptyLine(string2) {
|
|
15135
|
-
if (string2 === `` || string2 === void 0)
|
|
15136
|
-
return false;
|
|
15137
|
-
}
|
|
15004
|
+
if (string2 === `` || string2 === void 0) return false;
|
|
15138
15005
|
return HAS_EMPTY_LINE.test(string2);
|
|
15139
15006
|
}
|
|
15140
15007
|
function matchesStringOrRegExp(input2, comparison) {
|
|
15141
|
-
if (!Array.isArray(input2))
|
|
15142
|
-
return testAgainstStringOrRegExpOrArray(input2, comparison);
|
|
15143
|
-
}
|
|
15008
|
+
if (!Array.isArray(input2)) return testAgainstStringOrRegExpOrArray(input2, comparison);
|
|
15144
15009
|
for (let inputItem of input2) {
|
|
15145
15010
|
let testResult = testAgainstStringOrRegExpOrArray(inputItem, comparison);
|
|
15146
|
-
if (testResult)
|
|
15147
|
-
return testResult;
|
|
15148
|
-
}
|
|
15011
|
+
if (testResult) return testResult;
|
|
15149
15012
|
}
|
|
15150
15013
|
return false;
|
|
15151
15014
|
}
|
|
15152
15015
|
function testAgainstStringOrRegExpOrArray(value, comparison) {
|
|
15153
|
-
if (!Array.isArray(comparison))
|
|
15154
|
-
return testAgainstStringOrRegExp(value, comparison);
|
|
15155
|
-
}
|
|
15016
|
+
if (!Array.isArray(comparison)) return testAgainstStringOrRegExp(value, comparison);
|
|
15156
15017
|
for (let comparisonItem of comparison) {
|
|
15157
15018
|
let testResult = testAgainstStringOrRegExp(value, comparisonItem);
|
|
15158
|
-
if (testResult)
|
|
15159
|
-
return testResult;
|
|
15160
|
-
}
|
|
15019
|
+
if (testResult) return testResult;
|
|
15161
15020
|
}
|
|
15162
15021
|
return false;
|
|
15163
15022
|
}
|
|
@@ -15212,32 +15071,22 @@ function rule$17(primary, secondaryOptions, context) {
|
|
|
15212
15071
|
optional: true
|
|
15213
15072
|
}
|
|
15214
15073
|
);
|
|
15215
|
-
if (!validOptions)
|
|
15216
|
-
return;
|
|
15217
|
-
}
|
|
15074
|
+
if (!validOptions) return;
|
|
15218
15075
|
root2.walkRules(check);
|
|
15219
15076
|
root2.walkAtRules(check);
|
|
15220
15077
|
function check(statement) {
|
|
15221
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15222
|
-
return;
|
|
15223
|
-
}
|
|
15078
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15224
15079
|
let before = (statement.raws.after || ``).replace(/;+/, ``);
|
|
15225
15080
|
let statementString = statement.toString();
|
|
15226
15081
|
let index2 = statementString.length - 1;
|
|
15227
|
-
if (statementString[index2 - 1] === `\r`)
|
|
15228
|
-
index2 -= 1;
|
|
15229
|
-
}
|
|
15082
|
+
if (statementString[index2 - 1] === `\r`) index2 -= 1;
|
|
15230
15083
|
let expectEmptyLineBefore = (() => {
|
|
15231
15084
|
let childNodeTypes = statement.nodes.map((item) => item.type);
|
|
15232
|
-
if (optionsMatches(secondaryOptions, `except`, `after-closing-brace`) && !childNodeTypes.includes(`decl`))
|
|
15233
|
-
return primary === `never`;
|
|
15234
|
-
}
|
|
15085
|
+
if (optionsMatches(secondaryOptions, `except`, `after-closing-brace`) && !childNodeTypes.includes(`decl`)) return primary === `never`;
|
|
15235
15086
|
return primary === `always-multi-line` && !isSingleLineString(blockString(statement));
|
|
15236
15087
|
})();
|
|
15237
15088
|
let hasEmptyLineBefore = hasEmptyLine(before);
|
|
15238
|
-
if (expectEmptyLineBefore === hasEmptyLineBefore)
|
|
15239
|
-
return;
|
|
15240
|
-
}
|
|
15089
|
+
if (expectEmptyLineBefore === hasEmptyLineBefore) return;
|
|
15241
15090
|
let message = expectEmptyLineBefore ? messages$17.expected : messages$17.rejected;
|
|
15242
15091
|
report$T({
|
|
15243
15092
|
message,
|
|
@@ -15249,11 +15098,8 @@ function rule$17(primary, secondaryOptions, context) {
|
|
|
15249
15098
|
fix() {
|
|
15250
15099
|
let { newline } = context;
|
|
15251
15100
|
if (typeof newline !== `string`) return;
|
|
15252
|
-
if (expectEmptyLineBefore)
|
|
15253
|
-
|
|
15254
|
-
} else {
|
|
15255
|
-
removeEmptyLinesAfter(statement, newline);
|
|
15256
|
-
}
|
|
15101
|
+
if (expectEmptyLineBefore) addEmptyLineAfter(statement, newline);
|
|
15102
|
+
else removeEmptyLinesAfter(statement, newline);
|
|
15257
15103
|
}
|
|
15258
15104
|
});
|
|
15259
15105
|
}
|
|
@@ -15307,28 +15153,18 @@ function rule$16(primary, secondaryOptions, context) {
|
|
|
15307
15153
|
optional: true
|
|
15308
15154
|
}
|
|
15309
15155
|
);
|
|
15310
|
-
if (!validOptions)
|
|
15311
|
-
return;
|
|
15312
|
-
}
|
|
15156
|
+
if (!validOptions) return;
|
|
15313
15157
|
root2.walkRules(check);
|
|
15314
15158
|
root2.walkAtRules(check);
|
|
15315
15159
|
function check(statement) {
|
|
15316
|
-
if (!hasBlock(statement))
|
|
15317
|
-
|
|
15318
|
-
}
|
|
15319
|
-
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) {
|
|
15320
|
-
return;
|
|
15321
|
-
}
|
|
15160
|
+
if (!hasBlock(statement)) return;
|
|
15161
|
+
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) return;
|
|
15322
15162
|
let nextNode = statement.next();
|
|
15323
|
-
if (!nextNode)
|
|
15324
|
-
return;
|
|
15325
|
-
}
|
|
15163
|
+
if (!nextNode) return;
|
|
15326
15164
|
let nextNodeIsSingleLineComment = nextNode.type === `comment` && !/[^ ]/.test(nextNode.raws.before || ``) && !nextNode.toString().includes(`
|
|
15327
15165
|
`);
|
|
15328
15166
|
let nodeToCheck = nextNodeIsSingleLineComment ? nextNode.next() : nextNode;
|
|
15329
|
-
if (!nodeToCheck)
|
|
15330
|
-
return;
|
|
15331
|
-
}
|
|
15167
|
+
if (!nodeToCheck) return;
|
|
15332
15168
|
let reportIndex = statement.toString().length;
|
|
15333
15169
|
let source = rawNodeString(nodeToCheck);
|
|
15334
15170
|
if (source && source.startsWith(`;`)) {
|
|
@@ -15353,9 +15189,7 @@ function rule$16(primary, secondaryOptions, context) {
|
|
|
15353
15189
|
if (primary.startsWith(`always`)) {
|
|
15354
15190
|
let index2 = nodeToCheckRaws.before.search(/\r?\n/);
|
|
15355
15191
|
nodeToCheckRaws.before = index2 >= 0 ? nodeToCheckRaws.before.slice(index2) : context.newline + nodeToCheckRaws.before;
|
|
15356
|
-
} else if (primary.startsWith(`never`))
|
|
15357
|
-
nodeToCheckRaws.before = ``;
|
|
15358
|
-
}
|
|
15192
|
+
} else if (primary.startsWith(`never`)) nodeToCheckRaws.before = ``;
|
|
15359
15193
|
}
|
|
15360
15194
|
});
|
|
15361
15195
|
}
|
|
@@ -15391,37 +15225,24 @@ function rule$15(primary, _secondaryOptions, context) {
|
|
|
15391
15225
|
actual: primary,
|
|
15392
15226
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
15393
15227
|
});
|
|
15394
|
-
if (!validOptions)
|
|
15395
|
-
return;
|
|
15396
|
-
}
|
|
15228
|
+
if (!validOptions) return;
|
|
15397
15229
|
root2.walkRules(check);
|
|
15398
15230
|
root2.walkAtRules(check);
|
|
15399
15231
|
function check(statement) {
|
|
15400
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15401
|
-
return;
|
|
15402
|
-
}
|
|
15232
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15403
15233
|
let after = (statement.raws.after || ``).replace(/;+/, ``);
|
|
15404
|
-
if (after === void 0)
|
|
15405
|
-
return;
|
|
15406
|
-
}
|
|
15234
|
+
if (after === void 0) return;
|
|
15407
15235
|
let blockIsMultiLine = !isSingleLineString(blockString(statement));
|
|
15408
15236
|
let statementString = statement.toString();
|
|
15409
15237
|
let index2 = statementString.length - 2;
|
|
15410
|
-
if (statementString[index2 - 1] === `\r`)
|
|
15411
|
-
index2 -= 1;
|
|
15412
|
-
}
|
|
15238
|
+
if (statementString[index2 - 1] === `\r`) index2 -= 1;
|
|
15413
15239
|
if (!after.startsWith(`
|
|
15414
15240
|
`) && !after.startsWith(`\r
|
|
15415
15241
|
`)) {
|
|
15416
|
-
if (primary === `always`)
|
|
15417
|
-
|
|
15418
|
-
} else if (blockIsMultiLine && primary === `always-multi-line`) {
|
|
15419
|
-
complain(messages$15.expectedBeforeMultiLine);
|
|
15420
|
-
}
|
|
15421
|
-
}
|
|
15422
|
-
if (after !== `` && blockIsMultiLine && primary === `never-multi-line`) {
|
|
15423
|
-
complain(messages$15.rejectedBeforeMultiLine);
|
|
15242
|
+
if (primary === `always`) complain(messages$15.expectedBefore);
|
|
15243
|
+
else if (blockIsMultiLine && primary === `always-multi-line`) complain(messages$15.expectedBeforeMultiLine);
|
|
15424
15244
|
}
|
|
15245
|
+
if (after !== `` && blockIsMultiLine && primary === `never-multi-line`) complain(messages$15.rejectedBeforeMultiLine);
|
|
15425
15246
|
function complain(message) {
|
|
15426
15247
|
report$R({
|
|
15427
15248
|
message,
|
|
@@ -15439,9 +15260,7 @@ function rule$15(primary, _secondaryOptions, context) {
|
|
|
15439
15260
|
let newlineAfter = firstWhitespaceIndex >= 0 ? statementRaws.after.slice(firstWhitespaceIndex) : ``;
|
|
15440
15261
|
let newlineIndex = newlineAfter.search(/\r?\n/);
|
|
15441
15262
|
statementRaws.after = newlineIndex >= 0 ? newlineBefore + newlineAfter.slice(newlineIndex) : newlineBefore + context.newline + newlineAfter;
|
|
15442
|
-
} else if (primary === `never-multi-line`)
|
|
15443
|
-
statementRaws.after = statementRaws.after.replace(/\s/g, ``);
|
|
15444
|
-
}
|
|
15263
|
+
} else if (primary === `never-multi-line`) statementRaws.after = statementRaws.after.replace(/\s/g, ``);
|
|
15445
15264
|
}
|
|
15446
15265
|
});
|
|
15447
15266
|
}
|
|
@@ -15486,19 +15305,13 @@ function rule$14(primary) {
|
|
|
15486
15305
|
`never-multi-line`
|
|
15487
15306
|
]
|
|
15488
15307
|
});
|
|
15489
|
-
if (!validOptions)
|
|
15490
|
-
return;
|
|
15491
|
-
}
|
|
15308
|
+
if (!validOptions) return;
|
|
15492
15309
|
root2.walkRules(check);
|
|
15493
15310
|
root2.walkAtRules(check);
|
|
15494
15311
|
function check(statement) {
|
|
15495
15312
|
let nextNode = statement.next();
|
|
15496
|
-
if (!nextNode)
|
|
15497
|
-
|
|
15498
|
-
}
|
|
15499
|
-
if (!hasBlock(statement)) {
|
|
15500
|
-
return;
|
|
15501
|
-
}
|
|
15313
|
+
if (!nextNode) return;
|
|
15314
|
+
if (!hasBlock(statement)) return;
|
|
15502
15315
|
let reportIndex = statement.toString().length;
|
|
15503
15316
|
let source = rawNodeString(nextNode);
|
|
15504
15317
|
if (source && source.startsWith(`;`)) {
|
|
@@ -15562,21 +15375,15 @@ function rule$13(primary) {
|
|
|
15562
15375
|
`never-multi-line`
|
|
15563
15376
|
]
|
|
15564
15377
|
});
|
|
15565
|
-
if (!validOptions)
|
|
15566
|
-
return;
|
|
15567
|
-
}
|
|
15378
|
+
if (!validOptions) return;
|
|
15568
15379
|
root2.walkRules(check);
|
|
15569
15380
|
root2.walkAtRules(check);
|
|
15570
15381
|
function check(statement) {
|
|
15571
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15572
|
-
return;
|
|
15573
|
-
}
|
|
15382
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15574
15383
|
let source = blockString(statement);
|
|
15575
15384
|
let statementString = statement.toString();
|
|
15576
15385
|
let index2 = statementString.length - 2;
|
|
15577
|
-
if (statementString[index2 - 1] === `\r`)
|
|
15578
|
-
index2 -= 1;
|
|
15579
|
-
}
|
|
15386
|
+
if (statementString[index2 - 1] === `\r`) index2 -= 1;
|
|
15580
15387
|
checker.before({
|
|
15581
15388
|
source,
|
|
15582
15389
|
index: source.length - 1,
|
|
@@ -15591,11 +15398,8 @@ function rule$13(primary) {
|
|
|
15591
15398
|
fix() {
|
|
15592
15399
|
let statementRaws = statement.raws;
|
|
15593
15400
|
if (typeof statementRaws.after !== `string`) return;
|
|
15594
|
-
if (primary.startsWith(`always`))
|
|
15595
|
-
|
|
15596
|
-
} else if (primary.startsWith(`never`)) {
|
|
15597
|
-
statementRaws.after = statementRaws.after.replace(/\s*$/, ``);
|
|
15598
|
-
}
|
|
15401
|
+
if (primary.startsWith(`always`)) statementRaws.after = statementRaws.after.replace(/\s*$/, ` `);
|
|
15402
|
+
else if (primary.startsWith(`never`)) statementRaws.after = statementRaws.after.replace(/\s*$/, ``);
|
|
15599
15403
|
}
|
|
15600
15404
|
});
|
|
15601
15405
|
}
|
|
@@ -15643,22 +15447,14 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15643
15447
|
optional: true
|
|
15644
15448
|
}
|
|
15645
15449
|
);
|
|
15646
|
-
if (!validOptions)
|
|
15647
|
-
|
|
15648
|
-
}
|
|
15649
|
-
if (!optionsMatches(secondaryOptions, `ignore`, `rules`)) {
|
|
15650
|
-
root2.walkRules(check);
|
|
15651
|
-
}
|
|
15450
|
+
if (!validOptions) return;
|
|
15451
|
+
if (!optionsMatches(secondaryOptions, `ignore`, `rules`)) root2.walkRules(check);
|
|
15652
15452
|
root2.walkAtRules(check);
|
|
15653
15453
|
function check(statement) {
|
|
15654
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15655
|
-
return;
|
|
15656
|
-
}
|
|
15454
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15657
15455
|
let backupCommentNextBefores = /* @__PURE__ */ new Map();
|
|
15658
15456
|
function nextNode(startNode) {
|
|
15659
|
-
if (!startNode || !startNode.next)
|
|
15660
|
-
return;
|
|
15661
|
-
}
|
|
15457
|
+
if (!startNode || !startNode.next) return;
|
|
15662
15458
|
if (startNode.type === `comment`) {
|
|
15663
15459
|
let reNewLine = /\r?\n/;
|
|
15664
15460
|
let newLineMatch = reNewLine.test(startNode.raws.before || ``);
|
|
@@ -15672,9 +15468,7 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15672
15468
|
return startNode;
|
|
15673
15469
|
}
|
|
15674
15470
|
let nodeToCheck = nextNode(statement.first);
|
|
15675
|
-
if (!nodeToCheck)
|
|
15676
|
-
return;
|
|
15677
|
-
}
|
|
15471
|
+
if (!nodeToCheck) return;
|
|
15678
15472
|
const problemIndex = beforeBlockString(statement, { noRawBefore: true }).length + 1;
|
|
15679
15473
|
checker.afterOneOnly({
|
|
15680
15474
|
source: rawNodeString(nodeToCheck),
|
|
@@ -15690,9 +15484,7 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15690
15484
|
ruleName: ruleName$12,
|
|
15691
15485
|
fix() {
|
|
15692
15486
|
let nodeToCheckRaws = nodeToCheck.raws;
|
|
15693
|
-
if (typeof nodeToCheckRaws.before !== `string`)
|
|
15694
|
-
return;
|
|
15695
|
-
}
|
|
15487
|
+
if (typeof nodeToCheckRaws.before !== `string`) return;
|
|
15696
15488
|
if (primary.startsWith(`always`)) {
|
|
15697
15489
|
let index2 = nodeToCheckRaws.before.search(/\r?\n/);
|
|
15698
15490
|
nodeToCheckRaws.before = index2 >= 0 ? nodeToCheckRaws.before.slice(index2) : context.newline + nodeToCheckRaws.before;
|
|
@@ -15700,23 +15492,15 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15700
15492
|
return;
|
|
15701
15493
|
}
|
|
15702
15494
|
if (primary === `never-multi-line`) {
|
|
15703
|
-
for (let [node2, before] of backupCommentNextBefores.entries())
|
|
15704
|
-
node2.raws.before = before;
|
|
15705
|
-
}
|
|
15495
|
+
for (let [node2, before] of backupCommentNextBefores.entries()) node2.raws.before = before;
|
|
15706
15496
|
backupCommentNextBefores.clear();
|
|
15707
15497
|
let reNewLine = /\r?\n/;
|
|
15708
15498
|
let fixTarget = statement.first;
|
|
15709
15499
|
while (fixTarget) {
|
|
15710
15500
|
let fixTargetRaws = fixTarget.raws;
|
|
15711
|
-
if (typeof fixTargetRaws.before !== `string`)
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
if (reNewLine.test(fixTargetRaws.before || ``)) {
|
|
15715
|
-
fixTargetRaws.before = fixTargetRaws.before.replace(/\r?\n/g, ``);
|
|
15716
|
-
}
|
|
15717
|
-
if (fixTarget.type !== `comment`) {
|
|
15718
|
-
break;
|
|
15719
|
-
}
|
|
15501
|
+
if (typeof fixTargetRaws.before !== `string`) continue;
|
|
15502
|
+
if (reNewLine.test(fixTargetRaws.before || ``)) fixTargetRaws.before = fixTargetRaws.before.replace(/\r?\n/g, ``);
|
|
15503
|
+
if (fixTarget.type !== `comment`) break;
|
|
15720
15504
|
fixTarget = fixTarget.next();
|
|
15721
15505
|
}
|
|
15722
15506
|
nodeToCheckRaws.before = ``;
|
|
@@ -15725,9 +15509,7 @@ function rule$12(primary, secondaryOptions, context) {
|
|
|
15725
15509
|
});
|
|
15726
15510
|
}
|
|
15727
15511
|
});
|
|
15728
|
-
for (let [node2, before] of backupCommentNextBefores.entries())
|
|
15729
|
-
node2.raws.before = before;
|
|
15730
|
-
}
|
|
15512
|
+
for (let [node2, before] of backupCommentNextBefores.entries()) node2.raws.before = before;
|
|
15731
15513
|
}
|
|
15732
15514
|
};
|
|
15733
15515
|
}
|
|
@@ -15768,23 +15550,17 @@ function rule$11(primary, _secondaryOptions, context) {
|
|
|
15768
15550
|
`never-multi-line`
|
|
15769
15551
|
]
|
|
15770
15552
|
});
|
|
15771
|
-
if (!validOptions)
|
|
15772
|
-
return;
|
|
15773
|
-
}
|
|
15553
|
+
if (!validOptions) return;
|
|
15774
15554
|
root2.walkRules(check);
|
|
15775
15555
|
root2.walkAtRules(check);
|
|
15776
15556
|
function check(statement) {
|
|
15777
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15778
|
-
return;
|
|
15779
|
-
}
|
|
15557
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15780
15558
|
let source = beforeBlockString(statement);
|
|
15781
15559
|
let beforeBraceNoRaw = beforeBlockString(statement, {
|
|
15782
15560
|
noRawBefore: true
|
|
15783
15561
|
});
|
|
15784
15562
|
let index2 = beforeBraceNoRaw.length - 1;
|
|
15785
|
-
if (beforeBraceNoRaw[index2 - 1] === `\r`)
|
|
15786
|
-
index2 -= 1;
|
|
15787
|
-
}
|
|
15563
|
+
if (beforeBraceNoRaw[index2 - 1] === `\r`) index2 -= 1;
|
|
15788
15564
|
checker.beforeAllowingIndentation({
|
|
15789
15565
|
lineCheckStr: blockString(statement),
|
|
15790
15566
|
source,
|
|
@@ -15801,14 +15577,9 @@ function rule$11(primary, _secondaryOptions, context) {
|
|
|
15801
15577
|
if (typeof statement.raws.between !== `string`) return;
|
|
15802
15578
|
if (primary.startsWith(`always`)) {
|
|
15803
15579
|
let spaceIndex = statement.raws.between.search(/\s+$/);
|
|
15804
|
-
if (spaceIndex >= 0)
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
statement.raws.between += context.newline;
|
|
15808
|
-
}
|
|
15809
|
-
} else if (primary.startsWith(`never`)) {
|
|
15810
|
-
statement.raws.between = statement.raws.between.replace(/\s*$/, ``);
|
|
15811
|
-
}
|
|
15580
|
+
if (spaceIndex >= 0) statement.raws.between = statement.raws.between.slice(0, spaceIndex) + context.newline + statement.raws.between.slice(spaceIndex);
|
|
15581
|
+
else statement.raws.between += context.newline;
|
|
15582
|
+
} else if (primary.startsWith(`never`)) statement.raws.between = statement.raws.between.replace(/\s*$/, ``);
|
|
15812
15583
|
}
|
|
15813
15584
|
});
|
|
15814
15585
|
}
|
|
@@ -15866,17 +15637,11 @@ function rule$10(primary, secondaryOptions) {
|
|
|
15866
15637
|
optional: true
|
|
15867
15638
|
}
|
|
15868
15639
|
);
|
|
15869
|
-
if (!validOptions)
|
|
15870
|
-
return;
|
|
15871
|
-
}
|
|
15640
|
+
if (!validOptions) return;
|
|
15872
15641
|
root2.walkRules(check);
|
|
15873
|
-
if (!optionsMatches(secondaryOptions, `ignore`, `at-rules`))
|
|
15874
|
-
root2.walkAtRules(check);
|
|
15875
|
-
}
|
|
15642
|
+
if (!optionsMatches(secondaryOptions, `ignore`, `at-rules`)) root2.walkAtRules(check);
|
|
15876
15643
|
function check(statement) {
|
|
15877
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15878
|
-
return;
|
|
15879
|
-
}
|
|
15644
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15880
15645
|
const problemIndex = beforeBlockString(statement, { noRawBefore: true }).length + 1;
|
|
15881
15646
|
checker.after({
|
|
15882
15647
|
source: blockString(statement),
|
|
@@ -15892,11 +15657,8 @@ function rule$10(primary, secondaryOptions) {
|
|
|
15892
15657
|
fix() {
|
|
15893
15658
|
let statementFirst = statement.first;
|
|
15894
15659
|
if (statementFirst === null) return;
|
|
15895
|
-
if (primary.startsWith(`always`))
|
|
15896
|
-
|
|
15897
|
-
} else if (primary.startsWith(`never`)) {
|
|
15898
|
-
statementFirst.raws.before = ``;
|
|
15899
|
-
}
|
|
15660
|
+
if (primary.startsWith(`always`)) statementFirst.raws.before = ` `;
|
|
15661
|
+
else if (primary.startsWith(`never`)) statementFirst.raws.before = ``;
|
|
15900
15662
|
}
|
|
15901
15663
|
});
|
|
15902
15664
|
}
|
|
@@ -15955,29 +15717,19 @@ function rule$$(primary, secondaryOptions) {
|
|
|
15955
15717
|
optional: true
|
|
15956
15718
|
}
|
|
15957
15719
|
);
|
|
15958
|
-
if (!validOptions)
|
|
15959
|
-
return;
|
|
15960
|
-
}
|
|
15720
|
+
if (!validOptions) return;
|
|
15961
15721
|
root2.walkRules(check);
|
|
15962
15722
|
root2.walkAtRules(check);
|
|
15963
15723
|
function check(statement) {
|
|
15964
|
-
if (!hasBlock(statement) || hasEmptyBlock(statement))
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) {
|
|
15968
|
-
return;
|
|
15969
|
-
}
|
|
15970
|
-
if (statement.type === `rule` && optionsMatches(secondaryOptions, `ignoreSelectors`, statement.selector)) {
|
|
15971
|
-
return;
|
|
15972
|
-
}
|
|
15724
|
+
if (!hasBlock(statement) || hasEmptyBlock(statement)) return;
|
|
15725
|
+
if (statement.type === `atrule` && optionsMatches(secondaryOptions, `ignoreAtRules`, statement.name)) return;
|
|
15726
|
+
if (statement.type === `rule` && optionsMatches(secondaryOptions, `ignoreSelectors`, statement.selector)) return;
|
|
15973
15727
|
let source = beforeBlockString(statement);
|
|
15974
15728
|
let beforeBraceNoRaw = beforeBlockString(statement, {
|
|
15975
15729
|
noRawBefore: true
|
|
15976
15730
|
});
|
|
15977
15731
|
let index2 = beforeBraceNoRaw.length - 1;
|
|
15978
|
-
if (beforeBraceNoRaw[index2 - 1] === `\r`)
|
|
15979
|
-
index2 -= 1;
|
|
15980
|
-
}
|
|
15732
|
+
if (beforeBraceNoRaw[index2 - 1] === `\r`) index2 -= 1;
|
|
15981
15733
|
checker.before({
|
|
15982
15734
|
source,
|
|
15983
15735
|
index: source.length,
|
|
@@ -15995,9 +15747,7 @@ function rule$$(primary, secondaryOptions) {
|
|
|
15995
15747
|
statement.raws.between = ` `;
|
|
15996
15748
|
return;
|
|
15997
15749
|
}
|
|
15998
|
-
if (primary.startsWith(`never`))
|
|
15999
|
-
statement.raws.between = ``;
|
|
16000
|
-
}
|
|
15750
|
+
if (primary.startsWith(`never`)) statement.raws.between = ``;
|
|
16001
15751
|
}
|
|
16002
15752
|
});
|
|
16003
15753
|
}
|
|
@@ -16025,9 +15775,7 @@ function declarationValueIndex(decl) {
|
|
|
16025
15775
|
raws.between || `:`,
|
|
16026
15776
|
raws.value && `prefix` in raws.value && raws.value.prefix
|
|
16027
15777
|
].reduce((count, str) => {
|
|
16028
|
-
if (isString(str))
|
|
16029
|
-
return count + str.length;
|
|
16030
|
-
}
|
|
15778
|
+
if (isString(str)) return count + str.length;
|
|
16031
15779
|
return count;
|
|
16032
15780
|
}, 0);
|
|
16033
15781
|
}
|
|
@@ -16037,11 +15785,8 @@ function getDeclarationValue(decl) {
|
|
|
16037
15785
|
}
|
|
16038
15786
|
function setDeclarationValue(decl, value) {
|
|
16039
15787
|
let raws = decl.raws;
|
|
16040
|
-
if (raws.value)
|
|
16041
|
-
|
|
16042
|
-
} else {
|
|
16043
|
-
decl.value = value;
|
|
16044
|
-
}
|
|
15788
|
+
if (raws.value) raws.value.raw = value;
|
|
15789
|
+
else decl.value = value;
|
|
16045
15790
|
return decl;
|
|
16046
15791
|
}
|
|
16047
15792
|
let { utils: { report: report$K, ruleMessages: ruleMessages$_, validateOptions: validateOptions$_ } } = stylelint;
|
|
@@ -16063,27 +15808,17 @@ function rule$_(primary) {
|
|
|
16063
15808
|
actual: primary,
|
|
16064
15809
|
possible: [`lower`, `upper`]
|
|
16065
15810
|
});
|
|
16066
|
-
if (!validOptions)
|
|
16067
|
-
return;
|
|
16068
|
-
}
|
|
15811
|
+
if (!validOptions) return;
|
|
16069
15812
|
root2.walkDecls((decl) => {
|
|
16070
|
-
if (!CONTAINS_HEX.test(decl.value))
|
|
16071
|
-
return;
|
|
16072
|
-
}
|
|
15813
|
+
if (!CONTAINS_HEX.test(decl.value)) return;
|
|
16073
15814
|
let parsedValue = valueParser(getDeclarationValue(decl));
|
|
16074
15815
|
let needsFix = false;
|
|
16075
15816
|
parsedValue.walk((node2) => {
|
|
16076
15817
|
let { value } = node2;
|
|
16077
|
-
if (isIgnoredFunction(node2))
|
|
16078
|
-
|
|
16079
|
-
}
|
|
16080
|
-
if (!isHexColor(node2)) {
|
|
16081
|
-
return;
|
|
16082
|
-
}
|
|
15818
|
+
if (isIgnoredFunction(node2)) return false;
|
|
15819
|
+
if (!isHexColor(node2)) return;
|
|
16083
15820
|
let expected = primary === `lower` ? value.toLowerCase() : value.toUpperCase();
|
|
16084
|
-
if (value === expected)
|
|
16085
|
-
return;
|
|
16086
|
-
}
|
|
15821
|
+
if (value === expected) return;
|
|
16087
15822
|
const problemIndex = declarationValueIndex(decl) + node2.sourceIndex;
|
|
16088
15823
|
report$K({
|
|
16089
15824
|
message: messages$_.expected,
|
|
@@ -16099,9 +15834,7 @@ function rule$_(primary) {
|
|
|
16099
15834
|
}
|
|
16100
15835
|
});
|
|
16101
15836
|
});
|
|
16102
|
-
if (needsFix)
|
|
16103
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
16104
|
-
}
|
|
15837
|
+
if (needsFix) setDeclarationValue(decl, parsedValue.toString());
|
|
16105
15838
|
});
|
|
16106
15839
|
};
|
|
16107
15840
|
}
|
|
@@ -16273,9 +16006,7 @@ function declarationBangSpaceChecker(opts) {
|
|
|
16273
16006
|
let indexOffset = declarationValueIndex(decl);
|
|
16274
16007
|
let declString = decl.toString();
|
|
16275
16008
|
let valueString = decl.toString().slice(indexOffset);
|
|
16276
|
-
if (!valueString.includes(`!`))
|
|
16277
|
-
return;
|
|
16278
|
-
}
|
|
16009
|
+
if (!valueString.includes(`!`)) return;
|
|
16279
16010
|
styleSearch({ source: valueString, target: `!` }, (match) => {
|
|
16280
16011
|
check(declString, match.startIndex + indexOffset, decl);
|
|
16281
16012
|
});
|
|
@@ -16316,9 +16047,7 @@ function rule$Z(primary) {
|
|
|
16316
16047
|
actual: primary,
|
|
16317
16048
|
possible: [`always`, `never`]
|
|
16318
16049
|
});
|
|
16319
|
-
if (!validOptions)
|
|
16320
|
-
return;
|
|
16321
|
-
}
|
|
16050
|
+
if (!validOptions) return;
|
|
16322
16051
|
declarationBangSpaceChecker({
|
|
16323
16052
|
root: root2,
|
|
16324
16053
|
result: result2,
|
|
@@ -16340,9 +16069,7 @@ function rule$Z(primary) {
|
|
|
16340
16069
|
setFixed = (value) => {
|
|
16341
16070
|
decl.raws.important = value;
|
|
16342
16071
|
};
|
|
16343
|
-
} else
|
|
16344
|
-
return false;
|
|
16345
|
-
}
|
|
16072
|
+
} else return false;
|
|
16346
16073
|
let targetBefore = target.slice(0, bangIndex + 1);
|
|
16347
16074
|
let targetAfter = target.slice(bangIndex + 1);
|
|
16348
16075
|
if (primary === `always`) {
|
|
@@ -16386,9 +16113,7 @@ function rule$Y(primary) {
|
|
|
16386
16113
|
actual: primary,
|
|
16387
16114
|
possible: [`always`, `never`]
|
|
16388
16115
|
});
|
|
16389
|
-
if (!validOptions)
|
|
16390
|
-
return;
|
|
16391
|
-
}
|
|
16116
|
+
if (!validOptions) return;
|
|
16392
16117
|
declarationBangSpaceChecker({
|
|
16393
16118
|
root: root2,
|
|
16394
16119
|
result: result2,
|
|
@@ -16410,9 +16135,7 @@ function rule$Y(primary) {
|
|
|
16410
16135
|
setFixed = (val) => {
|
|
16411
16136
|
decl.raws.important = val;
|
|
16412
16137
|
};
|
|
16413
|
-
} else
|
|
16414
|
-
return false;
|
|
16415
|
-
}
|
|
16138
|
+
} else return false;
|
|
16416
16139
|
let targetBefore = target.slice(0, bangIndex);
|
|
16417
16140
|
let targetAfter = target.slice(bangIndex);
|
|
16418
16141
|
if (primary === `always`) {
|
|
@@ -16457,28 +16180,16 @@ function rule$X(primary, _secondaryOptions, context) {
|
|
|
16457
16180
|
actual: primary,
|
|
16458
16181
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
16459
16182
|
});
|
|
16460
|
-
if (!validOptions)
|
|
16461
|
-
return;
|
|
16462
|
-
}
|
|
16183
|
+
if (!validOptions) return;
|
|
16463
16184
|
root2.walkDecls((decl) => {
|
|
16464
16185
|
let parentRule = decl.parent;
|
|
16465
|
-
if (!parentRule)
|
|
16466
|
-
|
|
16467
|
-
|
|
16468
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16469
|
-
return;
|
|
16470
|
-
}
|
|
16471
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16472
|
-
return;
|
|
16473
|
-
}
|
|
16186
|
+
if (!parentRule) throw new Error(`A parent node must be present`);
|
|
16187
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) return;
|
|
16188
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) return;
|
|
16474
16189
|
let nextNode = decl.next();
|
|
16475
|
-
if (!nextNode)
|
|
16476
|
-
return;
|
|
16477
|
-
}
|
|
16190
|
+
if (!nextNode) return;
|
|
16478
16191
|
let nodeToCheck = nextNonCommentNode(nextNode);
|
|
16479
|
-
if (!nodeToCheck)
|
|
16480
|
-
return;
|
|
16481
|
-
}
|
|
16192
|
+
if (!nodeToCheck) return;
|
|
16482
16193
|
const problemIndex = decl.toString().length + 1;
|
|
16483
16194
|
checker.afterOneOnly({
|
|
16484
16195
|
source: rawNodeString(nodeToCheck),
|
|
@@ -16498,9 +16209,7 @@ function rule$X(primary, _secondaryOptions, context) {
|
|
|
16498
16209
|
nodeToCheck.raws.before = index2 >= 0 ? nodeToCheck.raws.before.slice(index2) : context.newline + nodeToCheck.raws.before;
|
|
16499
16210
|
return;
|
|
16500
16211
|
}
|
|
16501
|
-
if (primary === `never-multi-line`)
|
|
16502
|
-
nodeToCheck.raws.before = ``;
|
|
16503
|
-
}
|
|
16212
|
+
if (primary === `never-multi-line`) nodeToCheck.raws.before = ``;
|
|
16504
16213
|
}
|
|
16505
16214
|
});
|
|
16506
16215
|
}
|
|
@@ -16536,20 +16245,12 @@ function rule$W(primary) {
|
|
|
16536
16245
|
actual: primary,
|
|
16537
16246
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
16538
16247
|
});
|
|
16539
|
-
if (!validOptions)
|
|
16540
|
-
return;
|
|
16541
|
-
}
|
|
16248
|
+
if (!validOptions) return;
|
|
16542
16249
|
root2.walkDecls((decl) => {
|
|
16543
16250
|
let parentRule = decl.parent;
|
|
16544
|
-
if (!parentRule)
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16548
|
-
return;
|
|
16549
|
-
}
|
|
16550
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16551
|
-
return;
|
|
16552
|
-
}
|
|
16251
|
+
if (!parentRule) throw new Error(`A parent node must be present`);
|
|
16252
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) return;
|
|
16253
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) return;
|
|
16553
16254
|
const declString = decl.toString();
|
|
16554
16255
|
const problemIndex = decl.toString().length - 1;
|
|
16555
16256
|
checker.beforeAllowingIndentation({
|
|
@@ -16600,24 +16301,14 @@ function rule$V(primary) {
|
|
|
16600
16301
|
actual: primary,
|
|
16601
16302
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
16602
16303
|
});
|
|
16603
|
-
if (!validOptions)
|
|
16604
|
-
return;
|
|
16605
|
-
}
|
|
16304
|
+
if (!validOptions) return;
|
|
16606
16305
|
root2.walkDecls((decl) => {
|
|
16607
16306
|
let parentRule = decl.parent;
|
|
16608
|
-
if (!parentRule)
|
|
16609
|
-
|
|
16610
|
-
|
|
16611
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16612
|
-
return;
|
|
16613
|
-
}
|
|
16614
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16615
|
-
return;
|
|
16616
|
-
}
|
|
16307
|
+
if (!parentRule) throw new Error(`A parent node must be present`);
|
|
16308
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) return;
|
|
16309
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) return;
|
|
16617
16310
|
let nextDecl = decl.next();
|
|
16618
|
-
if (!nextDecl)
|
|
16619
|
-
return;
|
|
16620
|
-
}
|
|
16311
|
+
if (!nextDecl) return;
|
|
16621
16312
|
const problemIndex = decl.toString().length + 1;
|
|
16622
16313
|
checker.after({
|
|
16623
16314
|
source: rawNodeString(nextDecl),
|
|
@@ -16636,9 +16327,7 @@ function rule$V(primary) {
|
|
|
16636
16327
|
nextDecl.raws.before = ` `;
|
|
16637
16328
|
return;
|
|
16638
16329
|
}
|
|
16639
|
-
if (primary.startsWith(`never`))
|
|
16640
|
-
nextDecl.raws.before = ``;
|
|
16641
|
-
}
|
|
16330
|
+
if (primary.startsWith(`never`)) nextDecl.raws.before = ``;
|
|
16642
16331
|
}
|
|
16643
16332
|
});
|
|
16644
16333
|
}
|
|
@@ -16679,27 +16368,17 @@ function rule$U(primary) {
|
|
|
16679
16368
|
actual: primary,
|
|
16680
16369
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
16681
16370
|
});
|
|
16682
|
-
if (!validOptions)
|
|
16683
|
-
return;
|
|
16684
|
-
}
|
|
16371
|
+
if (!validOptions) return;
|
|
16685
16372
|
root2.walkDecls((decl) => {
|
|
16686
16373
|
let parentRule = decl.parent;
|
|
16687
|
-
if (!parentRule)
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
if (!isAtRule(parentRule) && !isRule(parentRule)) {
|
|
16691
|
-
return;
|
|
16692
|
-
}
|
|
16693
|
-
if (!parentRule.raws.semicolon && parentRule.last === decl) {
|
|
16694
|
-
return;
|
|
16695
|
-
}
|
|
16374
|
+
if (!parentRule) throw new Error(`A parent node must be present`);
|
|
16375
|
+
if (!isAtRule(parentRule) && !isRule(parentRule)) return;
|
|
16376
|
+
if (!parentRule.raws.semicolon && parentRule.last === decl) return;
|
|
16696
16377
|
const value = getDeclarationValue(decl);
|
|
16697
16378
|
let isCustomPropertyWithOnlySpaces = false;
|
|
16698
16379
|
if (isCustomProperty(decl.prop)) {
|
|
16699
16380
|
isCustomPropertyWithOnlySpaces = /^\s+$/.test(value);
|
|
16700
|
-
if (primary.startsWith(`never`) && value === ` `)
|
|
16701
|
-
return;
|
|
16702
|
-
}
|
|
16381
|
+
if (primary.startsWith(`never`) && value === ` `) return;
|
|
16703
16382
|
}
|
|
16704
16383
|
const declString = decl.toString();
|
|
16705
16384
|
const problemIndex = decl.toString().length - 1;
|
|
@@ -16717,17 +16396,13 @@ function rule$U(primary) {
|
|
|
16717
16396
|
ruleName: ruleName$U,
|
|
16718
16397
|
fix() {
|
|
16719
16398
|
if (primary.startsWith(`always`)) {
|
|
16720
|
-
if (decl.important)
|
|
16721
|
-
|
|
16722
|
-
} else {
|
|
16723
|
-
setDeclarationValue(decl, value.replace(/\s*$/, ` `));
|
|
16724
|
-
}
|
|
16399
|
+
if (decl.important) decl.raws.important = ` !important `;
|
|
16400
|
+
else setDeclarationValue(decl, value.replace(/\s*$/, ` `));
|
|
16725
16401
|
return;
|
|
16726
16402
|
}
|
|
16727
16403
|
if (primary.startsWith(`never`)) {
|
|
16728
|
-
if (decl.raws.important)
|
|
16729
|
-
|
|
16730
|
-
} else {
|
|
16404
|
+
if (decl.raws.important) decl.raws.important = decl.raws.important.replace(/\s*$/, ``);
|
|
16405
|
+
else {
|
|
16731
16406
|
const newValue = isCustomPropertyWithOnlySpaces ? ` ` : value.replace(/\s*$/, ``);
|
|
16732
16407
|
setDeclarationValue(decl, newValue);
|
|
16733
16408
|
}
|
|
@@ -16777,9 +16452,7 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16777
16452
|
optional: true
|
|
16778
16453
|
}
|
|
16779
16454
|
);
|
|
16780
|
-
if (!validOptions)
|
|
16781
|
-
return;
|
|
16782
|
-
}
|
|
16455
|
+
if (!validOptions) return;
|
|
16783
16456
|
root2.walkAtRules((atRule2) => {
|
|
16784
16457
|
if (!atRule2.parent) throw new Error(`A parent node must be present`);
|
|
16785
16458
|
if (atRule2.parent === root2 || atRule2 !== atRule2.parent.last || hasBlock(atRule2)) return;
|
|
@@ -16791,9 +16464,7 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16791
16464
|
checkLastNode(decl);
|
|
16792
16465
|
});
|
|
16793
16466
|
function checkLastNode(node2) {
|
|
16794
|
-
if (!node2.parent)
|
|
16795
|
-
throw new Error(`A parent node must be present`);
|
|
16796
|
-
}
|
|
16467
|
+
if (!node2.parent) throw new Error(`A parent node must be present`);
|
|
16797
16468
|
let hasSemicolon = node2.parent.raws.semicolon;
|
|
16798
16469
|
let ignoreSingleDeclaration = optionsMatches(
|
|
16799
16470
|
secondaryOptions,
|
|
@@ -16803,11 +16474,8 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16803
16474
|
if (ignoreSingleDeclaration && node2.parent.first === node2) return;
|
|
16804
16475
|
if (primary === `always` && primary === `never`) throw new Error(`Unexpected primary option: "${primary}"`);
|
|
16805
16476
|
let message;
|
|
16806
|
-
if (primary === `always` && !hasSemicolon)
|
|
16807
|
-
|
|
16808
|
-
} else if (primary === `never` && hasSemicolon) {
|
|
16809
|
-
message = messages$T.rejected;
|
|
16810
|
-
}
|
|
16477
|
+
if (primary === `always` && !hasSemicolon) message = messages$T.expected;
|
|
16478
|
+
else if (primary === `never` && hasSemicolon) message = messages$T.rejected;
|
|
16811
16479
|
const problemIndex = node2.toString().trim().length - 1;
|
|
16812
16480
|
if (message) {
|
|
16813
16481
|
report$E({
|
|
@@ -16824,9 +16492,7 @@ function rule$T(primary, secondaryOptions) {
|
|
|
16824
16492
|
node2.raws.between = ``;
|
|
16825
16493
|
node2.parent.raws.after = ` `;
|
|
16826
16494
|
}
|
|
16827
|
-
} else if (primary === `never` && hasSemicolon)
|
|
16828
|
-
node2.parent.raws.semicolon = false;
|
|
16829
|
-
}
|
|
16495
|
+
} else if (primary === `never` && hasSemicolon) node2.parent.raws.semicolon = false;
|
|
16830
16496
|
}
|
|
16831
16497
|
});
|
|
16832
16498
|
}
|
|
@@ -16844,35 +16510,19 @@ const index$T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
16844
16510
|
ruleName: ruleName$T
|
|
16845
16511
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
16846
16512
|
function isScssVariable(property) {
|
|
16847
|
-
if (property.startsWith(`$`))
|
|
16848
|
-
|
|
16849
|
-
}
|
|
16850
|
-
if (property.includes(`.$`)) {
|
|
16851
|
-
return true;
|
|
16852
|
-
}
|
|
16513
|
+
if (property.startsWith(`$`)) return true;
|
|
16514
|
+
if (property.includes(`.$`)) return true;
|
|
16853
16515
|
return false;
|
|
16854
16516
|
}
|
|
16855
16517
|
function isStandardSyntaxDeclaration(decl) {
|
|
16856
16518
|
let prop = decl.prop;
|
|
16857
16519
|
let parent = decl.parent;
|
|
16858
|
-
if (isScssVariable(prop))
|
|
16859
|
-
|
|
16860
|
-
|
|
16861
|
-
if (
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
if (parent && parent.type === `atrule` && parent.raws.afterName === `:`) {
|
|
16865
|
-
return false;
|
|
16866
|
-
}
|
|
16867
|
-
if (parent && isRule(parent) && parent.selector && parent.selector.startsWith(`#`) && parent.selector.endsWith(`()`)) {
|
|
16868
|
-
return false;
|
|
16869
|
-
}
|
|
16870
|
-
if (parent && isRule(parent) && parent.selector && parent.selector[parent.selector.length - 1] === `:` && parent.selector.substring(0, 2) !== `--`) {
|
|
16871
|
-
return false;
|
|
16872
|
-
}
|
|
16873
|
-
if (`extend` in decl && decl.extend) {
|
|
16874
|
-
return false;
|
|
16875
|
-
}
|
|
16520
|
+
if (isScssVariable(prop)) return false;
|
|
16521
|
+
if (prop[0] === `@` && prop[1] !== `{`) return false;
|
|
16522
|
+
if (parent && parent.type === `atrule` && parent.raws.afterName === `:`) return false;
|
|
16523
|
+
if (parent && isRule(parent) && parent.selector && parent.selector.startsWith(`#`) && parent.selector.endsWith(`()`)) return false;
|
|
16524
|
+
if (parent && isRule(parent) && parent.selector && parent.selector[parent.selector.length - 1] === `:` && parent.selector.substring(0, 2) !== `--`) return false;
|
|
16525
|
+
if (`extend` in decl && decl.extend) return false;
|
|
16876
16526
|
return true;
|
|
16877
16527
|
}
|
|
16878
16528
|
let { utils: { report: report$D, ruleMessages: ruleMessages$S, validateOptions: validateOptions$S } } = stylelint;
|
|
@@ -16893,19 +16543,13 @@ function rule$S(primary, _secondaryOptions, context) {
|
|
|
16893
16543
|
actual: primary,
|
|
16894
16544
|
possible: [`always`, `always-multi-line`]
|
|
16895
16545
|
});
|
|
16896
|
-
if (!validOptions)
|
|
16897
|
-
return;
|
|
16898
|
-
}
|
|
16546
|
+
if (!validOptions) return;
|
|
16899
16547
|
root2.walkDecls((decl) => {
|
|
16900
|
-
if (!isStandardSyntaxDeclaration(decl))
|
|
16901
|
-
return;
|
|
16902
|
-
}
|
|
16548
|
+
if (!isStandardSyntaxDeclaration(decl)) return;
|
|
16903
16549
|
let endOfPropIndex = declarationValueIndex(decl) + (decl.raws.between || ``).length - 1;
|
|
16904
16550
|
let propPlusColon = `${decl.toString().slice(0, endOfPropIndex)}xxx`;
|
|
16905
16551
|
for (let i2 = 0, l2 = propPlusColon.length; i2 < l2; i2++) {
|
|
16906
|
-
if (propPlusColon[i2] !== `:`)
|
|
16907
|
-
continue;
|
|
16908
|
-
}
|
|
16552
|
+
if (propPlusColon[i2] !== `:`) continue;
|
|
16909
16553
|
let indexToCheck = /^[^\S\r\n]*\/\*/.test(propPlusColon.slice(i2 + 1)) ? propPlusColon.indexOf(`*/`, i2) + 1 : i2;
|
|
16910
16554
|
checker.afterOneOnly({
|
|
16911
16555
|
source: propPlusColon,
|
|
@@ -16921,9 +16565,7 @@ function rule$S(primary, _secondaryOptions, context) {
|
|
|
16921
16565
|
ruleName: ruleName$S,
|
|
16922
16566
|
fix() {
|
|
16923
16567
|
let between = decl.raws.between;
|
|
16924
|
-
if (between === null)
|
|
16925
|
-
throw new Error(`\`between\` must be present`);
|
|
16926
|
-
}
|
|
16568
|
+
if (between === null) throw new Error(`\`between\` must be present`);
|
|
16927
16569
|
let betweenStart = declarationValueIndex(decl) - between.length;
|
|
16928
16570
|
let sliceIndex = indexToCheck - betweenStart + 1;
|
|
16929
16571
|
let betweenBefore = between.slice(0, sliceIndex);
|
|
@@ -16950,15 +16592,11 @@ const index$S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
16950
16592
|
let { utils: { report: report$C } } = stylelint;
|
|
16951
16593
|
function declarationColonSpaceChecker(opts) {
|
|
16952
16594
|
opts.root.walkDecls((decl) => {
|
|
16953
|
-
if (!isStandardSyntaxDeclaration(decl))
|
|
16954
|
-
return;
|
|
16955
|
-
}
|
|
16595
|
+
if (!isStandardSyntaxDeclaration(decl)) return;
|
|
16956
16596
|
let endOfPropIndex = declarationValueIndex(decl) + (decl.raws.between || ``).length - 1;
|
|
16957
16597
|
let propPlusColon = `${decl.toString().slice(0, endOfPropIndex)}xxx`;
|
|
16958
16598
|
for (let i2 = 0, l2 = propPlusColon.length; i2 < l2; i2++) {
|
|
16959
|
-
if (propPlusColon[i2] !== `:`)
|
|
16960
|
-
continue;
|
|
16961
|
-
}
|
|
16599
|
+
if (propPlusColon[i2] !== `:`) continue;
|
|
16962
16600
|
const problemIndex = decl.prop.toString().length + 1;
|
|
16963
16601
|
opts.locationChecker({
|
|
16964
16602
|
source: propPlusColon,
|
|
@@ -16999,9 +16637,7 @@ function rule$R(primary) {
|
|
|
16999
16637
|
actual: primary,
|
|
17000
16638
|
possible: [`always`, `never`, `always-single-line`]
|
|
17001
16639
|
});
|
|
17002
|
-
if (!validOptions)
|
|
17003
|
-
return;
|
|
17004
|
-
}
|
|
16640
|
+
if (!validOptions) return;
|
|
17005
16641
|
declarationColonSpaceChecker({
|
|
17006
16642
|
root: root2,
|
|
17007
16643
|
result: result2,
|
|
@@ -17010,9 +16646,7 @@ function rule$R(primary) {
|
|
|
17010
16646
|
fix: (decl, index2) => {
|
|
17011
16647
|
let colonIndex = index2 - declarationValueIndex(decl);
|
|
17012
16648
|
let between = decl.raws.between;
|
|
17013
|
-
if (between === null)
|
|
17014
|
-
throw new Error(`\`between\` must be present`);
|
|
17015
|
-
}
|
|
16649
|
+
if (between === null) throw new Error(`\`between\` must be present`);
|
|
17016
16650
|
if (primary.startsWith(`always`)) {
|
|
17017
16651
|
decl.raws.between = between.slice(0, colonIndex) + between.slice(colonIndex).replace(/^:\s*/, `: `);
|
|
17018
16652
|
return true;
|
|
@@ -17054,9 +16688,7 @@ function rule$Q(primary) {
|
|
|
17054
16688
|
actual: primary,
|
|
17055
16689
|
possible: [`always`, `never`]
|
|
17056
16690
|
});
|
|
17057
|
-
if (!validOptions)
|
|
17058
|
-
return;
|
|
17059
|
-
}
|
|
16691
|
+
if (!validOptions) return;
|
|
17060
16692
|
declarationColonSpaceChecker({
|
|
17061
16693
|
root: root2,
|
|
17062
16694
|
result: result2,
|
|
@@ -17065,9 +16697,7 @@ function rule$Q(primary) {
|
|
|
17065
16697
|
fix: (decl, index2) => {
|
|
17066
16698
|
let colonIndex = index2 - declarationValueIndex(decl);
|
|
17067
16699
|
let between = decl.raws.between;
|
|
17068
|
-
if (between === null)
|
|
17069
|
-
throw new Error(`\`between\` must be present`);
|
|
17070
|
-
}
|
|
16700
|
+
if (between === null) throw new Error(`\`between\` must be present`);
|
|
17071
16701
|
if (primary === `always`) {
|
|
17072
16702
|
decl.raws.between = between.slice(0, colonIndex).replace(/\s*$/, ` `) + between.slice(colonIndex);
|
|
17073
16703
|
return true;
|
|
@@ -17091,45 +16721,11 @@ const index$Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17091
16721
|
meta: meta$Q,
|
|
17092
16722
|
ruleName: ruleName$Q
|
|
17093
16723
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
17094
|
-
function functionCommaSpaceFix(params) {
|
|
17095
|
-
let { div, index: index2, nodes, expectation, position, symb } = params;
|
|
17096
|
-
if (expectation.startsWith(`always`)) {
|
|
17097
|
-
div[position] = symb;
|
|
17098
|
-
return true;
|
|
17099
|
-
}
|
|
17100
|
-
if (expectation.startsWith(`never`)) {
|
|
17101
|
-
div[position] = ``;
|
|
17102
|
-
for (let i2 = index2 + 1; i2 < nodes.length; i2++) {
|
|
17103
|
-
let node2 = nodes[i2];
|
|
17104
|
-
if (node2 === void 0) {
|
|
17105
|
-
continue;
|
|
17106
|
-
}
|
|
17107
|
-
if (node2.type === `comment`) {
|
|
17108
|
-
continue;
|
|
17109
|
-
}
|
|
17110
|
-
if (node2.type === `space`) {
|
|
17111
|
-
node2.value = ``;
|
|
17112
|
-
continue;
|
|
17113
|
-
}
|
|
17114
|
-
break;
|
|
17115
|
-
}
|
|
17116
|
-
return true;
|
|
17117
|
-
}
|
|
17118
|
-
return false;
|
|
17119
|
-
}
|
|
17120
16724
|
function isStandardSyntaxFunction(node2) {
|
|
17121
|
-
if (!node2.value)
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
if (node2.value.startsWith(
|
|
17125
|
-
return false;
|
|
17126
|
-
}
|
|
17127
|
-
if (node2.value.startsWith(`\${`)) {
|
|
17128
|
-
return false;
|
|
17129
|
-
}
|
|
17130
|
-
if (node2.value.startsWith(`\``)) {
|
|
17131
|
-
return false;
|
|
17132
|
-
}
|
|
16725
|
+
if (!node2.value) return false;
|
|
16726
|
+
if (node2.value.startsWith(`#{`)) return false;
|
|
16727
|
+
if (node2.value.startsWith(`\${`)) return false;
|
|
16728
|
+
if (node2.value.startsWith(`\``)) return false;
|
|
17133
16729
|
return true;
|
|
17134
16730
|
}
|
|
17135
16731
|
let { utils: { report: report$B } } = stylelint;
|
|
@@ -17139,15 +16735,9 @@ function functionCommaSpaceChecker(opts) {
|
|
|
17139
16735
|
let hasFixed;
|
|
17140
16736
|
let parsedValue = valueParser(declValue);
|
|
17141
16737
|
parsedValue.walk((valueNode) => {
|
|
17142
|
-
if (valueNode.type !== `function`)
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
if (!isStandardSyntaxFunction(valueNode)) {
|
|
17146
|
-
return;
|
|
17147
|
-
}
|
|
17148
|
-
if (valueNode.value.toLowerCase() === `url`) {
|
|
17149
|
-
return;
|
|
17150
|
-
}
|
|
16738
|
+
if (valueNode.type !== `function`) return;
|
|
16739
|
+
if (!isStandardSyntaxFunction(valueNode)) return;
|
|
16740
|
+
if (valueNode.value.toLowerCase() === `url`) return;
|
|
17151
16741
|
let argumentStrings = valueNode.nodes.map((node2) => valueParser.stringify(node2));
|
|
17152
16742
|
let functionArguments = (() => {
|
|
17153
16743
|
let result2 = valueNode.before + argumentStrings.join(``) + valueNode.after;
|
|
@@ -17161,9 +16751,7 @@ function functionCommaSpaceChecker(opts) {
|
|
|
17161
16751
|
}
|
|
17162
16752
|
let commaDataList = [];
|
|
17163
16753
|
for (let [nodeIndex, node2] of valueNode.nodes.entries()) {
|
|
17164
|
-
if (node2.type !== `div` || node2.value !== `,`)
|
|
17165
|
-
continue;
|
|
17166
|
-
}
|
|
16754
|
+
if (node2.type !== `div` || node2.value !== `,`) continue;
|
|
17167
16755
|
let checkIndex = getCommaCheckIndex(node2, nodeIndex);
|
|
17168
16756
|
commaDataList.push({
|
|
17169
16757
|
commaNode: node2,
|
|
@@ -17193,11 +16781,31 @@ function functionCommaSpaceChecker(opts) {
|
|
|
17193
16781
|
});
|
|
17194
16782
|
}
|
|
17195
16783
|
});
|
|
17196
|
-
if (hasFixed)
|
|
17197
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
17198
|
-
}
|
|
16784
|
+
if (hasFixed) setDeclarationValue(decl, parsedValue.toString());
|
|
17199
16785
|
});
|
|
17200
16786
|
}
|
|
16787
|
+
function functionCommaSpaceFix(params) {
|
|
16788
|
+
let { div, index: index2, nodes, expectation, position, symb } = params;
|
|
16789
|
+
if (expectation.startsWith(`always`)) {
|
|
16790
|
+
div[position] = symb;
|
|
16791
|
+
return true;
|
|
16792
|
+
}
|
|
16793
|
+
if (expectation.startsWith(`never`)) {
|
|
16794
|
+
div[position] = ``;
|
|
16795
|
+
for (let i2 = index2 + 1; i2 < nodes.length; i2++) {
|
|
16796
|
+
let node2 = nodes[i2];
|
|
16797
|
+
if (node2 === void 0) continue;
|
|
16798
|
+
if (node2.type === `comment`) continue;
|
|
16799
|
+
if (node2.type === `space`) {
|
|
16800
|
+
node2.value = ``;
|
|
16801
|
+
continue;
|
|
16802
|
+
}
|
|
16803
|
+
break;
|
|
16804
|
+
}
|
|
16805
|
+
return true;
|
|
16806
|
+
}
|
|
16807
|
+
return false;
|
|
16808
|
+
}
|
|
17201
16809
|
let { utils: { ruleMessages: ruleMessages$P, validateOptions: validateOptions$P } } = stylelint;
|
|
17202
16810
|
let shortName$P = `function-comma-newline-after`;
|
|
17203
16811
|
let ruleName$P = addNamespace(shortName$P);
|
|
@@ -17217,9 +16825,7 @@ function rule$P(primary, _secondaryOptions, context) {
|
|
|
17217
16825
|
actual: primary,
|
|
17218
16826
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
17219
16827
|
});
|
|
17220
|
-
if (!validOptions)
|
|
17221
|
-
return;
|
|
17222
|
-
}
|
|
16828
|
+
if (!validOptions) return;
|
|
17223
16829
|
functionCommaSpaceChecker({
|
|
17224
16830
|
root: root2,
|
|
17225
16831
|
result: result2,
|
|
@@ -17265,9 +16871,7 @@ function rule$O(primary, _secondaryOptions, context) {
|
|
|
17265
16871
|
actual: primary,
|
|
17266
16872
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
17267
16873
|
});
|
|
17268
|
-
if (!validOptions)
|
|
17269
|
-
return;
|
|
17270
|
-
}
|
|
16874
|
+
if (!validOptions) return;
|
|
17271
16875
|
functionCommaSpaceChecker({
|
|
17272
16876
|
root: root2,
|
|
17273
16877
|
result: result2,
|
|
@@ -17314,9 +16918,7 @@ function rule$N(primary) {
|
|
|
17314
16918
|
actual: primary,
|
|
17315
16919
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
17316
16920
|
});
|
|
17317
|
-
if (!validOptions)
|
|
17318
|
-
return;
|
|
17319
|
-
}
|
|
16921
|
+
if (!validOptions) return;
|
|
17320
16922
|
functionCommaSpaceChecker({
|
|
17321
16923
|
root: root2,
|
|
17322
16924
|
result: result2,
|
|
@@ -17363,9 +16965,7 @@ function rule$M(primary) {
|
|
|
17363
16965
|
actual: primary,
|
|
17364
16966
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
17365
16967
|
});
|
|
17366
|
-
if (!validOptions)
|
|
17367
|
-
return;
|
|
17368
|
-
}
|
|
16968
|
+
if (!validOptions) return;
|
|
17369
16969
|
functionCommaSpaceChecker({
|
|
17370
16970
|
root: root2,
|
|
17371
16971
|
result: result2,
|
|
@@ -17403,9 +17003,7 @@ let meta$L = {
|
|
|
17403
17003
|
fixable: true
|
|
17404
17004
|
};
|
|
17405
17005
|
function placeIndexOnValueStart(decl) {
|
|
17406
|
-
if (decl.raws.between === null)
|
|
17407
|
-
throw new Error(`\`between\` must be present`);
|
|
17408
|
-
}
|
|
17006
|
+
if (decl.raws.between === null) throw new Error(`\`between\` must be present`);
|
|
17409
17007
|
return decl.prop.length + decl.raws.between.length - 1;
|
|
17410
17008
|
}
|
|
17411
17009
|
function rule$L(primary) {
|
|
@@ -17415,9 +17013,7 @@ function rule$L(primary) {
|
|
|
17415
17013
|
actual: primary,
|
|
17416
17014
|
possible: isNumber$1
|
|
17417
17015
|
});
|
|
17418
|
-
if (!validOptions)
|
|
17419
|
-
return;
|
|
17420
|
-
}
|
|
17016
|
+
if (!validOptions) return;
|
|
17421
17017
|
let violatedCRLFNewLinesRegex = new RegExp(`(?:\r
|
|
17422
17018
|
){${maxAdjacentNewlines + 1},}`);
|
|
17423
17019
|
let violatedLFNewLinesRegex = new RegExp(`
|
|
@@ -17427,20 +17023,14 @@ function rule$L(primary) {
|
|
|
17427
17023
|
let allowedCRLFNewLinesString = `\r
|
|
17428
17024
|
`.repeat(maxAdjacentNewlines);
|
|
17429
17025
|
root2.walkDecls((decl) => {
|
|
17430
|
-
if (!decl.value.includes(`(`))
|
|
17431
|
-
return;
|
|
17432
|
-
}
|
|
17026
|
+
if (!decl.value.includes(`(`)) return;
|
|
17433
17027
|
let stringValue = getDeclarationValue(decl);
|
|
17434
17028
|
let splittedValue = [];
|
|
17435
17029
|
let sourceIndexStart = 0;
|
|
17436
17030
|
valueParser(stringValue).walk((node2) => {
|
|
17437
|
-
if (node2.type !== `function` || node2.value.length === 0)
|
|
17438
|
-
return;
|
|
17439
|
-
}
|
|
17031
|
+
if (node2.type !== `function` || node2.value.length === 0) return;
|
|
17440
17032
|
let stringifiedNode = valueParser.stringify(node2);
|
|
17441
|
-
if (!violatedLFNewLinesRegex.test(stringifiedNode) && !violatedCRLFNewLinesRegex.test(stringifiedNode))
|
|
17442
|
-
return;
|
|
17443
|
-
}
|
|
17033
|
+
if (!violatedLFNewLinesRegex.test(stringifiedNode) && !violatedCRLFNewLinesRegex.test(stringifiedNode)) return;
|
|
17444
17034
|
const problemIndex = placeIndexOnValueStart(decl) + node2.sourceIndex;
|
|
17445
17035
|
report$A({
|
|
17446
17036
|
message: messages$L.expected,
|
|
@@ -17498,24 +17088,16 @@ function rule$K(primary, _secondaryOptions, context) {
|
|
|
17498
17088
|
actual: primary,
|
|
17499
17089
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
17500
17090
|
});
|
|
17501
|
-
if (!validOptions)
|
|
17502
|
-
return;
|
|
17503
|
-
}
|
|
17091
|
+
if (!validOptions) return;
|
|
17504
17092
|
root2.walkDecls((decl) => {
|
|
17505
|
-
if (!decl.value.includes(`(`))
|
|
17506
|
-
return;
|
|
17507
|
-
}
|
|
17093
|
+
if (!decl.value.includes(`(`)) return;
|
|
17508
17094
|
let fix = null;
|
|
17509
17095
|
let hasFixed = false;
|
|
17510
17096
|
let declValue = getDeclarationValue(decl);
|
|
17511
17097
|
let parsedValue = valueParser(declValue);
|
|
17512
17098
|
parsedValue.walk((valueNode) => {
|
|
17513
|
-
if (valueNode.type !== `function`)
|
|
17514
|
-
|
|
17515
|
-
}
|
|
17516
|
-
if (!isStandardSyntaxFunction(valueNode)) {
|
|
17517
|
-
return;
|
|
17518
|
-
}
|
|
17099
|
+
if (valueNode.type !== `function`) return;
|
|
17100
|
+
if (!isStandardSyntaxFunction(valueNode)) return;
|
|
17519
17101
|
let functionString = valueParser.stringify(valueNode);
|
|
17520
17102
|
let isMultiLine = !isSingleLineString(functionString);
|
|
17521
17103
|
function containsNewline(str) {
|
|
@@ -17569,9 +17151,7 @@ function rule$K(primary, _secondaryOptions, context) {
|
|
|
17569
17151
|
complain(messages$K.rejectedClosingMultiLine, closingIndex);
|
|
17570
17152
|
}
|
|
17571
17153
|
});
|
|
17572
|
-
if (hasFixed)
|
|
17573
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
17574
|
-
}
|
|
17154
|
+
if (hasFixed) setDeclarationValue(decl, parsedValue.toString());
|
|
17575
17155
|
function complain(message, offset) {
|
|
17576
17156
|
const problemIndex = declarationValueIndex(decl) + offset;
|
|
17577
17157
|
report$z({
|
|
@@ -17590,9 +17170,7 @@ function rule$K(primary, _secondaryOptions, context) {
|
|
|
17590
17170
|
function getCheckBefore(valueNode) {
|
|
17591
17171
|
let before = valueNode.before;
|
|
17592
17172
|
for (let node2 of valueNode.nodes) {
|
|
17593
|
-
if (node2.type === `comment`)
|
|
17594
|
-
continue;
|
|
17595
|
-
}
|
|
17173
|
+
if (node2.type === `comment`) continue;
|
|
17596
17174
|
if (node2.type === `space`) {
|
|
17597
17175
|
before += node2.value;
|
|
17598
17176
|
continue;
|
|
@@ -17604,9 +17182,7 @@ function getCheckBefore(valueNode) {
|
|
|
17604
17182
|
function getCheckAfter(valueNode) {
|
|
17605
17183
|
let after = ``;
|
|
17606
17184
|
for (let node2 of [...valueNode.nodes].reverse()) {
|
|
17607
|
-
if (node2.type === `comment`)
|
|
17608
|
-
continue;
|
|
17609
|
-
}
|
|
17185
|
+
if (node2.type === `comment`) continue;
|
|
17610
17186
|
if (node2.type === `space`) {
|
|
17611
17187
|
after = node2.value + after;
|
|
17612
17188
|
continue;
|
|
@@ -17619,27 +17195,20 @@ function getCheckAfter(valueNode) {
|
|
|
17619
17195
|
function fixBeforeForAlways(valueNode, newline) {
|
|
17620
17196
|
let target;
|
|
17621
17197
|
for (let node2 of valueNode.nodes) {
|
|
17622
|
-
if (node2.type === `comment`)
|
|
17623
|
-
continue;
|
|
17624
|
-
}
|
|
17198
|
+
if (node2.type === `comment`) continue;
|
|
17625
17199
|
if (node2.type === `space`) {
|
|
17626
17200
|
target = node2;
|
|
17627
17201
|
continue;
|
|
17628
17202
|
}
|
|
17629
17203
|
break;
|
|
17630
17204
|
}
|
|
17631
|
-
if (target)
|
|
17632
|
-
|
|
17633
|
-
} else {
|
|
17634
|
-
valueNode.before = newline + valueNode.before;
|
|
17635
|
-
}
|
|
17205
|
+
if (target) target.value = newline + target.value;
|
|
17206
|
+
else valueNode.before = newline + valueNode.before;
|
|
17636
17207
|
}
|
|
17637
17208
|
function fixBeforeForNever(valueNode) {
|
|
17638
17209
|
valueNode.before = ``;
|
|
17639
17210
|
for (let node2 of valueNode.nodes) {
|
|
17640
|
-
if (node2.type === `comment`)
|
|
17641
|
-
continue;
|
|
17642
|
-
}
|
|
17211
|
+
if (node2.type === `comment`) continue;
|
|
17643
17212
|
if (node2.type === `space`) {
|
|
17644
17213
|
node2.value = ``;
|
|
17645
17214
|
continue;
|
|
@@ -17653,9 +17222,7 @@ function fixAfterForAlways(valueNode, newline) {
|
|
|
17653
17222
|
function fixAfterForNever(valueNode) {
|
|
17654
17223
|
valueNode.after = ``;
|
|
17655
17224
|
for (let node2 of [...valueNode.nodes].reverse()) {
|
|
17656
|
-
if (node2.type === `comment`)
|
|
17657
|
-
continue;
|
|
17658
|
-
}
|
|
17225
|
+
if (node2.type === `comment`) continue;
|
|
17659
17226
|
if (node2.type === `space`) {
|
|
17660
17227
|
node2.value = ``;
|
|
17661
17228
|
continue;
|
|
@@ -17696,27 +17263,17 @@ function rule$J(primary) {
|
|
|
17696
17263
|
actual: primary,
|
|
17697
17264
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
17698
17265
|
});
|
|
17699
|
-
if (!validOptions)
|
|
17700
|
-
return;
|
|
17701
|
-
}
|
|
17266
|
+
if (!validOptions) return;
|
|
17702
17267
|
root2.walkDecls((decl) => {
|
|
17703
|
-
if (!decl.value.includes(`(`))
|
|
17704
|
-
return;
|
|
17705
|
-
}
|
|
17268
|
+
if (!decl.value.includes(`(`)) return;
|
|
17706
17269
|
let fix = null;
|
|
17707
17270
|
let hasFixed = false;
|
|
17708
17271
|
let declValue = getDeclarationValue(decl);
|
|
17709
17272
|
let parsedValue = valueParser(declValue);
|
|
17710
17273
|
parsedValue.walk((valueNode) => {
|
|
17711
|
-
if (valueNode.type !== `function`)
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
if (!isStandardSyntaxFunction(valueNode)) {
|
|
17715
|
-
return;
|
|
17716
|
-
}
|
|
17717
|
-
if (!valueNode.nodes.length) {
|
|
17718
|
-
return;
|
|
17719
|
-
}
|
|
17274
|
+
if (valueNode.type !== `function`) return;
|
|
17275
|
+
if (!isStandardSyntaxFunction(valueNode)) return;
|
|
17276
|
+
if (!valueNode.nodes.length) return;
|
|
17720
17277
|
let functionString = valueParser.stringify(valueNode);
|
|
17721
17278
|
let isSingleLine = isSingleLineString(functionString);
|
|
17722
17279
|
let openingIndex = valueNode.sourceIndex + valueNode.value.length + 1;
|
|
@@ -17778,9 +17335,7 @@ function rule$J(primary) {
|
|
|
17778
17335
|
complain(messages$J.rejectedClosingSingleLine, closingIndex);
|
|
17779
17336
|
}
|
|
17780
17337
|
});
|
|
17781
|
-
if (hasFixed)
|
|
17782
|
-
setDeclarationValue(decl, parsedValue.toString());
|
|
17783
|
-
}
|
|
17338
|
+
if (hasFixed) setDeclarationValue(decl, parsedValue.toString());
|
|
17784
17339
|
function complain(message, offset) {
|
|
17785
17340
|
const problemIndex = declarationValueIndex(decl) + offset;
|
|
17786
17341
|
report$y({
|
|
@@ -17808,9 +17363,7 @@ const index$J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17808
17363
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
17809
17364
|
function atRuleParamIndex(atRule2) {
|
|
17810
17365
|
let index2 = 1 + atRule2.name.length;
|
|
17811
|
-
if (atRule2.raws.afterName)
|
|
17812
|
-
index2 += atRule2.raws.afterName.length;
|
|
17813
|
-
}
|
|
17366
|
+
if (atRule2.raws.afterName) index2 += atRule2.raws.afterName.length;
|
|
17814
17367
|
return index2;
|
|
17815
17368
|
}
|
|
17816
17369
|
let { utils: { report: report$x, ruleMessages: ruleMessages$I, validateOptions: validateOptions$I } } = stylelint;
|
|
@@ -17831,9 +17384,7 @@ function rule$I(primary) {
|
|
|
17831
17384
|
actual: primary,
|
|
17832
17385
|
possible: [`always`, `never`]
|
|
17833
17386
|
});
|
|
17834
|
-
if (!validOptions)
|
|
17835
|
-
return;
|
|
17836
|
-
}
|
|
17387
|
+
if (!validOptions) return;
|
|
17837
17388
|
function check(node2, value, nodeIndex, fix) {
|
|
17838
17389
|
styleSearch(
|
|
17839
17390
|
{
|
|
@@ -17848,25 +17399,15 @@ function rule$I(primary) {
|
|
|
17848
17399
|
}
|
|
17849
17400
|
function checkClosingParen(source, index2, node2, nodeIndex, fix) {
|
|
17850
17401
|
let nextChar = source.charAt(index2);
|
|
17851
|
-
if (!nextChar)
|
|
17852
|
-
return;
|
|
17853
|
-
}
|
|
17402
|
+
if (!nextChar) return;
|
|
17854
17403
|
const problemIndex = nodeIndex + index2;
|
|
17855
17404
|
if (primary === `always`) {
|
|
17856
|
-
if (nextChar === ` `)
|
|
17857
|
-
return;
|
|
17858
|
-
}
|
|
17405
|
+
if (nextChar === ` `) return;
|
|
17859
17406
|
if (nextChar === `
|
|
17860
|
-
`)
|
|
17861
|
-
return;
|
|
17862
|
-
}
|
|
17407
|
+
`) return;
|
|
17863
17408
|
if (source.slice(index2, index2 + 2) === `\r
|
|
17864
|
-
`)
|
|
17865
|
-
|
|
17866
|
-
}
|
|
17867
|
-
if (ACCEPTABLE_AFTER_CLOSING_PAREN.has(nextChar)) {
|
|
17868
|
-
return;
|
|
17869
|
-
}
|
|
17409
|
+
`) return;
|
|
17410
|
+
if (ACCEPTABLE_AFTER_CLOSING_PAREN.has(nextChar)) return;
|
|
17870
17411
|
report$x({
|
|
17871
17412
|
message: messages$I.expected,
|
|
17872
17413
|
node: node2,
|
|
@@ -17904,15 +17445,11 @@ function rule$I(primary) {
|
|
|
17904
17445
|
} else if (primary === `never`) {
|
|
17905
17446
|
applyFix = (index2) => {
|
|
17906
17447
|
let whitespaceEndIndex = index2 + 1;
|
|
17907
|
-
while (whitespaceEndIndex < value.length && isWhitespace$1(value.charAt(whitespaceEndIndex)))
|
|
17908
|
-
whitespaceEndIndex++;
|
|
17909
|
-
}
|
|
17448
|
+
while (whitespaceEndIndex < value.length && isWhitespace$1(value.charAt(whitespaceEndIndex))) whitespaceEndIndex++;
|
|
17910
17449
|
fixed += value.slice(lastIndex, index2);
|
|
17911
17450
|
lastIndex = whitespaceEndIndex;
|
|
17912
17451
|
};
|
|
17913
|
-
} else {
|
|
17914
|
-
throw new Error(`Unexpected option: "${primary}"`);
|
|
17915
|
-
}
|
|
17452
|
+
} else throw new Error(`Unexpected option: "${primary}"`);
|
|
17916
17453
|
return {
|
|
17917
17454
|
applyFix,
|
|
17918
17455
|
get hasFixed() {
|
|
@@ -17928,20 +17465,15 @@ function rule$I(primary) {
|
|
|
17928
17465
|
let fixer = createFixer(param);
|
|
17929
17466
|
check(atRule2, param, atRuleParamIndex(atRule2), fixer ? fixer.applyFix : void 0);
|
|
17930
17467
|
if (fixer && fixer.hasFixed) {
|
|
17931
|
-
if (atRule2.raws.params)
|
|
17932
|
-
|
|
17933
|
-
} else {
|
|
17934
|
-
atRule2.params = fixer.fixed;
|
|
17935
|
-
}
|
|
17468
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = fixer.fixed;
|
|
17469
|
+
else atRule2.params = fixer.fixed;
|
|
17936
17470
|
}
|
|
17937
17471
|
});
|
|
17938
17472
|
root2.walkDecls((decl) => {
|
|
17939
17473
|
let value = getDeclarationValue(decl);
|
|
17940
17474
|
let fixer = createFixer(value);
|
|
17941
17475
|
check(decl, value, declarationValueIndex(decl), fixer ? fixer.applyFix : void 0);
|
|
17942
|
-
if (fixer && fixer.hasFixed)
|
|
17943
|
-
setDeclarationValue(decl, fixer.fixed);
|
|
17944
|
-
}
|
|
17476
|
+
if (fixer && fixer.hasFixed) setDeclarationValue(decl, fixer.fixed);
|
|
17945
17477
|
});
|
|
17946
17478
|
};
|
|
17947
17479
|
}
|
|
@@ -17958,9 +17490,7 @@ const index$I = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17958
17490
|
function isStyledSyntaxDeclaration(declaration2) {
|
|
17959
17491
|
let parent = declaration2.parent;
|
|
17960
17492
|
while (parent) {
|
|
17961
|
-
if (parent.raws.styledSyntaxRangeStart !== void 0)
|
|
17962
|
-
return true;
|
|
17963
|
-
}
|
|
17493
|
+
if (parent.raws.styledSyntaxRangeStart !== void 0) return true;
|
|
17964
17494
|
parent = parent.parent;
|
|
17965
17495
|
}
|
|
17966
17496
|
return false;
|
|
@@ -17999,9 +17529,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
17999
17529
|
optional: true
|
|
18000
17530
|
}
|
|
18001
17531
|
);
|
|
18002
|
-
if (!validOptions)
|
|
18003
|
-
return;
|
|
18004
|
-
}
|
|
17532
|
+
if (!validOptions) return;
|
|
18005
17533
|
let spaceCount = isNumber$1(primary) ? primary : null;
|
|
18006
17534
|
let indentChar = spaceCount === null ? ` ` : ` `.repeat(spaceCount);
|
|
18007
17535
|
let warningWord = primary === `tab` ? `tab` : `space`;
|
|
@@ -18021,9 +17549,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18021
17549
|
let before = (node2.raws.before || ``).replace(/[*_]$/, ``);
|
|
18022
17550
|
let after = typeof node2.raws.after === `string` ? node2.raws.after : ``;
|
|
18023
17551
|
let parent = node2.parent;
|
|
18024
|
-
if (!parent)
|
|
18025
|
-
throw new Error(`A parent node must be present`);
|
|
18026
|
-
}
|
|
17552
|
+
if (!parent) throw new Error(`A parent node must be present`);
|
|
18027
17553
|
let expectedOpeningBraceIndentation = indentChar.repeat(nodeLevel);
|
|
18028
17554
|
let isFirstChild = parent.type === `root` && parent.first === node2;
|
|
18029
17555
|
let lastIndexOfNewline = before.lastIndexOf(`
|
|
@@ -18037,9 +17563,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18037
17563
|
result: result2,
|
|
18038
17564
|
ruleName: ruleName$H,
|
|
18039
17565
|
fix() {
|
|
18040
|
-
if (isFirstChild && isString(node2.raws.before))
|
|
18041
|
-
node2.raws.before = node2.raws.before.replace(/^[ \t]*(?=\S|$)/, expectedOpeningBraceIndentation);
|
|
18042
|
-
}
|
|
17566
|
+
if (isFirstChild && isString(node2.raws.before)) node2.raws.before = node2.raws.before.replace(/^[ \t]*(?=\S|$)/, expectedOpeningBraceIndentation);
|
|
18043
17567
|
node2.raws.before = fixIndentation(node2.raws.before, expectedOpeningBraceIndentation);
|
|
18044
17568
|
}
|
|
18045
17569
|
});
|
|
@@ -18063,15 +17587,9 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18063
17587
|
}
|
|
18064
17588
|
});
|
|
18065
17589
|
}
|
|
18066
|
-
if (isDeclaration(node2))
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
if (isRule(node2)) {
|
|
18070
|
-
checkSelector(node2, nodeLevel);
|
|
18071
|
-
}
|
|
18072
|
-
if (isAtRule(node2)) {
|
|
18073
|
-
checkAtRuleParams(node2, nodeLevel);
|
|
18074
|
-
}
|
|
17590
|
+
if (isDeclaration(node2)) checkValue(node2, nodeLevel);
|
|
17591
|
+
if (isRule(node2)) checkSelector(node2, nodeLevel);
|
|
17592
|
+
if (isAtRule(node2)) checkAtRuleParams(node2, nodeLevel);
|
|
18075
17593
|
});
|
|
18076
17594
|
function getStyledDeclarationLevel(node2) {
|
|
18077
17595
|
const expressionStartLine = node2.parent.parent.source.input.css.split(`
|
|
@@ -18080,62 +17598,42 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18080
17598
|
return Math.ceil(indentCharacters.length / indentChar.length);
|
|
18081
17599
|
}
|
|
18082
17600
|
function indentationLevel(node2, level = 0) {
|
|
18083
|
-
if (!node2.parent)
|
|
18084
|
-
throw new Error(`A parent node must be present`);
|
|
18085
|
-
}
|
|
17601
|
+
if (!node2.parent) throw new Error(`A parent node must be present`);
|
|
18086
17602
|
if (isStyledSyntaxNode(node2)) {
|
|
18087
17603
|
const isMultilineDeclaration = !!node2.parent.source?.input.css.includes(`
|
|
18088
17604
|
`);
|
|
18089
17605
|
if (isMultilineDeclaration) level++;
|
|
18090
17606
|
level += getStyledDeclarationLevel(node2);
|
|
18091
17607
|
}
|
|
18092
|
-
if (isRoot(node2.parent))
|
|
18093
|
-
return level + getRootBaseIndentLevel(node2.parent, baseIndentLevel, primary);
|
|
18094
|
-
}
|
|
17608
|
+
if (isRoot(node2.parent)) return level + getRootBaseIndentLevel(node2.parent, baseIndentLevel, primary);
|
|
18095
17609
|
let calculatedLevel;
|
|
18096
17610
|
calculatedLevel = indentationLevel(node2.parent, level + 1);
|
|
18097
|
-
if (optionsMatches(secondaryOptions, `except`, `block`) && (isRule(node2) || isAtRule(node2)) && hasBlock(node2))
|
|
18098
|
-
calculatedLevel--;
|
|
18099
|
-
}
|
|
17611
|
+
if (optionsMatches(secondaryOptions, `except`, `block`) && (isRule(node2) || isAtRule(node2)) && hasBlock(node2)) calculatedLevel--;
|
|
18100
17612
|
return calculatedLevel;
|
|
18101
17613
|
}
|
|
18102
17614
|
function checkValue(decl, declLevel) {
|
|
18103
17615
|
if (!decl.value.includes(`
|
|
18104
|
-
`))
|
|
18105
|
-
|
|
18106
|
-
|
|
18107
|
-
if (isStyledSyntaxDeclaration(decl) && decl.value.includes(`\${`)) {
|
|
18108
|
-
return;
|
|
18109
|
-
}
|
|
18110
|
-
if (optionsMatches(secondaryOptions, `ignore`, `value`)) {
|
|
18111
|
-
return;
|
|
18112
|
-
}
|
|
17616
|
+
`)) return;
|
|
17617
|
+
if (isStyledSyntaxDeclaration(decl) && decl.value.includes(`\${`)) return;
|
|
17618
|
+
if (optionsMatches(secondaryOptions, `ignore`, `value`)) return;
|
|
18113
17619
|
let declString = decl.toString();
|
|
18114
17620
|
let valueLevel = optionsMatches(secondaryOptions, `except`, `value`) ? declLevel : declLevel + 1;
|
|
18115
17621
|
checkMultilineBit(declString, valueLevel, decl);
|
|
18116
17622
|
}
|
|
18117
17623
|
function checkSelector(ruleNode, ruleLevel) {
|
|
18118
17624
|
let selector2 = ruleNode.selector;
|
|
18119
|
-
if (ruleNode.params)
|
|
18120
|
-
|
|
18121
|
-
}
|
|
18122
|
-
if (selector2.match(/:\w+\(\s*\r?\n/)) {
|
|
18123
|
-
ruleLevel += 1;
|
|
18124
|
-
}
|
|
17625
|
+
if (ruleNode.params) ruleLevel += 1;
|
|
17626
|
+
if (selector2.match(/:\w+\(\s*\r?\n/)) ruleLevel += 1;
|
|
18125
17627
|
checkMultilineBit(selector2, ruleLevel, ruleNode);
|
|
18126
17628
|
}
|
|
18127
17629
|
function checkAtRuleParams(atRule2, ruleLevel) {
|
|
18128
|
-
if (optionsMatches(secondaryOptions, `ignore`, `param`))
|
|
18129
|
-
return;
|
|
18130
|
-
}
|
|
17630
|
+
if (optionsMatches(secondaryOptions, `ignore`, `param`)) return;
|
|
18131
17631
|
let paramLevel = optionsMatches(secondaryOptions, `except`, `param`) || atRule2.name === `nest` || atRule2.name === `at-root` ? ruleLevel : ruleLevel + 1;
|
|
18132
17632
|
checkMultilineBit(beforeBlockString(atRule2).trim(), paramLevel, atRule2);
|
|
18133
17633
|
}
|
|
18134
17634
|
function checkMultilineBit(source, newlineIndentLevel, node2) {
|
|
18135
17635
|
if (!source.includes(`
|
|
18136
|
-
`))
|
|
18137
|
-
return;
|
|
18138
|
-
}
|
|
17636
|
+
`)) return;
|
|
18139
17637
|
let fixPositions = [];
|
|
18140
17638
|
let parentheticalDepth = 0;
|
|
18141
17639
|
let ignoreInsideParans = optionsMatches(secondaryOptions, `ignore`, `inside-parens`);
|
|
@@ -18149,61 +17647,37 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18149
17647
|
},
|
|
18150
17648
|
(match, matchCount) => {
|
|
18151
17649
|
let precedesClosingParenthesis = /^[ \t]*\)/.test(source.slice(match.startIndex + 1));
|
|
18152
|
-
if (ignoreInsideParans && (precedesClosingParenthesis || match.insideParens))
|
|
18153
|
-
return;
|
|
18154
|
-
}
|
|
17650
|
+
if (ignoreInsideParans && (precedesClosingParenthesis || match.insideParens)) return;
|
|
18155
17651
|
let expectedIndentLevel = newlineIndentLevel;
|
|
18156
17652
|
if (!ignoreInsideParans && match.insideParens) {
|
|
18157
|
-
if (matchCount === 1)
|
|
18158
|
-
parentheticalDepth -= 1;
|
|
18159
|
-
}
|
|
17653
|
+
if (matchCount === 1) parentheticalDepth -= 1;
|
|
18160
17654
|
let newlineIndex = match.startIndex;
|
|
18161
|
-
if (source[match.startIndex - 1] === `\r`)
|
|
18162
|
-
newlineIndex--;
|
|
18163
|
-
}
|
|
17655
|
+
if (source[match.startIndex - 1] === `\r`) newlineIndex--;
|
|
18164
17656
|
let followsOpeningParenthesis = /\([ \t]*$/.test(source.slice(0, newlineIndex));
|
|
18165
|
-
if (followsOpeningParenthesis)
|
|
18166
|
-
parentheticalDepth += 1;
|
|
18167
|
-
}
|
|
17657
|
+
if (followsOpeningParenthesis) parentheticalDepth += 1;
|
|
18168
17658
|
let followsOpeningBrace = /\{[ \t]*$/.test(source.slice(0, newlineIndex));
|
|
18169
|
-
if (followsOpeningBrace)
|
|
18170
|
-
parentheticalDepth += 1;
|
|
18171
|
-
}
|
|
17659
|
+
if (followsOpeningBrace) parentheticalDepth += 1;
|
|
18172
17660
|
let startingClosingBrace = /^[ \t]*\}/.test(source.slice(match.startIndex + 1));
|
|
18173
|
-
if (startingClosingBrace)
|
|
18174
|
-
parentheticalDepth -= 1;
|
|
18175
|
-
}
|
|
17661
|
+
if (startingClosingBrace) parentheticalDepth -= 1;
|
|
18176
17662
|
expectedIndentLevel += parentheticalDepth;
|
|
18177
|
-
if (precedesClosingParenthesis)
|
|
18178
|
-
parentheticalDepth -= 1;
|
|
18179
|
-
}
|
|
17663
|
+
if (precedesClosingParenthesis) parentheticalDepth -= 1;
|
|
18180
17664
|
switch (secondaryOptions.indentInsideParens) {
|
|
18181
17665
|
case `twice`:
|
|
18182
|
-
if (!precedesClosingParenthesis || indentClosingBrace)
|
|
18183
|
-
expectedIndentLevel += 1;
|
|
18184
|
-
}
|
|
17666
|
+
if (!precedesClosingParenthesis || indentClosingBrace) expectedIndentLevel += 1;
|
|
18185
17667
|
break;
|
|
18186
17668
|
case `once-at-root-twice-in-block`:
|
|
18187
17669
|
if (node2.parent === node2.root()) {
|
|
18188
|
-
if (precedesClosingParenthesis && !indentClosingBrace)
|
|
18189
|
-
expectedIndentLevel -= 1;
|
|
18190
|
-
}
|
|
17670
|
+
if (precedesClosingParenthesis && !indentClosingBrace) expectedIndentLevel -= 1;
|
|
18191
17671
|
break;
|
|
18192
17672
|
}
|
|
18193
|
-
if (!precedesClosingParenthesis || indentClosingBrace)
|
|
18194
|
-
expectedIndentLevel += 1;
|
|
18195
|
-
}
|
|
17673
|
+
if (!precedesClosingParenthesis || indentClosingBrace) expectedIndentLevel += 1;
|
|
18196
17674
|
break;
|
|
18197
17675
|
default:
|
|
18198
|
-
if (precedesClosingParenthesis && !indentClosingBrace)
|
|
18199
|
-
expectedIndentLevel -= 1;
|
|
18200
|
-
}
|
|
17676
|
+
if (precedesClosingParenthesis && !indentClosingBrace) expectedIndentLevel -= 1;
|
|
18201
17677
|
}
|
|
18202
17678
|
}
|
|
18203
17679
|
let afterNewlineSpaceMatches = /^([ \t]*)\S/.exec(source.slice(match.startIndex + 1));
|
|
18204
|
-
if (!afterNewlineSpaceMatches)
|
|
18205
|
-
return;
|
|
18206
|
-
}
|
|
17680
|
+
if (!afterNewlineSpaceMatches) return;
|
|
18207
17681
|
let afterNewlineSpace = afterNewlineSpaceMatches[1] || ``;
|
|
18208
17682
|
let expectedIndentation = indentChar.repeat(
|
|
18209
17683
|
expectedIndentLevel > 0 ? expectedIndentLevel : 0
|
|
@@ -18243,9 +17717,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18243
17717
|
if (isDeclaration(node2)) {
|
|
18244
17718
|
let declProp = node2.prop;
|
|
18245
17719
|
let declBetween = node2.raws.between;
|
|
18246
|
-
if (!isString(declBetween))
|
|
18247
|
-
throw new TypeError(`The \`between\` property must be a string`);
|
|
18248
|
-
}
|
|
17720
|
+
if (!isString(declBetween)) throw new TypeError(`The \`between\` property must be a string`);
|
|
18249
17721
|
for (let fixPosition of fixPositions) {
|
|
18250
17722
|
if (fixPosition.startIndex < declProp.length + declBetween.length) {
|
|
18251
17723
|
node2.raws.between = replaceIndentation(
|
|
@@ -18268,9 +17740,7 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18268
17740
|
let atRuleName = node2.name;
|
|
18269
17741
|
let atRuleAfterName = node2.raws.afterName;
|
|
18270
17742
|
let atRuleParams = node2.params;
|
|
18271
|
-
if (!isString(atRuleAfterName))
|
|
18272
|
-
throw new TypeError(`The \`afterName\` property must be a string`);
|
|
18273
|
-
}
|
|
17743
|
+
if (!isString(atRuleAfterName)) throw new TypeError(`The \`afterName\` property must be a string`);
|
|
18274
17744
|
for (let fixPosition of fixPositions) {
|
|
18275
17745
|
if (fixPosition.startIndex < 1 + atRuleName.length + atRuleAfterName.length) {
|
|
18276
17746
|
node2.raws.afterName = replaceIndentation(
|
|
@@ -18295,38 +17765,26 @@ function rule$H(primary, secondaryOptions = {}) {
|
|
|
18295
17765
|
}
|
|
18296
17766
|
function getRootBaseIndentLevel(root2, baseIndentLevel, space) {
|
|
18297
17767
|
let document2 = getDocument(root2);
|
|
18298
|
-
if (!document2)
|
|
18299
|
-
|
|
18300
|
-
}
|
|
18301
|
-
if (!root2.source) {
|
|
18302
|
-
throw new Error(`The root node must have a source`);
|
|
18303
|
-
}
|
|
17768
|
+
if (!document2) return 0;
|
|
17769
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
18304
17770
|
let source = root2.source;
|
|
18305
17771
|
let indentLevel = source.baseIndentLevel;
|
|
18306
|
-
if (isNumber$1(indentLevel) && Number.isSafeInteger(indentLevel))
|
|
18307
|
-
return indentLevel;
|
|
18308
|
-
}
|
|
17772
|
+
if (isNumber$1(indentLevel) && Number.isSafeInteger(indentLevel)) return indentLevel;
|
|
18309
17773
|
let newIndentLevel = inferRootIndentLevel(root2, baseIndentLevel, () => inferDocIndentSize(document2, space));
|
|
18310
17774
|
source.baseIndentLevel = newIndentLevel;
|
|
18311
17775
|
return newIndentLevel;
|
|
18312
17776
|
}
|
|
18313
17777
|
function getDocument(node2) {
|
|
18314
17778
|
let document2 = node2.document;
|
|
18315
|
-
if (document2)
|
|
18316
|
-
return document2;
|
|
18317
|
-
}
|
|
17779
|
+
if (document2) return document2;
|
|
18318
17780
|
let root2 = node2.root();
|
|
18319
17781
|
return root2 && root2.document;
|
|
18320
17782
|
}
|
|
18321
17783
|
function inferDocIndentSize(document2, space) {
|
|
18322
|
-
if (!document2.source)
|
|
18323
|
-
throw new Error(`The document node must have a source`);
|
|
18324
|
-
}
|
|
17784
|
+
if (!document2.source) throw new Error(`The document node must have a source`);
|
|
18325
17785
|
let docSource = document2.source;
|
|
18326
17786
|
let indentSize = docSource.indentSize;
|
|
18327
|
-
if (isNumber$1(indentSize) && Number.isSafeInteger(indentSize))
|
|
18328
|
-
return indentSize;
|
|
18329
|
-
}
|
|
17787
|
+
if (isNumber$1(indentSize) && Number.isSafeInteger(indentSize)) return indentSize;
|
|
18330
17788
|
let source = document2.source.input.css;
|
|
18331
17789
|
let indents = source.match(/^ *(?=\S)/gm);
|
|
18332
17790
|
if (indents) {
|
|
@@ -18335,23 +17793,16 @@ function inferDocIndentSize(document2, space) {
|
|
|
18335
17793
|
lastIndentSize = Math.abs(leadingSpacesLength - lastLeadingSpacesLength) || lastIndentSize;
|
|
18336
17794
|
if (lastIndentSize > 1) {
|
|
18337
17795
|
let score = scores.get(lastIndentSize);
|
|
18338
|
-
if (score)
|
|
18339
|
-
|
|
18340
|
-
} else {
|
|
18341
|
-
scores.set(lastIndentSize, 1);
|
|
18342
|
-
}
|
|
17796
|
+
if (score) scores.set(lastIndentSize, score + 1);
|
|
17797
|
+
else scores.set(lastIndentSize, 1);
|
|
18343
17798
|
}
|
|
18344
|
-
} else
|
|
18345
|
-
lastIndentSize = 0;
|
|
18346
|
-
}
|
|
17799
|
+
} else lastIndentSize = 0;
|
|
18347
17800
|
lastLeadingSpacesLength = leadingSpacesLength;
|
|
18348
17801
|
};
|
|
18349
17802
|
let scores = /* @__PURE__ */ new Map();
|
|
18350
17803
|
let lastIndentSize = 0;
|
|
18351
17804
|
let lastLeadingSpacesLength = 0;
|
|
18352
|
-
for (let leadingSpaces of indents)
|
|
18353
|
-
vote(leadingSpaces.length);
|
|
18354
|
-
}
|
|
17805
|
+
for (let leadingSpaces of indents) vote(leadingSpaces.length);
|
|
18355
17806
|
let bestScore = 0;
|
|
18356
17807
|
for (let [indentSizeDate, score] of scores.entries()) {
|
|
18357
17808
|
if (score > bestScore) {
|
|
@@ -18374,25 +17825,17 @@ function inferRootIndentLevel(root2, baseIndentLevel, indentSize) {
|
|
|
18374
17825
|
}
|
|
18375
17826
|
let newBaseIndentLevel = 0;
|
|
18376
17827
|
if (!isNumber$1(baseIndentLevel) || !Number.isSafeInteger(baseIndentLevel)) {
|
|
18377
|
-
if (!root2.source)
|
|
18378
|
-
throw new Error(`The root node must have a source`);
|
|
18379
|
-
}
|
|
17828
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
18380
17829
|
let source = root2.source.input.css;
|
|
18381
17830
|
source = source.replace(/^[^\r\n]+/, (firstLine) => {
|
|
18382
17831
|
let match = root2.raws.codeBefore && /(?:^|\n)([ \t]*)$/.exec(root2.raws.codeBefore);
|
|
18383
|
-
if (match)
|
|
18384
|
-
return match[1] + firstLine;
|
|
18385
|
-
}
|
|
17832
|
+
if (match) return match[1] + firstLine;
|
|
18386
17833
|
return ``;
|
|
18387
17834
|
});
|
|
18388
17835
|
let indentions = source.match(/^[ \t]*(?=\S)/gm);
|
|
18389
|
-
if (indentions)
|
|
18390
|
-
return Math.min(...indentions.map((indent) => getIndentLevel(indent)));
|
|
18391
|
-
}
|
|
17836
|
+
if (indentions) return Math.min(...indentions.map((indent) => getIndentLevel(indent)));
|
|
18392
17837
|
newBaseIndentLevel = 1;
|
|
18393
|
-
} else
|
|
18394
|
-
newBaseIndentLevel = baseIndentLevel;
|
|
18395
|
-
}
|
|
17838
|
+
} else newBaseIndentLevel = baseIndentLevel;
|
|
18396
17839
|
let indents = [];
|
|
18397
17840
|
let foundIndents = root2.raws.codeBefore?.match(/(?:^|\n)([\t ]*)\S/gm);
|
|
18398
17841
|
if (foundIndents) {
|
|
@@ -18419,28 +17862,18 @@ function inferRootIndentLevel(root2, baseIndentLevel, indentSize) {
|
|
|
18419
17862
|
afterEnd = nextRoot ? nextRoot.raws.codeBefore : document2.raws.codeAfter;
|
|
18420
17863
|
} else {
|
|
18421
17864
|
let parent = root2.parent;
|
|
18422
|
-
if (!parent)
|
|
18423
|
-
throw new Error(`The root node must have a parent`);
|
|
18424
|
-
}
|
|
17865
|
+
if (!parent) throw new Error(`The root node must have a parent`);
|
|
18425
17866
|
let nextRoot = parent.nodes[parent.nodes.indexOf(root2) + 1];
|
|
18426
17867
|
afterEnd = nextRoot ? nextRoot.raws.codeBefore : root2.raws.codeAfter;
|
|
18427
17868
|
}
|
|
18428
|
-
} else
|
|
18429
|
-
|
|
18430
|
-
}
|
|
18431
|
-
if (afterEnd) {
|
|
18432
|
-
indents.push(afterEnd.match(/^[ \t]*/)[0]);
|
|
18433
|
-
}
|
|
18434
|
-
}
|
|
18435
|
-
if (indents.length) {
|
|
18436
|
-
return Math.max(...indents.map((indent) => getIndentLevel(indent))) + newBaseIndentLevel;
|
|
17869
|
+
} else afterEnd = after;
|
|
17870
|
+
if (afterEnd) indents.push(afterEnd.match(/^[ \t]*/)[0]);
|
|
18437
17871
|
}
|
|
17872
|
+
if (indents.length) return Math.max(...indents.map((indent) => getIndentLevel(indent))) + newBaseIndentLevel;
|
|
18438
17873
|
return newBaseIndentLevel;
|
|
18439
17874
|
}
|
|
18440
17875
|
function fixIndentation(str, whitespace) {
|
|
18441
|
-
if (!isString(str))
|
|
18442
|
-
return str;
|
|
18443
|
-
}
|
|
17876
|
+
if (!isString(str)) return str;
|
|
18444
17877
|
return str.replace(/\n[ \t]*(?=\S|$)/g, `
|
|
18445
17878
|
${whitespace}`);
|
|
18446
17879
|
}
|
|
@@ -18476,42 +17909,24 @@ function rule$G(primary) {
|
|
|
18476
17909
|
actual: primary,
|
|
18477
17910
|
possible: [`unix`, `windows`]
|
|
18478
17911
|
});
|
|
18479
|
-
if (!validOptions)
|
|
18480
|
-
return;
|
|
18481
|
-
}
|
|
17912
|
+
if (!validOptions) return;
|
|
18482
17913
|
let shouldHaveCR = primary === `windows`;
|
|
18483
17914
|
function fix() {
|
|
18484
17915
|
root2.walk((node2) => {
|
|
18485
|
-
if (`selector` in node2)
|
|
18486
|
-
|
|
18487
|
-
|
|
18488
|
-
if (
|
|
18489
|
-
|
|
18490
|
-
}
|
|
18491
|
-
if (`text` in node2) {
|
|
18492
|
-
node2.text = fixData(node2.text);
|
|
18493
|
-
}
|
|
18494
|
-
if (node2.raws.before) {
|
|
18495
|
-
node2.raws.before = fixData(node2.raws.before);
|
|
18496
|
-
}
|
|
18497
|
-
if (typeof node2.raws.after === `string`) {
|
|
18498
|
-
node2.raws.after = fixData(node2.raws.after);
|
|
18499
|
-
}
|
|
17916
|
+
if (`selector` in node2) node2.selector = fixData(node2.selector);
|
|
17917
|
+
if (`value` in node2) node2.value = fixData(node2.value);
|
|
17918
|
+
if (`text` in node2) node2.text = fixData(node2.text);
|
|
17919
|
+
if (node2.raws.before) node2.raws.before = fixData(node2.raws.before);
|
|
17920
|
+
if (typeof node2.raws.after === `string`) node2.raws.after = fixData(node2.raws.after);
|
|
18500
17921
|
});
|
|
18501
|
-
if (typeof root2.raws.after === `string`)
|
|
18502
|
-
root2.raws.after = fixData(root2.raws.after);
|
|
18503
|
-
}
|
|
18504
|
-
}
|
|
18505
|
-
if (root2.source === null) {
|
|
18506
|
-
throw new Error(`The root node must have a source`);
|
|
17922
|
+
if (typeof root2.raws.after === `string`) root2.raws.after = fixData(root2.raws.after);
|
|
18507
17923
|
}
|
|
17924
|
+
if (root2.source === null) throw new Error(`The root node must have a source`);
|
|
18508
17925
|
let lines = root2.source.input.css.split(`
|
|
18509
17926
|
`);
|
|
18510
17927
|
for (let [i2, line] of lines.entries()) {
|
|
18511
|
-
if (i2 < lines.length - 1 && !line.includes(`\r`))
|
|
18512
|
-
line += `
|
|
17928
|
+
if (i2 < lines.length - 1 && !line.includes(`\r`)) line += `
|
|
18513
17929
|
`;
|
|
18514
|
-
}
|
|
18515
17930
|
if (hasError(line)) {
|
|
18516
17931
|
let lineNum = i2 + 1;
|
|
18517
17932
|
let colNum = line.length;
|
|
@@ -18526,10 +17941,8 @@ function rule$G(primary) {
|
|
|
18526
17941
|
function fixData(data) {
|
|
18527
17942
|
if (data) {
|
|
18528
17943
|
let res = data.replace(/\r/g, ``);
|
|
18529
|
-
if (shouldHaveCR)
|
|
18530
|
-
res = res.replace(/\n/g, `\r
|
|
17944
|
+
if (shouldHaveCR) res = res.replace(/\n/g, `\r
|
|
18531
17945
|
`);
|
|
18532
|
-
}
|
|
18533
17946
|
return res;
|
|
18534
17947
|
}
|
|
18535
17948
|
return data;
|
|
@@ -18591,9 +18004,7 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18591
18004
|
optional: true
|
|
18592
18005
|
}
|
|
18593
18006
|
);
|
|
18594
|
-
if (!validOptions)
|
|
18595
|
-
return;
|
|
18596
|
-
}
|
|
18007
|
+
if (!validOptions) return;
|
|
18597
18008
|
let ignoreComments = optionsMatches(secondaryOptions, `ignore`, `comments`);
|
|
18598
18009
|
let getChars = replaceEmptyLines.bind(null, primary);
|
|
18599
18010
|
function fix() {
|
|
@@ -18602,16 +18013,12 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18602
18013
|
node2.raws.left = getChars(node2.raws.left);
|
|
18603
18014
|
node2.raws.right = getChars(node2.raws.right);
|
|
18604
18015
|
}
|
|
18605
|
-
if (node2.raws.before)
|
|
18606
|
-
node2.raws.before = getChars(node2.raws.before);
|
|
18607
|
-
}
|
|
18016
|
+
if (node2.raws.before) node2.raws.before = getChars(node2.raws.before);
|
|
18608
18017
|
});
|
|
18609
18018
|
let firstNodeRawsBefore = root2.first && root2.first.raws.before;
|
|
18610
18019
|
let rootRawsAfter = root2.raws.after;
|
|
18611
18020
|
if ((root2.document && root2.document.constructor.name) !== `Document`) {
|
|
18612
|
-
if (firstNodeRawsBefore)
|
|
18613
|
-
root2.first.raws.before = getChars(firstNodeRawsBefore, true);
|
|
18614
|
-
}
|
|
18021
|
+
if (firstNodeRawsBefore) root2.first.raws.before = getChars(firstNodeRawsBefore, true);
|
|
18615
18022
|
if (rootRawsAfter) {
|
|
18616
18023
|
root2.raws.after = replaceEmptyLines(primary === 0 ? 1 : primary, rootRawsAfter, true);
|
|
18617
18024
|
}
|
|
@@ -18637,18 +18044,11 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18637
18044
|
function checkMatch(source, matchStartIndex, matchEndIndex, node2) {
|
|
18638
18045
|
let eof = matchEndIndex === source.length;
|
|
18639
18046
|
let problem = false;
|
|
18640
|
-
if (!matchStartIndex || lastIndex === matchStartIndex)
|
|
18641
|
-
|
|
18642
|
-
} else {
|
|
18643
|
-
emptyLines = 0;
|
|
18644
|
-
}
|
|
18047
|
+
if (!matchStartIndex || lastIndex === matchStartIndex) emptyLines++;
|
|
18048
|
+
else emptyLines = 0;
|
|
18645
18049
|
lastIndex = matchEndIndex;
|
|
18646
|
-
if (emptyLines > primary)
|
|
18647
|
-
|
|
18648
|
-
}
|
|
18649
|
-
if (!eof && !problem) {
|
|
18650
|
-
return;
|
|
18651
|
-
}
|
|
18050
|
+
if (emptyLines > primary) problem = true;
|
|
18051
|
+
if (!eof && !problem) return;
|
|
18652
18052
|
if (problem) {
|
|
18653
18053
|
report$u({
|
|
18654
18054
|
message: messages$F.expected,
|
|
@@ -18679,35 +18079,26 @@ function rule$F(primary, secondaryOptions) {
|
|
|
18679
18079
|
}
|
|
18680
18080
|
function replaceEmptyLines(maxLines, str, isSpecialCase = false) {
|
|
18681
18081
|
let repeatTimes = isSpecialCase ? maxLines : maxLines + 1;
|
|
18682
|
-
if (repeatTimes === 0 || typeof str !== `string`)
|
|
18683
|
-
return ``;
|
|
18684
|
-
}
|
|
18082
|
+
if (repeatTimes === 0 || typeof str !== `string`) return ``;
|
|
18685
18083
|
let emptyLFLines = `
|
|
18686
18084
|
`.repeat(repeatTimes);
|
|
18687
18085
|
let emptyCRLFLines = `\r
|
|
18688
18086
|
`.repeat(repeatTimes);
|
|
18689
18087
|
return /(?:\r\n)+/.test(str) ? str.replace(/(\r\n)+/g, ($1) => {
|
|
18690
|
-
if ($1.length / 2 > repeatTimes)
|
|
18691
|
-
return emptyCRLFLines;
|
|
18692
|
-
}
|
|
18088
|
+
if ($1.length / 2 > repeatTimes) return emptyCRLFLines;
|
|
18693
18089
|
return $1;
|
|
18694
18090
|
}) : str.replace(/(\n)+/g, ($1) => {
|
|
18695
|
-
if ($1.length > repeatTimes)
|
|
18696
|
-
return emptyLFLines;
|
|
18697
|
-
}
|
|
18091
|
+
if ($1.length > repeatTimes) return emptyLFLines;
|
|
18698
18092
|
return $1;
|
|
18699
18093
|
});
|
|
18700
18094
|
}
|
|
18701
18095
|
};
|
|
18702
18096
|
}
|
|
18703
18097
|
function isEofNode(document2, root2) {
|
|
18704
|
-
if (!document2 || document2.constructor.name !== `Document` || !(`type` in document2))
|
|
18705
|
-
return true;
|
|
18706
|
-
}
|
|
18098
|
+
if (!document2 || document2.constructor.name !== `Document` || !(`type` in document2)) return true;
|
|
18707
18099
|
let after;
|
|
18708
|
-
if (root2 === document2.last)
|
|
18709
|
-
|
|
18710
|
-
} else {
|
|
18100
|
+
if (root2 === document2.last) after = document2.raws && document2.raws.codeAfter;
|
|
18101
|
+
else {
|
|
18711
18102
|
let rootIndex = document2.index(root2);
|
|
18712
18103
|
let nextNode = document2.nodes[rootIndex + 1];
|
|
18713
18104
|
after = nextNode && nextNode.raws && nextNode.raws.codeBefore;
|
|
@@ -18751,12 +18142,8 @@ function rule$E(primary, secondaryOptions) {
|
|
|
18751
18142
|
optional: true
|
|
18752
18143
|
}
|
|
18753
18144
|
);
|
|
18754
|
-
if (!validOptions)
|
|
18755
|
-
|
|
18756
|
-
}
|
|
18757
|
-
if (root2.source === null) {
|
|
18758
|
-
throw new Error(`The root node must have a source`);
|
|
18759
|
-
}
|
|
18145
|
+
if (!validOptions) return;
|
|
18146
|
+
if (root2.source === null) throw new Error(`The root node must have a source`);
|
|
18760
18147
|
let EXCLUDED_PATTERNS = [
|
|
18761
18148
|
/url\(\s*(\S.*\S)\s*\)/gi,
|
|
18762
18149
|
// allow tab, whitespace in url content
|
|
@@ -18793,57 +18180,35 @@ function rule$E(primary, secondaryOptions) {
|
|
|
18793
18180
|
let skippedSubString = skippedSubStrings[skippedSubStringsIndex];
|
|
18794
18181
|
assert(skippedSubString);
|
|
18795
18182
|
let [startSubString, endSubString] = skippedSubString;
|
|
18796
|
-
if (end < startSubString)
|
|
18797
|
-
return 0;
|
|
18798
|
-
}
|
|
18183
|
+
if (end < startSubString) return 0;
|
|
18799
18184
|
let excluded = Math.min(end, endSubString) - Math.max(start, startSubString);
|
|
18800
|
-
if (endSubString <= end)
|
|
18801
|
-
skippedSubStringsIndex++;
|
|
18802
|
-
}
|
|
18185
|
+
if (endSubString <= end) skippedSubStringsIndex++;
|
|
18803
18186
|
return excluded;
|
|
18804
18187
|
}
|
|
18805
18188
|
function checkNewline(match) {
|
|
18806
18189
|
let nextNewlineIndex = rootString.indexOf(`
|
|
18807
18190
|
`, match.endIndex);
|
|
18808
|
-
if (rootString[nextNewlineIndex - 1] === `\r`)
|
|
18809
|
-
|
|
18810
|
-
}
|
|
18811
|
-
if (nextNewlineIndex === -1) {
|
|
18812
|
-
nextNewlineIndex = rootString.length;
|
|
18813
|
-
}
|
|
18191
|
+
if (rootString[nextNewlineIndex - 1] === `\r`) nextNewlineIndex -= 1;
|
|
18192
|
+
if (nextNewlineIndex === -1) nextNewlineIndex = rootString.length;
|
|
18814
18193
|
let rawLineLength = nextNewlineIndex - match.endIndex;
|
|
18815
18194
|
let excludedLength = skippedSubStrings[skippedSubStringsIndex] ? tryToPopSubString(match.endIndex, nextNewlineIndex) : 0;
|
|
18816
18195
|
let lineText = rootString.slice(match.endIndex, nextNewlineIndex);
|
|
18817
|
-
if (optionsMatches(secondaryOptions, `ignorePattern`, lineText))
|
|
18818
|
-
|
|
18819
|
-
}
|
|
18820
|
-
if (rawLineLength - excludedLength <= primary) {
|
|
18821
|
-
return;
|
|
18822
|
-
}
|
|
18196
|
+
if (optionsMatches(secondaryOptions, `ignorePattern`, lineText)) return;
|
|
18197
|
+
if (rawLineLength - excludedLength <= primary) return;
|
|
18823
18198
|
let complaintIndex = nextNewlineIndex - 1;
|
|
18824
18199
|
if (ignoreComments) {
|
|
18825
|
-
if (`insideComment` in match && match.insideComment)
|
|
18826
|
-
return;
|
|
18827
|
-
}
|
|
18200
|
+
if (`insideComment` in match && match.insideComment) return;
|
|
18828
18201
|
let nextTwoChars = rootString.slice(match.endIndex).trim().slice(0, 2);
|
|
18829
|
-
if (nextTwoChars === `/*` || nextTwoChars === `//`)
|
|
18830
|
-
return;
|
|
18831
|
-
}
|
|
18202
|
+
if (nextTwoChars === `/*` || nextTwoChars === `//`) return;
|
|
18832
18203
|
}
|
|
18833
18204
|
if (ignoreNonComments) {
|
|
18834
|
-
if (`insideComment` in match && match.insideComment)
|
|
18835
|
-
return complain(complaintIndex);
|
|
18836
|
-
}
|
|
18205
|
+
if (`insideComment` in match && match.insideComment) return complain(complaintIndex);
|
|
18837
18206
|
let nextTwoChars = rootString.slice(match.endIndex).trim().slice(0, 2);
|
|
18838
|
-
if (nextTwoChars !== `/*` && nextTwoChars !== `//`)
|
|
18839
|
-
return;
|
|
18840
|
-
}
|
|
18207
|
+
if (nextTwoChars !== `/*` && nextTwoChars !== `//`) return;
|
|
18841
18208
|
return complain(complaintIndex);
|
|
18842
18209
|
}
|
|
18843
18210
|
let lineString = rootString.slice(match.endIndex, nextNewlineIndex);
|
|
18844
|
-
if (!lineString.replace(/^\s+/, ``).includes(` `))
|
|
18845
|
-
return;
|
|
18846
|
-
}
|
|
18211
|
+
if (!lineString.replace(/^\s+/, ``).includes(` `)) return;
|
|
18847
18212
|
return complain(complaintIndex);
|
|
18848
18213
|
}
|
|
18849
18214
|
};
|
|
@@ -18903,9 +18268,7 @@ function rule$D(primary) {
|
|
|
18903
18268
|
actual: primary,
|
|
18904
18269
|
possible: [`always`, `never`]
|
|
18905
18270
|
});
|
|
18906
|
-
if (!validOptions)
|
|
18907
|
-
return;
|
|
18908
|
-
}
|
|
18271
|
+
if (!validOptions) return;
|
|
18909
18272
|
let fixData;
|
|
18910
18273
|
mediaFeatureColonSpaceChecker({
|
|
18911
18274
|
root: root2,
|
|
@@ -18927,17 +18290,11 @@ function rule$D(primary) {
|
|
|
18927
18290
|
for (let index2 of colonIndices.sort((a2, b2) => b2 - a2)) {
|
|
18928
18291
|
let beforeColon = params.slice(0, index2 + 1);
|
|
18929
18292
|
let afterColon = params.slice(index2 + 1);
|
|
18930
|
-
if (primary === `always`)
|
|
18931
|
-
|
|
18932
|
-
} else if (primary === `never`) {
|
|
18933
|
-
params = beforeColon + afterColon.replace(/^\s*/, ``);
|
|
18934
|
-
}
|
|
18935
|
-
}
|
|
18936
|
-
if (atRule2.raws.params) {
|
|
18937
|
-
atRule2.raws.params.raw = params;
|
|
18938
|
-
} else {
|
|
18939
|
-
atRule2.params = params;
|
|
18293
|
+
if (primary === `always`) params = beforeColon + afterColon.replace(/^\s*/, ` `);
|
|
18294
|
+
else if (primary === `never`) params = beforeColon + afterColon.replace(/^\s*/, ``);
|
|
18940
18295
|
}
|
|
18296
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
18297
|
+
else atRule2.params = params;
|
|
18941
18298
|
}
|
|
18942
18299
|
}
|
|
18943
18300
|
};
|
|
@@ -18970,9 +18327,7 @@ function rule$C(primary) {
|
|
|
18970
18327
|
actual: primary,
|
|
18971
18328
|
possible: [`always`, `never`]
|
|
18972
18329
|
});
|
|
18973
|
-
if (!validOptions)
|
|
18974
|
-
return;
|
|
18975
|
-
}
|
|
18330
|
+
if (!validOptions) return;
|
|
18976
18331
|
let fixData;
|
|
18977
18332
|
mediaFeatureColonSpaceChecker({
|
|
18978
18333
|
root: root2,
|
|
@@ -18994,17 +18349,11 @@ function rule$C(primary) {
|
|
|
18994
18349
|
for (let index2 of colonIndices.sort((a2, b2) => b2 - a2)) {
|
|
18995
18350
|
let beforeColon = params.slice(0, index2);
|
|
18996
18351
|
let afterColon = params.slice(index2);
|
|
18997
|
-
if (primary === `always`)
|
|
18998
|
-
|
|
18999
|
-
} else if (primary === `never`) {
|
|
19000
|
-
params = beforeColon.replace(/\s*$/, ``) + afterColon;
|
|
19001
|
-
}
|
|
19002
|
-
}
|
|
19003
|
-
if (atRule2.raws.params) {
|
|
19004
|
-
atRule2.raws.params.raw = params;
|
|
19005
|
-
} else {
|
|
19006
|
-
atRule2.params = params;
|
|
18352
|
+
if (primary === `always`) params = beforeColon.replace(/\s*$/, ` `) + afterColon;
|
|
18353
|
+
else if (primary === `never`) params = beforeColon.replace(/\s*$/, ``) + afterColon;
|
|
19007
18354
|
}
|
|
18355
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
18356
|
+
else atRule2.params = params;
|
|
19008
18357
|
}
|
|
19009
18358
|
}
|
|
19010
18359
|
};
|
|
@@ -21010,9 +20359,7 @@ function findMediaFeatureNames(mediaQueryParams, callback) {
|
|
|
21010
20359
|
let tokens = tokenize$1({ css: mediaQueryParams });
|
|
21011
20360
|
let list = parseCommaSeparatedListOfComponentValues(tokens);
|
|
21012
20361
|
let mediaQueryConditions = list.flatMap((listItem) => listItem.flatMap((componentValue) => {
|
|
21013
|
-
if (!isSimpleBlockNode(componentValue) || componentValue.startToken[0] !== c.OpenParen)
|
|
21014
|
-
return [];
|
|
21015
|
-
}
|
|
20362
|
+
if (!isSimpleBlockNode(componentValue) || componentValue.startToken[0] !== c.OpenParen) return [];
|
|
21016
20363
|
let blockTokens = componentValue.tokens();
|
|
21017
20364
|
let mediaQueryList = parseFromTokens(blockTokens, {
|
|
21018
20365
|
preserveInvalidMediaQueries: true
|
|
@@ -21023,24 +20370,18 @@ function findMediaFeatureNames(mediaQueryParams, callback) {
|
|
|
21023
20370
|
mediaQuery.walk(({ node: node2 }) => {
|
|
21024
20371
|
if (isMediaFeature(node2)) {
|
|
21025
20372
|
let token = node2.getNameToken();
|
|
21026
|
-
if (token[0] !== c.Ident)
|
|
21027
|
-
return;
|
|
21028
|
-
}
|
|
20373
|
+
if (token[0] !== c.Ident) return;
|
|
21029
20374
|
callback(token);
|
|
21030
20375
|
}
|
|
21031
20376
|
if (isGeneralEnclosed(node2)) {
|
|
21032
20377
|
topLevelTokenNodes(node2).forEach((token, i2, topLevelTokens) => {
|
|
21033
|
-
if (token[0] !== c.Ident)
|
|
21034
|
-
return;
|
|
21035
|
-
}
|
|
20378
|
+
if (token[0] !== c.Ident) return;
|
|
21036
20379
|
let nextToken = topLevelTokens[i2 + 1];
|
|
21037
20380
|
let prevToken = topLevelTokens[i2 - 1];
|
|
21038
20381
|
if (
|
|
21039
20382
|
// Media Feature
|
|
21040
20383
|
!prevToken && nextToken && nextToken[0] === c.Colon || nextToken && nextToken[0] === c.Delim && rangeFeatureOperator.test(nextToken[4].value) || prevToken && prevToken[0] === c.Delim && rangeFeatureOperator.test(prevToken[4].value)
|
|
21041
|
-
)
|
|
21042
|
-
callback(token);
|
|
21043
|
-
}
|
|
20384
|
+
) callback(token);
|
|
21044
20385
|
});
|
|
21045
20386
|
}
|
|
21046
20387
|
});
|
|
@@ -21053,9 +20394,7 @@ function findMediaFeatureNames(mediaQueryParams, callback) {
|
|
|
21053
20394
|
}
|
|
21054
20395
|
function topLevelTokenNodes(node2) {
|
|
21055
20396
|
let components = node2.value.value;
|
|
21056
|
-
if (isToken(components) || components.length === 0 || isToken(components[0]))
|
|
21057
|
-
return [];
|
|
21058
|
-
}
|
|
20397
|
+
if (isToken(components) || components.length === 0 || isToken(components[0])) return [];
|
|
21059
20398
|
let relevantTokens = [];
|
|
21060
20399
|
let lastWasDollarSign = false;
|
|
21061
20400
|
components.forEach((component) => {
|
|
@@ -21092,22 +20431,16 @@ function rule$B(primary) {
|
|
|
21092
20431
|
actual: primary,
|
|
21093
20432
|
possible: [`lower`, `upper`]
|
|
21094
20433
|
});
|
|
21095
|
-
if (!validOptions)
|
|
21096
|
-
return;
|
|
21097
|
-
}
|
|
20434
|
+
if (!validOptions) return;
|
|
21098
20435
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21099
20436
|
let hasComments = atRule2.raws.params?.raw;
|
|
21100
20437
|
let mediaRule = hasComments ? hasComments : atRule2.params;
|
|
21101
20438
|
let hasFixes = false;
|
|
21102
20439
|
mediaRule = findMediaFeatureNames(mediaRule, (mediaFeatureNameToken) => {
|
|
21103
20440
|
let [, , startIndex, endIndex, { value: featureName }] = mediaFeatureNameToken;
|
|
21104
|
-
if (isCustomMediaQuery(featureName))
|
|
21105
|
-
return;
|
|
21106
|
-
}
|
|
20441
|
+
if (isCustomMediaQuery(featureName)) return;
|
|
21107
20442
|
let expectedFeatureName = primary === `lower` ? featureName.toLowerCase() : featureName.toUpperCase();
|
|
21108
|
-
if (featureName === expectedFeatureName)
|
|
21109
|
-
return;
|
|
21110
|
-
}
|
|
20443
|
+
if (featureName === expectedFeatureName) return;
|
|
21111
20444
|
let atRuleIndex = atRuleParamIndex(atRule2);
|
|
21112
20445
|
report$r({
|
|
21113
20446
|
message: messages$B.expected,
|
|
@@ -21125,13 +20458,9 @@ function rule$B(primary) {
|
|
|
21125
20458
|
}).stringify();
|
|
21126
20459
|
if (hasFixes) {
|
|
21127
20460
|
if (hasComments) {
|
|
21128
|
-
if (atRule2.raws.params === null)
|
|
21129
|
-
throw new Error(`The \`AtRuleRaws\` node must have a \`params\` property`);
|
|
21130
|
-
}
|
|
20461
|
+
if (atRule2.raws.params === null) throw new Error(`The \`AtRuleRaws\` node must have a \`params\` property`);
|
|
21131
20462
|
atRule2.raws.params.raw = mediaRule;
|
|
21132
|
-
} else
|
|
21133
|
-
atRule2.params = mediaRule;
|
|
21134
|
-
}
|
|
20463
|
+
} else atRule2.params = mediaRule;
|
|
21135
20464
|
}
|
|
21136
20465
|
});
|
|
21137
20466
|
};
|
|
@@ -21165,9 +20494,7 @@ function rule$A(primary) {
|
|
|
21165
20494
|
actual: primary,
|
|
21166
20495
|
possible: [`always`, `never`]
|
|
21167
20496
|
});
|
|
21168
|
-
if (!validOptions)
|
|
21169
|
-
return;
|
|
21170
|
-
}
|
|
20497
|
+
if (!validOptions) return;
|
|
21171
20498
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21172
20499
|
let params = atRule2.raws.params && atRule2.raws.params.raw || atRule2.params;
|
|
21173
20500
|
let indexBoost = atRuleParamIndex(atRule2);
|
|
@@ -21228,9 +20555,7 @@ function rule$A(primary) {
|
|
|
21228
20555
|
fix: err.fix
|
|
21229
20556
|
});
|
|
21230
20557
|
}
|
|
21231
|
-
if (problems.some((problem) => problem.fix))
|
|
21232
|
-
atRule2.params = parsedParams.toString();
|
|
21233
|
-
}
|
|
20558
|
+
if (problems.some((problem) => problem.fix)) atRule2.params = parsedParams.toString();
|
|
21234
20559
|
}
|
|
21235
20560
|
});
|
|
21236
20561
|
};
|
|
@@ -21247,15 +20572,11 @@ const index$A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
21247
20572
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
21248
20573
|
let rangeOperators = [`>=`, `<=`, `>`, `<`, `=`];
|
|
21249
20574
|
function findMediaOperator(atRule2, cb) {
|
|
21250
|
-
if (atRule2.name.toLowerCase() !== `media`)
|
|
21251
|
-
return;
|
|
21252
|
-
}
|
|
20575
|
+
if (atRule2.name.toLowerCase() !== `media`) return;
|
|
21253
20576
|
let params = atRule2.raws.params ? atRule2.raws.params.raw : atRule2.params;
|
|
21254
20577
|
styleSearch({ source: params, target: rangeOperators }, (match) => {
|
|
21255
20578
|
let before = params[match.startIndex - 1];
|
|
21256
|
-
if (before === `>` || before === `<`)
|
|
21257
|
-
return;
|
|
21258
|
-
}
|
|
20579
|
+
if (before === `>` || before === `<`) return;
|
|
21259
20580
|
cb(match, params, atRule2);
|
|
21260
20581
|
});
|
|
21261
20582
|
}
|
|
@@ -21277,9 +20598,7 @@ function rule$z(primary) {
|
|
|
21277
20598
|
actual: primary,
|
|
21278
20599
|
possible: [`always`, `never`]
|
|
21279
20600
|
});
|
|
21280
|
-
if (!validOptions)
|
|
21281
|
-
return;
|
|
21282
|
-
}
|
|
20601
|
+
if (!validOptions) return;
|
|
21283
20602
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21284
20603
|
let fixOperatorIndices = [];
|
|
21285
20604
|
findMediaOperator(atRule2, (match, params, node2) => {
|
|
@@ -21308,17 +20627,11 @@ function rule$z(primary) {
|
|
|
21308
20627
|
for (let index2 of fixOperatorIndices.sort((a2, b2) => b2 - a2)) {
|
|
21309
20628
|
let beforeOperator = params.slice(0, index2 + 1);
|
|
21310
20629
|
let afterOperator = params.slice(index2 + 1);
|
|
21311
|
-
if (primary === `always`)
|
|
21312
|
-
|
|
21313
|
-
} else if (primary === `never`) {
|
|
21314
|
-
params = beforeOperator + afterOperator.replace(/^\s*/, ``);
|
|
21315
|
-
}
|
|
21316
|
-
}
|
|
21317
|
-
if (atRule2.raws.params) {
|
|
21318
|
-
atRule2.raws.params.raw = params;
|
|
21319
|
-
} else {
|
|
21320
|
-
atRule2.params = params;
|
|
20630
|
+
if (primary === `always`) params = beforeOperator + afterOperator.replace(/^\s*/, ` `);
|
|
20631
|
+
else if (primary === `never`) params = beforeOperator + afterOperator.replace(/^\s*/, ``);
|
|
21321
20632
|
}
|
|
20633
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20634
|
+
else atRule2.params = params;
|
|
21322
20635
|
}
|
|
21323
20636
|
});
|
|
21324
20637
|
};
|
|
@@ -21351,9 +20664,7 @@ function rule$y(primary) {
|
|
|
21351
20664
|
actual: primary,
|
|
21352
20665
|
possible: [`always`, `never`]
|
|
21353
20666
|
});
|
|
21354
|
-
if (!validOptions)
|
|
21355
|
-
return;
|
|
21356
|
-
}
|
|
20667
|
+
if (!validOptions) return;
|
|
21357
20668
|
root2.walkAtRules(/^media$/i, (atRule2) => {
|
|
21358
20669
|
let fixOperatorIndices = [];
|
|
21359
20670
|
findMediaOperator(atRule2, (match, params, node2) => {
|
|
@@ -21381,17 +20692,11 @@ function rule$y(primary) {
|
|
|
21381
20692
|
for (let index2 of fixOperatorIndices.sort((a2, b2) => b2 - a2)) {
|
|
21382
20693
|
let beforeOperator = params.slice(0, index2);
|
|
21383
20694
|
let afterOperator = params.slice(index2);
|
|
21384
|
-
if (primary === `always`)
|
|
21385
|
-
|
|
21386
|
-
} else if (primary === `never`) {
|
|
21387
|
-
params = beforeOperator.replace(/\s*$/, ``) + afterOperator;
|
|
21388
|
-
}
|
|
21389
|
-
}
|
|
21390
|
-
if (atRule2.raws.params) {
|
|
21391
|
-
atRule2.raws.params.raw = params;
|
|
21392
|
-
} else {
|
|
21393
|
-
atRule2.params = params;
|
|
20695
|
+
if (primary === `always`) params = beforeOperator.replace(/\s*$/, ` `) + afterOperator;
|
|
20696
|
+
else if (primary === `never`) params = beforeOperator.replace(/\s*$/, ``) + afterOperator;
|
|
21394
20697
|
}
|
|
20698
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20699
|
+
else atRule2.params = params;
|
|
21395
20700
|
}
|
|
21396
20701
|
});
|
|
21397
20702
|
};
|
|
@@ -21466,9 +20771,7 @@ function rule$x(primary, _secondaryOptions, context) {
|
|
|
21466
20771
|
actual: primary,
|
|
21467
20772
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
21468
20773
|
});
|
|
21469
|
-
if (!validOptions)
|
|
21470
|
-
return;
|
|
21471
|
-
}
|
|
20774
|
+
if (!validOptions) return;
|
|
21472
20775
|
let fixData;
|
|
21473
20776
|
mediaQueryListCommaWhitespaceChecker({
|
|
21474
20777
|
root: root2,
|
|
@@ -21491,17 +20794,11 @@ function rule$x(primary, _secondaryOptions, context) {
|
|
|
21491
20794
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
21492
20795
|
let beforeComma = params.slice(0, index2 + 1);
|
|
21493
20796
|
let afterComma = params.slice(index2 + 1);
|
|
21494
|
-
if (primary.startsWith(`always`))
|
|
21495
|
-
|
|
21496
|
-
} else if (primary.startsWith(`never`)) {
|
|
21497
|
-
params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21498
|
-
}
|
|
21499
|
-
}
|
|
21500
|
-
if (atRule2.raws.params) {
|
|
21501
|
-
atRule2.raws.params.raw = params;
|
|
21502
|
-
} else {
|
|
21503
|
-
atRule2.params = params;
|
|
20797
|
+
if (primary.startsWith(`always`)) params = /^\s*\n/.test(afterComma) ? beforeComma + afterComma.replace(/^[^\S\r\n]*/, ``) : beforeComma + context.newline + afterComma;
|
|
20798
|
+
else if (primary.startsWith(`never`)) params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21504
20799
|
}
|
|
20800
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20801
|
+
else atRule2.params = params;
|
|
21505
20802
|
}
|
|
21506
20803
|
}
|
|
21507
20804
|
};
|
|
@@ -21534,9 +20831,7 @@ function rule$w(primary) {
|
|
|
21534
20831
|
actual: primary,
|
|
21535
20832
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
21536
20833
|
});
|
|
21537
|
-
if (!validOptions)
|
|
21538
|
-
return;
|
|
21539
|
-
}
|
|
20834
|
+
if (!validOptions) return;
|
|
21540
20835
|
mediaQueryListCommaWhitespaceChecker({
|
|
21541
20836
|
root: root2,
|
|
21542
20837
|
result: result2,
|
|
@@ -21575,9 +20870,7 @@ function rule$v(primary) {
|
|
|
21575
20870
|
actual: primary,
|
|
21576
20871
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
21577
20872
|
});
|
|
21578
|
-
if (!validOptions)
|
|
21579
|
-
return;
|
|
21580
|
-
}
|
|
20873
|
+
if (!validOptions) return;
|
|
21581
20874
|
let fixData;
|
|
21582
20875
|
mediaQueryListCommaWhitespaceChecker({
|
|
21583
20876
|
root: root2,
|
|
@@ -21599,17 +20892,11 @@ function rule$v(primary) {
|
|
|
21599
20892
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
21600
20893
|
let beforeComma = params.slice(0, index2 + 1);
|
|
21601
20894
|
let afterComma = params.slice(index2 + 1);
|
|
21602
|
-
if (primary.startsWith(`always`))
|
|
21603
|
-
|
|
21604
|
-
} else if (primary.startsWith(`never`)) {
|
|
21605
|
-
params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21606
|
-
}
|
|
21607
|
-
}
|
|
21608
|
-
if (atRule2.raws.params) {
|
|
21609
|
-
atRule2.raws.params.raw = params;
|
|
21610
|
-
} else {
|
|
21611
|
-
atRule2.params = params;
|
|
20895
|
+
if (primary.startsWith(`always`)) params = beforeComma + afterComma.replace(/^\s*/, ` `);
|
|
20896
|
+
else if (primary.startsWith(`never`)) params = beforeComma + afterComma.replace(/^\s*/, ``);
|
|
21612
20897
|
}
|
|
20898
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20899
|
+
else atRule2.params = params;
|
|
21613
20900
|
}
|
|
21614
20901
|
}
|
|
21615
20902
|
};
|
|
@@ -21644,9 +20931,7 @@ function rule$u(primary) {
|
|
|
21644
20931
|
actual: primary,
|
|
21645
20932
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
21646
20933
|
});
|
|
21647
|
-
if (!validOptions)
|
|
21648
|
-
return;
|
|
21649
|
-
}
|
|
20934
|
+
if (!validOptions) return;
|
|
21650
20935
|
let fixData;
|
|
21651
20936
|
mediaQueryListCommaWhitespaceChecker({
|
|
21652
20937
|
root: root2,
|
|
@@ -21668,17 +20953,11 @@ function rule$u(primary) {
|
|
|
21668
20953
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
21669
20954
|
let beforeComma = params.slice(0, index2);
|
|
21670
20955
|
let afterComma = params.slice(index2);
|
|
21671
|
-
if (primary.startsWith(`always`))
|
|
21672
|
-
|
|
21673
|
-
} else if (primary.startsWith(`never`)) {
|
|
21674
|
-
params = beforeComma.replace(/\s*$/, ``) + afterComma;
|
|
21675
|
-
}
|
|
21676
|
-
}
|
|
21677
|
-
if (atRule2.raws.params) {
|
|
21678
|
-
atRule2.raws.params.raw = params;
|
|
21679
|
-
} else {
|
|
21680
|
-
atRule2.params = params;
|
|
20956
|
+
if (primary.startsWith(`always`)) params = beforeComma.replace(/\s*$/, ` `) + afterComma;
|
|
20957
|
+
else if (primary.startsWith(`never`)) params = beforeComma.replace(/\s*$/, ``) + afterComma;
|
|
21681
20958
|
}
|
|
20959
|
+
if (atRule2.raws.params) atRule2.raws.params.raw = params;
|
|
20960
|
+
else atRule2.params = params;
|
|
21682
20961
|
}
|
|
21683
20962
|
}
|
|
21684
20963
|
};
|
|
@@ -21718,9 +20997,7 @@ function rule$t(primary, secondaryOptions = {}) {
|
|
|
21718
20997
|
optional: true
|
|
21719
20998
|
}
|
|
21720
20999
|
);
|
|
21721
|
-
if (!validOptions)
|
|
21722
|
-
return;
|
|
21723
|
-
}
|
|
21000
|
+
if (!validOptions) return;
|
|
21724
21001
|
let gap = secondaryOptions.gap ?? 1;
|
|
21725
21002
|
let alignQuotes = secondaryOptions.alignQuotes ?? false;
|
|
21726
21003
|
let referenceGap = ` `.repeat(gap);
|
|
@@ -21752,17 +21029,13 @@ function rule$t(primary, secondaryOptions = {}) {
|
|
|
21752
21029
|
});
|
|
21753
21030
|
if (alignQuotes && isMultilineDeclaration) {
|
|
21754
21031
|
formatted = formatted.map((row) => {
|
|
21755
|
-
if (row.length === maxRowLength)
|
|
21756
|
-
return row;
|
|
21757
|
-
}
|
|
21032
|
+
if (row.length === maxRowLength) return row;
|
|
21758
21033
|
let cleanRowValue = row.trimEnd();
|
|
21759
21034
|
return `${cleanRowValue}${` `.repeat(maxRowLength - cleanRowValue.length)}`;
|
|
21760
21035
|
});
|
|
21761
21036
|
}
|
|
21762
21037
|
let isValid = originalRows.every((row, index2) => row === formatted[index2]);
|
|
21763
|
-
if (isValid)
|
|
21764
|
-
return;
|
|
21765
|
-
}
|
|
21038
|
+
if (isValid) return;
|
|
21766
21039
|
let extraStartLines = declaration2.raws.between.match(/[\r\n?|\n]*/g)?.reduce((acc, newLineBlock) => acc + newLineBlock.length, 0);
|
|
21767
21040
|
let extraStartColumns = extraStartLines === 0 ? declarationValueIndex(declaration2) + declaration2.source.start.column : declaration2.raws.between.match(/[^\r\n?|\n]+$/)?.[0].length + 1 || 0;
|
|
21768
21041
|
report$m({
|
|
@@ -21821,13 +21094,9 @@ let meta$s = {
|
|
|
21821
21094
|
function rule$s(primary) {
|
|
21822
21095
|
return (root2, result2) => {
|
|
21823
21096
|
let validOptions = validateOptions$s(result2, ruleName$s, { actual: primary });
|
|
21824
|
-
if (!validOptions || root2.source.inline || root2.source.lang === `object-literal`)
|
|
21825
|
-
return;
|
|
21826
|
-
}
|
|
21097
|
+
if (!validOptions || root2.source.inline || root2.source.lang === `object-literal`) return;
|
|
21827
21098
|
let rootString = root2.source && root2.source.input.css || ``;
|
|
21828
|
-
if (!rootString.trim())
|
|
21829
|
-
return;
|
|
21830
|
-
}
|
|
21099
|
+
if (!rootString.trim()) return;
|
|
21831
21100
|
if (noEmptyFirstLineTest.test(rootString)) {
|
|
21832
21101
|
report$l({
|
|
21833
21102
|
message: messages$s.rejected,
|
|
@@ -21835,12 +21104,8 @@ function rule$s(primary) {
|
|
|
21835
21104
|
result: result2,
|
|
21836
21105
|
ruleName: ruleName$s,
|
|
21837
21106
|
fix() {
|
|
21838
|
-
if (root2.first === null)
|
|
21839
|
-
|
|
21840
|
-
}
|
|
21841
|
-
if (root2.first.raws.before === null) {
|
|
21842
|
-
throw new Error(`The first node must have spaces before.`);
|
|
21843
|
-
}
|
|
21107
|
+
if (root2.first === null) throw new Error(`The root node must have the first node.`);
|
|
21108
|
+
if (root2.first.raws.before === null) throw new Error(`The first node must have spaces before.`);
|
|
21844
21109
|
root2.first.raws.before = root2.first.raws.before.replace(noEmptyFirstLineTest, ``);
|
|
21845
21110
|
}
|
|
21846
21111
|
});
|
|
@@ -21858,20 +21123,12 @@ const index$s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
21858
21123
|
ruleName: ruleName$s
|
|
21859
21124
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
21860
21125
|
function isOnlyWhitespace(input2) {
|
|
21861
|
-
for (let element of input2)
|
|
21862
|
-
if (!isWhitespace$1(element)) {
|
|
21863
|
-
return false;
|
|
21864
|
-
}
|
|
21865
|
-
}
|
|
21126
|
+
for (let element of input2) if (!isWhitespace$1(element)) return false;
|
|
21866
21127
|
return true;
|
|
21867
21128
|
}
|
|
21868
21129
|
function isStandardSyntaxComment(comment2) {
|
|
21869
|
-
if (`inline` in comment2)
|
|
21870
|
-
|
|
21871
|
-
}
|
|
21872
|
-
if (`inline` in comment2.raws) {
|
|
21873
|
-
return false;
|
|
21874
|
-
}
|
|
21130
|
+
if (`inline` in comment2) return false;
|
|
21131
|
+
if (`inline` in comment2.raws) return false;
|
|
21875
21132
|
return true;
|
|
21876
21133
|
}
|
|
21877
21134
|
let { utils: { report: report$k, ruleMessages: ruleMessages$r, validateOptions: validateOptions$r } } = stylelint;
|
|
@@ -21890,17 +21147,13 @@ function fixString(str) {
|
|
|
21890
21147
|
}
|
|
21891
21148
|
function findErrorStartIndex(lastEOLIndex, string2, { ignoreEmptyLines, isRootFirst }) {
|
|
21892
21149
|
let eolWhitespaceIndex = lastEOLIndex - 1;
|
|
21893
|
-
if (!whitespacesToReject.has(string2.charAt(eolWhitespaceIndex)))
|
|
21894
|
-
return -1;
|
|
21895
|
-
}
|
|
21150
|
+
if (!whitespacesToReject.has(string2.charAt(eolWhitespaceIndex))) return -1;
|
|
21896
21151
|
if (ignoreEmptyLines) {
|
|
21897
21152
|
let beforeNewlineIndex = string2.lastIndexOf(`
|
|
21898
21153
|
`, eolWhitespaceIndex);
|
|
21899
21154
|
if (beforeNewlineIndex >= 0 || isRootFirst) {
|
|
21900
21155
|
let line = string2.substring(beforeNewlineIndex, eolWhitespaceIndex);
|
|
21901
|
-
if (isOnlyWhitespace(line))
|
|
21902
|
-
return -1;
|
|
21903
|
-
}
|
|
21156
|
+
if (isOnlyWhitespace(line)) return -1;
|
|
21904
21157
|
}
|
|
21905
21158
|
}
|
|
21906
21159
|
return eolWhitespaceIndex;
|
|
@@ -21921,9 +21174,7 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21921
21174
|
}
|
|
21922
21175
|
}
|
|
21923
21176
|
);
|
|
21924
|
-
if (!validOptions)
|
|
21925
|
-
return;
|
|
21926
|
-
}
|
|
21177
|
+
if (!validOptions) return;
|
|
21927
21178
|
let ignoreEmptyLines = optionsMatches(secondaryOptions, `ignore`, `empty-lines`);
|
|
21928
21179
|
let rootString = root2.source && root2.source.input.css || ``;
|
|
21929
21180
|
function reportFromIndex(index2) {
|
|
@@ -21942,9 +21193,7 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21942
21193
|
ignoreEmptyLines,
|
|
21943
21194
|
isRootFirst: true
|
|
21944
21195
|
});
|
|
21945
|
-
if (errorIndex > -1)
|
|
21946
|
-
reportFromIndex(errorIndex);
|
|
21947
|
-
}
|
|
21196
|
+
if (errorIndex > -1) reportFromIndex(errorIndex);
|
|
21948
21197
|
function eachEolWhitespace(string2, callback, isRootFirst) {
|
|
21949
21198
|
styleSearch(
|
|
21950
21199
|
{
|
|
@@ -21958,9 +21207,7 @@ function rule$r(primary, secondaryOptions) {
|
|
|
21958
21207
|
ignoreEmptyLines,
|
|
21959
21208
|
isRootFirst
|
|
21960
21209
|
});
|
|
21961
|
-
if (index2 > -1)
|
|
21962
|
-
callback(index2);
|
|
21963
|
-
}
|
|
21210
|
+
if (index2 > -1) callback(index2);
|
|
21964
21211
|
}
|
|
21965
21212
|
);
|
|
21966
21213
|
}
|
|
@@ -22023,9 +21270,8 @@ function rule$r(primary, secondaryOptions) {
|
|
|
22023
21270
|
fixText(node2.raws.left, (fixed) => {
|
|
22024
21271
|
node2.raws.left = fixed;
|
|
22025
21272
|
});
|
|
22026
|
-
if (!isStandardSyntaxComment(node2))
|
|
22027
|
-
|
|
22028
|
-
} else {
|
|
21273
|
+
if (!isStandardSyntaxComment(node2)) node2.raws.right = node2.raws.right && fixString(node2.raws.right);
|
|
21274
|
+
else {
|
|
22029
21275
|
fixText(node2.raws.right, (fixed) => {
|
|
22030
21276
|
node2.raws.right = fixed;
|
|
22031
21277
|
});
|
|
@@ -22053,15 +21299,11 @@ function rule$r(primary, secondaryOptions) {
|
|
|
22053
21299
|
`),
|
|
22054
21300
|
root2.raws.after.lastIndexOf(`\r`)
|
|
22055
21301
|
);
|
|
22056
|
-
if (lastEOL !== root2.raws.after.length - 1)
|
|
22057
|
-
root2.raws.after = root2.raws.after.slice(0, lastEOL + 1) + fixString(root2.raws.after.slice(lastEOL + 1));
|
|
22058
|
-
}
|
|
21302
|
+
if (lastEOL !== root2.raws.after.length - 1) root2.raws.after = root2.raws.after.slice(0, lastEOL + 1) + fixString(root2.raws.after.slice(lastEOL + 1));
|
|
22059
21303
|
}
|
|
22060
21304
|
}
|
|
22061
21305
|
function fixText(value, fixFn, isRootFirst = false) {
|
|
22062
|
-
if (!value)
|
|
22063
|
-
return;
|
|
22064
|
-
}
|
|
21306
|
+
if (!value) return;
|
|
22065
21307
|
let fixed = ``;
|
|
22066
21308
|
let lastIndex = 0;
|
|
22067
21309
|
eachEolWhitespace(
|
|
@@ -22107,51 +21349,25 @@ function hasTplInterpolation(string2) {
|
|
|
22107
21349
|
return HAS_TPL_INTERPOLATION.test(string2);
|
|
22108
21350
|
}
|
|
22109
21351
|
function hasInterpolation(string2) {
|
|
22110
|
-
if (hasLessInterpolation(string2) || hasScssInterpolation(string2) || hasTplInterpolation(string2) || hasPsvInterpolation(string2))
|
|
22111
|
-
return true;
|
|
22112
|
-
}
|
|
21352
|
+
if (hasLessInterpolation(string2) || hasScssInterpolation(string2) || hasTplInterpolation(string2) || hasPsvInterpolation(string2)) return true;
|
|
22113
21353
|
return false;
|
|
22114
21354
|
}
|
|
22115
21355
|
function isStandardSyntaxSelector(selector2) {
|
|
22116
|
-
if (hasInterpolation(selector2))
|
|
22117
|
-
|
|
22118
|
-
|
|
22119
|
-
if (
|
|
22120
|
-
|
|
22121
|
-
|
|
22122
|
-
if (
|
|
22123
|
-
|
|
22124
|
-
|
|
22125
|
-
if (/:extend(?:\(.*?\))?/.test(selector2)) {
|
|
22126
|
-
return false;
|
|
22127
|
-
}
|
|
22128
|
-
if (/\.[\w-]+\(.*\).+/.test(selector2)) {
|
|
22129
|
-
return false;
|
|
22130
|
-
}
|
|
22131
|
-
if (selector2.endsWith(`)`) && !selector2.includes(`:`)) {
|
|
22132
|
-
return false;
|
|
22133
|
-
}
|
|
22134
|
-
if (/\(@.*\)$/.test(selector2)) {
|
|
22135
|
-
return false;
|
|
22136
|
-
}
|
|
22137
|
-
if (selector2.includes(`<%`) || selector2.includes(`%>`)) {
|
|
22138
|
-
return false;
|
|
22139
|
-
}
|
|
22140
|
-
if (selector2.includes(`//`)) {
|
|
22141
|
-
return false;
|
|
22142
|
-
}
|
|
21356
|
+
if (hasInterpolation(selector2)) return false;
|
|
21357
|
+
if (selector2.startsWith(`%`)) return false;
|
|
21358
|
+
if (selector2.endsWith(`:`)) return false;
|
|
21359
|
+
if (/:extend(?:\(.*?\))?/.test(selector2)) return false;
|
|
21360
|
+
if (/\.[\w-]+\(.*\).+/.test(selector2)) return false;
|
|
21361
|
+
if (selector2.endsWith(`)`) && !selector2.includes(`:`)) return false;
|
|
21362
|
+
if (/\(@.*\)$/.test(selector2)) return false;
|
|
21363
|
+
if (selector2.includes(`<%`) || selector2.includes(`%>`)) return false;
|
|
21364
|
+
if (selector2.includes(`//`)) return false;
|
|
22143
21365
|
return true;
|
|
22144
21366
|
}
|
|
22145
21367
|
function isStandardSyntaxRule(rule2) {
|
|
22146
|
-
if (rule2.type !== `rule`)
|
|
22147
|
-
|
|
22148
|
-
|
|
22149
|
-
if (`extend` in rule2 && rule2.extend) {
|
|
22150
|
-
return false;
|
|
22151
|
-
}
|
|
22152
|
-
if (!isStandardSyntaxSelector(rule2.selector)) {
|
|
22153
|
-
return false;
|
|
22154
|
-
}
|
|
21368
|
+
if (rule2.type !== `rule`) return false;
|
|
21369
|
+
if (`extend` in rule2 && rule2.extend) return false;
|
|
21370
|
+
if (!isStandardSyntaxSelector(rule2.selector)) return false;
|
|
22155
21371
|
return true;
|
|
22156
21372
|
}
|
|
22157
21373
|
let { utils: { report: report$j, ruleMessages: ruleMessages$q, validateOptions: validateOptions$q } } = stylelint;
|
|
@@ -22165,19 +21381,11 @@ let meta$q = {
|
|
|
22165
21381
|
fixable: true
|
|
22166
21382
|
};
|
|
22167
21383
|
function getOffsetByNode(node2) {
|
|
22168
|
-
if (node2.parent && node2.parent.document)
|
|
22169
|
-
return 0;
|
|
22170
|
-
}
|
|
21384
|
+
if (node2.parent && node2.parent.document) return 0;
|
|
22171
21385
|
let root2 = node2.root();
|
|
22172
|
-
if (!root2.source)
|
|
22173
|
-
|
|
22174
|
-
|
|
22175
|
-
if (!node2.source) {
|
|
22176
|
-
throw new Error(`The node must have a source`);
|
|
22177
|
-
}
|
|
22178
|
-
if (!node2.source.start) {
|
|
22179
|
-
throw new Error(`The source must have a start position`);
|
|
22180
|
-
}
|
|
21386
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
21387
|
+
if (!node2.source) throw new Error(`The node must have a source`);
|
|
21388
|
+
if (!node2.source.start) throw new Error(`The source must have a start position`);
|
|
22181
21389
|
let string2 = root2.source.input.css;
|
|
22182
21390
|
let nodeColumn = node2.source.start.column;
|
|
22183
21391
|
let nodeLine = node2.source.start.line;
|
|
@@ -22193,18 +21401,14 @@ function getOffsetByNode(node2) {
|
|
|
22193
21401
|
`) {
|
|
22194
21402
|
column = 1;
|
|
22195
21403
|
line += 1;
|
|
22196
|
-
} else
|
|
22197
|
-
column += 1;
|
|
22198
|
-
}
|
|
21404
|
+
} else column += 1;
|
|
22199
21405
|
}
|
|
22200
21406
|
return index2;
|
|
22201
21407
|
}
|
|
22202
21408
|
function rule$q(primary) {
|
|
22203
21409
|
return (root2, result2) => {
|
|
22204
21410
|
let validOptions = validateOptions$q(result2, ruleName$q, { actual: primary });
|
|
22205
|
-
if (!validOptions)
|
|
22206
|
-
return;
|
|
22207
|
-
}
|
|
21411
|
+
if (!validOptions) return;
|
|
22208
21412
|
let fix = null;
|
|
22209
21413
|
if (root2.raws.after && root2.raws.after.trim().length !== 0) {
|
|
22210
21414
|
let rawAfterRoot = root2.raws.after;
|
|
@@ -22213,45 +21417,31 @@ function rule$q(primary) {
|
|
|
22213
21417
|
fix = () => {
|
|
22214
21418
|
fixSemiIndices.push(match.startIndex);
|
|
22215
21419
|
};
|
|
22216
|
-
if (!root2.source)
|
|
22217
|
-
throw new Error(`The root node must have a source`);
|
|
22218
|
-
}
|
|
21420
|
+
if (!root2.source) throw new Error(`The root node must have a source`);
|
|
22219
21421
|
complain(root2.source.input.css.length - rawAfterRoot.length + match.startIndex);
|
|
22220
21422
|
});
|
|
22221
|
-
if (fixSemiIndices.length)
|
|
22222
|
-
root2.raws.after = removeIndices(rawAfterRoot, fixSemiIndices);
|
|
22223
|
-
}
|
|
21423
|
+
if (fixSemiIndices.length) root2.raws.after = removeIndices(rawAfterRoot, fixSemiIndices);
|
|
22224
21424
|
}
|
|
22225
21425
|
root2.walk((node2) => {
|
|
22226
|
-
if (isAtRule(node2) && !isStandardSyntaxAtRule(node2))
|
|
22227
|
-
|
|
22228
|
-
}
|
|
22229
|
-
if (node2.type === `rule` && !isStandardSyntaxRule(node2)) {
|
|
22230
|
-
return;
|
|
22231
|
-
}
|
|
21426
|
+
if (isAtRule(node2) && !isStandardSyntaxAtRule(node2)) return;
|
|
21427
|
+
if (node2.type === `rule` && !isStandardSyntaxRule(node2)) return;
|
|
22232
21428
|
if (node2.raws.before && node2.raws.before.trim().length !== 0) {
|
|
22233
21429
|
let rawBeforeNode = node2.raws.before;
|
|
22234
21430
|
let allowedSemi = 0;
|
|
22235
21431
|
let rawBeforeIndexStart = 0;
|
|
22236
21432
|
let fixSemiIndices = [];
|
|
22237
21433
|
styleSearch({ source: rawBeforeNode, target: `;` }, (match, count) => {
|
|
22238
|
-
if (count === allowedSemi)
|
|
22239
|
-
return;
|
|
22240
|
-
}
|
|
21434
|
+
if (count === allowedSemi) return;
|
|
22241
21435
|
fix = () => {
|
|
22242
21436
|
fixSemiIndices.push(match.startIndex - rawBeforeIndexStart);
|
|
22243
21437
|
};
|
|
22244
21438
|
complain(getOffsetByNode(node2) - rawBeforeNode.length + match.startIndex);
|
|
22245
21439
|
});
|
|
22246
|
-
if (fixSemiIndices.length)
|
|
22247
|
-
node2.raws.before = removeIndices(rawBeforeNode, fixSemiIndices);
|
|
22248
|
-
}
|
|
21440
|
+
if (fixSemiIndices.length) node2.raws.before = removeIndices(rawBeforeNode, fixSemiIndices);
|
|
22249
21441
|
}
|
|
22250
21442
|
if (typeof node2.raws.after === `string` && node2.raws.after.trim().length !== 0) {
|
|
22251
21443
|
let rawAfterNode = node2.raws.after;
|
|
22252
|
-
if (`last` in node2 && node2.last && node2.last.type === `atrule` && !isStandardSyntaxAtRule(node2.last))
|
|
22253
|
-
return;
|
|
22254
|
-
}
|
|
21444
|
+
if (`last` in node2 && node2.last && node2.last.type === `atrule` && !isStandardSyntaxAtRule(node2.last)) return;
|
|
22255
21445
|
let fixSemiIndices = [];
|
|
22256
21446
|
styleSearch({ source: rawAfterNode, target: `;` }, (match) => {
|
|
22257
21447
|
fix = () => {
|
|
@@ -22260,27 +21450,21 @@ function rule$q(primary) {
|
|
|
22260
21450
|
let index2 = getOffsetByNode(node2) + node2.toString().length - 1 - rawAfterNode.length + match.startIndex;
|
|
22261
21451
|
complain(index2);
|
|
22262
21452
|
});
|
|
22263
|
-
if (fixSemiIndices.length)
|
|
22264
|
-
node2.raws.after = removeIndices(rawAfterNode, fixSemiIndices);
|
|
22265
|
-
}
|
|
21453
|
+
if (fixSemiIndices.length) node2.raws.after = removeIndices(rawAfterNode, fixSemiIndices);
|
|
22266
21454
|
}
|
|
22267
21455
|
if (typeof node2.raws.ownSemicolon === `string`) {
|
|
22268
21456
|
let rawOwnSemicolon = node2.raws.ownSemicolon;
|
|
22269
21457
|
let allowedSemi = 0;
|
|
22270
21458
|
let fixSemiIndices = [];
|
|
22271
21459
|
styleSearch({ source: rawOwnSemicolon, target: `;` }, (match, count) => {
|
|
22272
|
-
if (count === allowedSemi)
|
|
22273
|
-
return;
|
|
22274
|
-
}
|
|
21460
|
+
if (count === allowedSemi) return;
|
|
22275
21461
|
fix = () => {
|
|
22276
21462
|
fixSemiIndices.push(match.startIndex);
|
|
22277
21463
|
};
|
|
22278
21464
|
let index2 = getOffsetByNode(node2) + node2.toString().length - rawOwnSemicolon.length + match.startIndex;
|
|
22279
21465
|
complain(index2);
|
|
22280
21466
|
});
|
|
22281
|
-
if (fixSemiIndices.length)
|
|
22282
|
-
node2.raws.ownSemicolon = removeIndices(rawOwnSemicolon, fixSemiIndices);
|
|
22283
|
-
}
|
|
21467
|
+
if (fixSemiIndices.length) node2.raws.ownSemicolon = removeIndices(rawOwnSemicolon, fixSemiIndices);
|
|
22284
21468
|
}
|
|
22285
21469
|
});
|
|
22286
21470
|
function complain(index2) {
|
|
@@ -22295,9 +21479,7 @@ function rule$q(primary) {
|
|
|
22295
21479
|
});
|
|
22296
21480
|
}
|
|
22297
21481
|
function removeIndices(str, indices) {
|
|
22298
|
-
for (let index2 of indices.reverse())
|
|
22299
|
-
str = str.slice(0, index2) + str.slice(index2 + 1);
|
|
22300
|
-
}
|
|
21482
|
+
for (let index2 of indices.reverse()) str = str.slice(0, index2) + str.slice(index2 + 1);
|
|
22301
21483
|
return str;
|
|
22302
21484
|
}
|
|
22303
21485
|
};
|
|
@@ -22325,20 +21507,12 @@ let meta$p = {
|
|
|
22325
21507
|
function rule$p(primary, _secondaryOptions, context) {
|
|
22326
21508
|
return (root2, result2) => {
|
|
22327
21509
|
let validOptions = validateOptions$p(result2, ruleName$p, { actual: primary });
|
|
22328
|
-
if (!validOptions)
|
|
22329
|
-
|
|
22330
|
-
|
|
22331
|
-
if (root2.source === null) {
|
|
22332
|
-
throw new Error(`The root node must have a source property`);
|
|
22333
|
-
}
|
|
22334
|
-
if (root2.source.inline || root2.source.lang === `object-literal`) {
|
|
22335
|
-
return;
|
|
22336
|
-
}
|
|
21510
|
+
if (!validOptions) return;
|
|
21511
|
+
if (root2.source === null) throw new Error(`The root node must have a source property`);
|
|
21512
|
+
if (root2.source.inline || root2.source.lang === `object-literal`) return;
|
|
22337
21513
|
let rootString = root2.source.input.css;
|
|
22338
21514
|
if (!rootString.trim() || rootString.endsWith(`
|
|
22339
|
-
`))
|
|
22340
|
-
return;
|
|
22341
|
-
}
|
|
21515
|
+
`)) return;
|
|
22342
21516
|
const problemIndex = rootString.length - 1;
|
|
22343
21517
|
report$i({
|
|
22344
21518
|
message: messages$p.rejected,
|
|
@@ -22380,35 +21554,23 @@ function rule$o(primary) {
|
|
|
22380
21554
|
actual: primary,
|
|
22381
21555
|
possible: [`always`, `never`]
|
|
22382
21556
|
});
|
|
22383
|
-
if (!validOptions)
|
|
22384
|
-
return;
|
|
22385
|
-
}
|
|
21557
|
+
if (!validOptions) return;
|
|
22386
21558
|
let fix = null;
|
|
22387
21559
|
root2.walkAtRules((atRule2) => {
|
|
22388
|
-
if (atRule2.name.toLowerCase() === `import`)
|
|
22389
|
-
return;
|
|
22390
|
-
}
|
|
21560
|
+
if (atRule2.name.toLowerCase() === `import`) return;
|
|
22391
21561
|
check(atRule2, atRule2.params);
|
|
22392
21562
|
});
|
|
22393
21563
|
root2.walkDecls((decl) => check(decl, decl.value));
|
|
22394
21564
|
function check(node2, value) {
|
|
22395
21565
|
let neverFixPositions = [];
|
|
22396
21566
|
let alwaysFixPositions = [];
|
|
22397
|
-
if (!value.includes(`.`))
|
|
22398
|
-
return;
|
|
22399
|
-
}
|
|
21567
|
+
if (!value.includes(`.`)) return;
|
|
22400
21568
|
valueParser(value).walk((valueNode) => {
|
|
22401
|
-
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`)
|
|
22402
|
-
|
|
22403
|
-
}
|
|
22404
|
-
if (valueNode.type !== `word`) {
|
|
22405
|
-
return;
|
|
22406
|
-
}
|
|
21569
|
+
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`) return false;
|
|
21570
|
+
if (valueNode.type !== `word`) return;
|
|
22407
21571
|
if (primary === `always`) {
|
|
22408
21572
|
let match = /(?:\D|^)(\.\d+)/.exec(valueNode.value);
|
|
22409
|
-
if (match === null || match[0] === null || match[1] === null)
|
|
22410
|
-
return;
|
|
22411
|
-
}
|
|
21573
|
+
if (match === null || match[0] === null || match[1] === null) return;
|
|
22412
21574
|
let capturingGroupIndex = match[0].length - match[1].length;
|
|
22413
21575
|
let index2 = valueNode.sourceIndex + match.index + capturingGroupIndex;
|
|
22414
21576
|
fix = () => {
|
|
@@ -22421,9 +21583,7 @@ function rule$o(primary) {
|
|
|
22421
21583
|
}
|
|
22422
21584
|
if (primary === `never`) {
|
|
22423
21585
|
let match = /(?:\D|^)(0+)(\.\d+)/.exec(valueNode.value);
|
|
22424
|
-
if (match === null || match[0] === null || match[1] === null || match[2] === null)
|
|
22425
|
-
return;
|
|
22426
|
-
}
|
|
21586
|
+
if (match === null || match[0] === null || match[1] === null || match[2] === null) return;
|
|
22427
21587
|
let capturingGroupIndex = match[0].length - (match[1].length + match[2].length);
|
|
22428
21588
|
let index2 = valueNode.sourceIndex + match.index + capturingGroupIndex;
|
|
22429
21589
|
fix = () => {
|
|
@@ -22440,22 +21600,16 @@ function rule$o(primary) {
|
|
|
22440
21600
|
if (alwaysFixPositions.length) {
|
|
22441
21601
|
for (let fixPosition of alwaysFixPositions) {
|
|
22442
21602
|
let index2 = fixPosition.index;
|
|
22443
|
-
if (isAtRule(node2))
|
|
22444
|
-
|
|
22445
|
-
} else {
|
|
22446
|
-
node2.value = addLeadingZero(node2.value, index2);
|
|
22447
|
-
}
|
|
21603
|
+
if (isAtRule(node2)) node2.params = addLeadingZero(node2.params, index2);
|
|
21604
|
+
else node2.value = addLeadingZero(node2.value, index2);
|
|
22448
21605
|
}
|
|
22449
21606
|
}
|
|
22450
21607
|
if (neverFixPositions.length) {
|
|
22451
21608
|
for (let fixPosition of neverFixPositions) {
|
|
22452
21609
|
let startIndex = fixPosition.startIndex;
|
|
22453
21610
|
let endIndex = fixPosition.endIndex;
|
|
22454
|
-
if (isAtRule(node2))
|
|
22455
|
-
|
|
22456
|
-
} else {
|
|
22457
|
-
node2.value = removeLeadingZeros(node2.value, startIndex, endIndex);
|
|
22458
|
-
}
|
|
21611
|
+
if (isAtRule(node2)) node2.params = removeLeadingZeros(node2.params, startIndex, endIndex);
|
|
21612
|
+
else node2.value = removeLeadingZeros(node2.value, startIndex, endIndex);
|
|
22459
21613
|
}
|
|
22460
21614
|
}
|
|
22461
21615
|
}
|
|
@@ -22501,32 +21655,20 @@ let meta$n = {
|
|
|
22501
21655
|
function rule$n(primary) {
|
|
22502
21656
|
return (root2, result2) => {
|
|
22503
21657
|
let validOptions = validateOptions$n(result2, ruleName$n, { actual: primary });
|
|
22504
|
-
if (!validOptions)
|
|
22505
|
-
return;
|
|
22506
|
-
}
|
|
21658
|
+
if (!validOptions) return;
|
|
22507
21659
|
root2.walkAtRules((atRule2) => {
|
|
22508
|
-
if (atRule2.name.toLowerCase() === `import`)
|
|
22509
|
-
return;
|
|
22510
|
-
}
|
|
21660
|
+
if (atRule2.name.toLowerCase() === `import`) return;
|
|
22511
21661
|
check(atRule2, atRule2.params);
|
|
22512
21662
|
});
|
|
22513
21663
|
root2.walkDecls((decl) => check(decl, decl.value));
|
|
22514
21664
|
function check(node2, value) {
|
|
22515
21665
|
let fixPositions = [];
|
|
22516
|
-
if (!value.includes(`.`))
|
|
22517
|
-
return;
|
|
22518
|
-
}
|
|
21666
|
+
if (!value.includes(`.`)) return;
|
|
22519
21667
|
valueParser(value).walk((valueNode) => {
|
|
22520
|
-
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`)
|
|
22521
|
-
|
|
22522
|
-
}
|
|
22523
|
-
if (valueNode.type !== `word`) {
|
|
22524
|
-
return;
|
|
22525
|
-
}
|
|
21668
|
+
if (valueNode.type === `function` && valueNode.value.toLowerCase() === `url`) return false;
|
|
21669
|
+
if (valueNode.type !== `word`) return;
|
|
22526
21670
|
let match = /\.(\d{0,100}?)(0+)(?:\D|$)/.exec(valueNode.value);
|
|
22527
|
-
if (match === null || match[1] === null || match[2] === null)
|
|
22528
|
-
return;
|
|
22529
|
-
}
|
|
21671
|
+
if (match === null || match[1] === null || match[2] === null) return;
|
|
22530
21672
|
let index2 = valueNode.sourceIndex + match.index + 1 + match[1].length;
|
|
22531
21673
|
let startIndex = match[1].length > 0 ? index2 : index2 - 1;
|
|
22532
21674
|
let endIndex = index2 + match[2].length;
|
|
@@ -22551,11 +21693,8 @@ function rule$n(primary) {
|
|
|
22551
21693
|
for (let fixPosition of fixPositions) {
|
|
22552
21694
|
let startIndex = fixPosition.startIndex;
|
|
22553
21695
|
let endIndex = fixPosition.endIndex;
|
|
22554
|
-
if (isAtRule(node2))
|
|
22555
|
-
|
|
22556
|
-
} else {
|
|
22557
|
-
node2.value = removeTrailingZeros(node2.value, startIndex, endIndex);
|
|
22558
|
-
}
|
|
21696
|
+
if (isAtRule(node2)) node2.params = removeTrailingZeros(node2.params, startIndex, endIndex);
|
|
21697
|
+
else node2.value = removeTrailingZeros(node2.value, startIndex, endIndex);
|
|
22559
21698
|
}
|
|
22560
21699
|
}
|
|
22561
21700
|
}
|
|
@@ -22575,18 +21714,10 @@ const index$n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
22575
21714
|
ruleName: ruleName$n
|
|
22576
21715
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
22577
21716
|
function isStandardSyntaxProperty(property) {
|
|
22578
|
-
if (isScssVariable(property))
|
|
22579
|
-
|
|
22580
|
-
|
|
22581
|
-
if (property
|
|
22582
|
-
return false;
|
|
22583
|
-
}
|
|
22584
|
-
if (property.endsWith(`+`) || property.endsWith(`+_`)) {
|
|
22585
|
-
return false;
|
|
22586
|
-
}
|
|
22587
|
-
if (hasInterpolation(property)) {
|
|
22588
|
-
return false;
|
|
22589
|
-
}
|
|
21717
|
+
if (isScssVariable(property)) return false;
|
|
21718
|
+
if (property.startsWith(`@`)) return false;
|
|
21719
|
+
if (property.endsWith(`+`) || property.endsWith(`+_`)) return false;
|
|
21720
|
+
if (hasInterpolation(property)) return false;
|
|
22590
21721
|
return true;
|
|
22591
21722
|
}
|
|
22592
21723
|
let { utils: { report: report$f, ruleMessages: ruleMessages$m, validateOptions: validateOptions$m } } = stylelint;
|
|
@@ -22616,31 +21747,19 @@ function rule$m(primary, secondaryOptions) {
|
|
|
22616
21747
|
optional: true
|
|
22617
21748
|
}
|
|
22618
21749
|
);
|
|
22619
|
-
if (!validOptions)
|
|
22620
|
-
return;
|
|
22621
|
-
}
|
|
21750
|
+
if (!validOptions) return;
|
|
22622
21751
|
root2.walkDecls((decl) => {
|
|
22623
21752
|
let prop = decl.prop;
|
|
22624
|
-
if (!isStandardSyntaxProperty(prop))
|
|
22625
|
-
|
|
22626
|
-
}
|
|
22627
|
-
if (isCustomProperty(prop)) {
|
|
22628
|
-
return;
|
|
22629
|
-
}
|
|
21753
|
+
if (!isStandardSyntaxProperty(prop)) return;
|
|
21754
|
+
if (isCustomProperty(prop)) return;
|
|
22630
21755
|
let { parent } = decl;
|
|
22631
|
-
if (!parent)
|
|
22632
|
-
throw new Error(`A parent node must be present`);
|
|
22633
|
-
}
|
|
21756
|
+
if (!parent) throw new Error(`A parent node must be present`);
|
|
22634
21757
|
if (isRule(parent)) {
|
|
22635
21758
|
let { selector: selector2 } = parent;
|
|
22636
|
-
if (selector2 && optionsMatches(secondaryOptions, `ignoreSelectors`, selector2))
|
|
22637
|
-
return;
|
|
22638
|
-
}
|
|
21759
|
+
if (selector2 && optionsMatches(secondaryOptions, `ignoreSelectors`, selector2)) return;
|
|
22639
21760
|
}
|
|
22640
21761
|
let expectedProp = primary === `lower` ? prop.toLowerCase() : prop.toUpperCase();
|
|
22641
|
-
if (prop === expectedProp)
|
|
22642
|
-
return;
|
|
22643
|
-
}
|
|
21762
|
+
if (prop === expectedProp) return;
|
|
22644
21763
|
report$f({
|
|
22645
21764
|
message: messages$m.expected,
|
|
22646
21765
|
messageArgs: [prop, expectedProp],
|
|
@@ -26319,16 +25438,10 @@ function rule$l(primary) {
|
|
|
26319
25438
|
actual: primary,
|
|
26320
25439
|
possible: [`always`, `never`]
|
|
26321
25440
|
});
|
|
26322
|
-
if (!validOptions)
|
|
26323
|
-
return;
|
|
26324
|
-
}
|
|
25441
|
+
if (!validOptions) return;
|
|
26325
25442
|
root2.walkRules((ruleNode) => {
|
|
26326
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
26327
|
-
|
|
26328
|
-
}
|
|
26329
|
-
if (!ruleNode.selector.includes(`[`)) {
|
|
26330
|
-
return;
|
|
26331
|
-
}
|
|
25443
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
25444
|
+
if (!ruleNode.selector.includes(`[`)) return;
|
|
26332
25445
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
26333
25446
|
let fix = null;
|
|
26334
25447
|
let hasFixed;
|
|
@@ -26374,11 +25487,8 @@ function rule$l(primary) {
|
|
|
26374
25487
|
});
|
|
26375
25488
|
});
|
|
26376
25489
|
if (hasFixed && fixedSelector) {
|
|
26377
|
-
if (!ruleNode.raws.selector)
|
|
26378
|
-
|
|
26379
|
-
} else {
|
|
26380
|
-
ruleNode.raws.selector.raw = fixedSelector;
|
|
26381
|
-
}
|
|
25490
|
+
if (!ruleNode.raws.selector) ruleNode.selector = fixedSelector;
|
|
25491
|
+
else ruleNode.raws.selector.raw = fixedSelector;
|
|
26382
25492
|
}
|
|
26383
25493
|
function complain(message, index2) {
|
|
26384
25494
|
report$e({
|
|
@@ -26404,17 +25514,12 @@ function rule$l(primary) {
|
|
|
26404
25514
|
} : {
|
|
26405
25515
|
attrBefore: attributeNode.spaces.attribute && attributeNode.spaces.attribute.before || ``,
|
|
26406
25516
|
setAttrBefore(fixed) {
|
|
26407
|
-
if (!attributeNode.spaces.attribute) {
|
|
26408
|
-
attributeNode.spaces.attribute = {};
|
|
26409
|
-
}
|
|
25517
|
+
if (!attributeNode.spaces.attribute) attributeNode.spaces.attribute = {};
|
|
26410
25518
|
attributeNode.spaces.attribute.before = fixed;
|
|
26411
25519
|
}
|
|
26412
25520
|
};
|
|
26413
|
-
if (primary === `always`)
|
|
26414
|
-
|
|
26415
|
-
} else if (primary === `never`) {
|
|
26416
|
-
setAttrBefore(attrBefore.replace(/^\s*/, ``));
|
|
26417
|
-
}
|
|
25521
|
+
if (primary === `always`) setAttrBefore(attrBefore.replace(/^\s*/, ` `));
|
|
25522
|
+
else if (primary === `never`) setAttrBefore(attrBefore.replace(/^\s*/, ``));
|
|
26418
25523
|
}
|
|
26419
25524
|
function fixAfter(attributeNode) {
|
|
26420
25525
|
let key = attributeNode.operator ? attributeNode.insensitive ? `insensitive` : `value` : `attribute`;
|
|
@@ -26429,17 +25534,12 @@ function rule$l(primary) {
|
|
|
26429
25534
|
} : {
|
|
26430
25535
|
after: spaces && spaces.after || ``,
|
|
26431
25536
|
setAfter(fixed) {
|
|
26432
|
-
if (!attributeNode.spaces[key]) {
|
|
26433
|
-
attributeNode.spaces[key] = {};
|
|
26434
|
-
}
|
|
25537
|
+
if (!attributeNode.spaces[key]) attributeNode.spaces[key] = {};
|
|
26435
25538
|
attributeNode.spaces[key].after = fixed;
|
|
26436
25539
|
}
|
|
26437
25540
|
};
|
|
26438
|
-
if (primary === `always`)
|
|
26439
|
-
|
|
26440
|
-
} else if (primary === `never`) {
|
|
26441
|
-
setAfter(after.replace(/\s*$/, ``));
|
|
26442
|
-
}
|
|
25541
|
+
if (primary === `always`) setAfter(after.replace(/\s*$/, ` `));
|
|
25542
|
+
else if (primary === `never`) setAfter(after.replace(/\s*$/, ``));
|
|
26443
25543
|
}
|
|
26444
25544
|
}
|
|
26445
25545
|
rule$l.ruleName = ruleName$l;
|
|
@@ -26455,20 +25555,14 @@ const index$l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
26455
25555
|
let { utils: { report: report$d } } = stylelint;
|
|
26456
25556
|
function selectorAttributeOperatorSpaceChecker(options) {
|
|
26457
25557
|
options.root.walkRules((rule2) => {
|
|
26458
|
-
if (!isStandardSyntaxRule(rule2))
|
|
26459
|
-
|
|
26460
|
-
}
|
|
26461
|
-
if (!rule2.selector.includes(`[`) || !rule2.selector.includes(`=`)) {
|
|
26462
|
-
return;
|
|
26463
|
-
}
|
|
25558
|
+
if (!isStandardSyntaxRule(rule2)) return;
|
|
25559
|
+
if (!rule2.selector.includes(`[`) || !rule2.selector.includes(`=`)) return;
|
|
26464
25560
|
let hasFixed = false;
|
|
26465
25561
|
let selector2 = rule2.raws.selector ? rule2.raws.selector.raw : rule2.selector;
|
|
26466
25562
|
let fixedSelector = parseSelector(selector2, options.result, rule2, (selectorTree) => {
|
|
26467
25563
|
selectorTree.walkAttributes((attributeNode) => {
|
|
26468
25564
|
let operator = attributeNode.operator;
|
|
26469
|
-
if (!operator)
|
|
26470
|
-
return;
|
|
26471
|
-
}
|
|
25565
|
+
if (!operator) return;
|
|
26472
25566
|
let attributeNodeString = attributeNode.toString();
|
|
26473
25567
|
styleSearch({ source: attributeNodeString, target: operator }, (match) => {
|
|
26474
25568
|
let index2 = options.checkBeforeOperator ? match.startIndex : match.endIndex - 1;
|
|
@@ -26477,11 +25571,8 @@ function selectorAttributeOperatorSpaceChecker(options) {
|
|
|
26477
25571
|
});
|
|
26478
25572
|
});
|
|
26479
25573
|
if (hasFixed && fixedSelector) {
|
|
26480
|
-
if (!rule2.raws.selector)
|
|
26481
|
-
|
|
26482
|
-
} else {
|
|
26483
|
-
rule2.raws.selector.raw = fixedSelector;
|
|
26484
|
-
}
|
|
25574
|
+
if (!rule2.raws.selector) rule2.selector = fixedSelector;
|
|
25575
|
+
else rule2.raws.selector.raw = fixedSelector;
|
|
26485
25576
|
}
|
|
26486
25577
|
function checkOperator(source, index2, node2, attributeNode, operator) {
|
|
26487
25578
|
options.locationChecker({
|
|
@@ -26527,9 +25618,7 @@ function rule$k(primary) {
|
|
|
26527
25618
|
actual: primary,
|
|
26528
25619
|
possible: [`always`, `never`]
|
|
26529
25620
|
});
|
|
26530
|
-
if (!validOptions)
|
|
26531
|
-
return;
|
|
26532
|
-
}
|
|
25621
|
+
if (!validOptions) return;
|
|
26533
25622
|
selectorAttributeOperatorSpaceChecker({
|
|
26534
25623
|
root: root2,
|
|
26535
25624
|
result: result2,
|
|
@@ -26546,12 +25635,8 @@ function rule$k(primary) {
|
|
|
26546
25635
|
),
|
|
26547
25636
|
setOperatorAfter(fixed) {
|
|
26548
25637
|
delete attributeNode.raws.operator;
|
|
26549
|
-
if (!attributeNode.raws.spaces) {
|
|
26550
|
-
|
|
26551
|
-
}
|
|
26552
|
-
if (!attributeNode.raws.spaces.operator) {
|
|
26553
|
-
attributeNode.raws.spaces.operator = {};
|
|
26554
|
-
}
|
|
25638
|
+
if (!attributeNode.raws.spaces) attributeNode.raws.spaces = {};
|
|
25639
|
+
if (!attributeNode.raws.spaces.operator) attributeNode.raws.spaces.operator = {};
|
|
26555
25640
|
attributeNode.raws.spaces.operator.after = fixed;
|
|
26556
25641
|
}
|
|
26557
25642
|
};
|
|
@@ -26569,9 +25654,7 @@ function rule$k(primary) {
|
|
|
26569
25654
|
return {
|
|
26570
25655
|
operatorAfter: attributeNode.spaces.operator && attributeNode.spaces.operator.after || ``,
|
|
26571
25656
|
setOperatorAfter(fixed) {
|
|
26572
|
-
if (!attributeNode.spaces.operator) {
|
|
26573
|
-
attributeNode.spaces.operator = {};
|
|
26574
|
-
}
|
|
25657
|
+
if (!attributeNode.spaces.operator) attributeNode.spaces.operator = {};
|
|
26575
25658
|
attributeNode.spaces.operator.after = fixed;
|
|
26576
25659
|
}
|
|
26577
25660
|
};
|
|
@@ -26617,9 +25700,7 @@ function rule$j(primary) {
|
|
|
26617
25700
|
actual: primary,
|
|
26618
25701
|
possible: [`always`, `never`]
|
|
26619
25702
|
});
|
|
26620
|
-
if (!validOptions)
|
|
26621
|
-
return;
|
|
26622
|
-
}
|
|
25703
|
+
if (!validOptions) return;
|
|
26623
25704
|
selectorAttributeOperatorSpaceChecker({
|
|
26624
25705
|
root: root2,
|
|
26625
25706
|
result: result2,
|
|
@@ -26637,9 +25718,7 @@ function rule$j(primary) {
|
|
|
26637
25718
|
} : {
|
|
26638
25719
|
attrAfter: attributeNode.spaces.attribute && attributeNode.spaces.attribute.after || ``,
|
|
26639
25720
|
setAttrAfter(fixed) {
|
|
26640
|
-
if (!attributeNode.spaces.attribute) {
|
|
26641
|
-
attributeNode.spaces.attribute = {};
|
|
26642
|
-
}
|
|
25721
|
+
if (!attributeNode.spaces.attribute) attributeNode.spaces.attribute = {};
|
|
26643
25722
|
attributeNode.spaces.attribute.after = fixed;
|
|
26644
25723
|
}
|
|
26645
25724
|
};
|
|
@@ -26667,20 +25746,12 @@ const index$j = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
26667
25746
|
ruleName: ruleName$j
|
|
26668
25747
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
26669
25748
|
function isStandardSyntaxCombinator(node2) {
|
|
26670
|
-
if (node2.type !== `combinator`)
|
|
26671
|
-
|
|
26672
|
-
}
|
|
26673
|
-
if (node2.value.startsWith(`/`) || node2.value.endsWith(`/`)) {
|
|
26674
|
-
return false;
|
|
26675
|
-
}
|
|
25749
|
+
if (node2.type !== `combinator`) return false;
|
|
25750
|
+
if (node2.value.startsWith(`/`) || node2.value.endsWith(`/`)) return false;
|
|
26676
25751
|
if (node2.parent !== void 0 && node2.parent !== null) {
|
|
26677
25752
|
let parent = node2.parent;
|
|
26678
|
-
if (node2 === parent.first)
|
|
26679
|
-
|
|
26680
|
-
}
|
|
26681
|
-
if (node2 === parent.last) {
|
|
26682
|
-
return false;
|
|
26683
|
-
}
|
|
25753
|
+
if (node2 === parent.first) return false;
|
|
25754
|
+
if (node2 === parent.last) return false;
|
|
26684
25755
|
}
|
|
26685
25756
|
return true;
|
|
26686
25757
|
}
|
|
@@ -26688,37 +25759,24 @@ let { utils: { report: report$c } } = stylelint;
|
|
|
26688
25759
|
function selectorCombinatorSpaceChecker(opts) {
|
|
26689
25760
|
let hasFixed;
|
|
26690
25761
|
opts.root.walkRules((rule2) => {
|
|
26691
|
-
if (!isStandardSyntaxRule(rule2))
|
|
26692
|
-
return;
|
|
26693
|
-
}
|
|
25762
|
+
if (!isStandardSyntaxRule(rule2)) return;
|
|
26694
25763
|
hasFixed = false;
|
|
26695
25764
|
let selector2 = rule2.raws.selector ? rule2.raws.selector.raw : rule2.selector;
|
|
26696
25765
|
let fixedSelector = parseSelector(selector2, opts.result, rule2, (selectorTree) => {
|
|
26697
25766
|
selectorTree.walkCombinators((node2) => {
|
|
26698
|
-
if (!isStandardSyntaxCombinator(node2))
|
|
26699
|
-
|
|
26700
|
-
|
|
26701
|
-
if (/\s/.test(node2.value)) {
|
|
26702
|
-
return;
|
|
26703
|
-
}
|
|
26704
|
-
if (opts.locationType === `before` && !node2.prev()) {
|
|
26705
|
-
return;
|
|
26706
|
-
}
|
|
25767
|
+
if (!isStandardSyntaxCombinator(node2)) return;
|
|
25768
|
+
if (/\s/.test(node2.value)) return;
|
|
25769
|
+
if (opts.locationType === `before` && !node2.prev()) return;
|
|
26707
25770
|
let parentParentNode = node2.parent && node2.parent.parent;
|
|
26708
|
-
if (parentParentNode && parentParentNode.type === `pseudo`)
|
|
26709
|
-
return;
|
|
26710
|
-
}
|
|
25771
|
+
if (parentParentNode && parentParentNode.type === `pseudo`) return;
|
|
26711
25772
|
let sourceIndex = node2.sourceIndex;
|
|
26712
25773
|
let index2 = node2.value.length > 1 && opts.locationType === `before` ? sourceIndex : sourceIndex + node2.value.length - 1;
|
|
26713
25774
|
check(selector2, node2, index2, rule2, sourceIndex);
|
|
26714
25775
|
});
|
|
26715
25776
|
});
|
|
26716
25777
|
if (hasFixed && fixedSelector) {
|
|
26717
|
-
if (!rule2.raws.selector)
|
|
26718
|
-
|
|
26719
|
-
} else {
|
|
26720
|
-
rule2.raws.selector.raw = fixedSelector;
|
|
26721
|
-
}
|
|
25778
|
+
if (!rule2.raws.selector) rule2.selector = fixedSelector;
|
|
25779
|
+
else rule2.raws.selector.raw = fixedSelector;
|
|
26722
25780
|
}
|
|
26723
25781
|
});
|
|
26724
25782
|
function check(source, combinator2, index2, node2, sourceIndex) {
|
|
@@ -26761,9 +25819,7 @@ function rule$i(primary) {
|
|
|
26761
25819
|
actual: primary,
|
|
26762
25820
|
possible: [`always`, `never`]
|
|
26763
25821
|
});
|
|
26764
|
-
if (!validOptions)
|
|
26765
|
-
return;
|
|
26766
|
-
}
|
|
25822
|
+
if (!validOptions) return;
|
|
26767
25823
|
selectorCombinatorSpaceChecker({
|
|
26768
25824
|
root: root2,
|
|
26769
25825
|
result: result2,
|
|
@@ -26812,9 +25868,7 @@ function rule$h(primary) {
|
|
|
26812
25868
|
actual: primary,
|
|
26813
25869
|
possible: [`always`, `never`]
|
|
26814
25870
|
});
|
|
26815
|
-
if (!validOptions)
|
|
26816
|
-
return;
|
|
26817
|
-
}
|
|
25871
|
+
if (!validOptions) return;
|
|
26818
25872
|
selectorCombinatorSpaceChecker({
|
|
26819
25873
|
root: root2,
|
|
26820
25874
|
result: result2,
|
|
@@ -26860,23 +25914,15 @@ function rule$g(primary) {
|
|
|
26860
25914
|
let validOptions = validateOptions$g(result2, ruleName$g, {
|
|
26861
25915
|
actual: primary
|
|
26862
25916
|
});
|
|
26863
|
-
if (!validOptions)
|
|
26864
|
-
return;
|
|
26865
|
-
}
|
|
25917
|
+
if (!validOptions) return;
|
|
26866
25918
|
root2.walkRules((ruleNode) => {
|
|
26867
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
26868
|
-
return;
|
|
26869
|
-
}
|
|
25919
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26870
25920
|
let hasFixed = false;
|
|
26871
25921
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
26872
|
-
if (selector2.includes(`/*`))
|
|
26873
|
-
return;
|
|
26874
|
-
}
|
|
25922
|
+
if (selector2.includes(`/*`)) return;
|
|
26875
25923
|
let fixedSelector = parseSelector(selector2, result2, ruleNode, (fullSelector) => {
|
|
26876
25924
|
fullSelector.walkCombinators((combinatorNode) => {
|
|
26877
|
-
if (combinatorNode.value !== ` `)
|
|
26878
|
-
return;
|
|
26879
|
-
}
|
|
25925
|
+
if (combinatorNode.value !== ` `) return;
|
|
26880
25926
|
let value = combinatorNode.toString();
|
|
26881
25927
|
if (value.includes(` `) || value.includes(` `) || value.includes(`
|
|
26882
25928
|
`) || value.includes(`\r`)) {
|
|
@@ -26891,9 +25937,7 @@ function rule$g(primary) {
|
|
|
26891
25937
|
fix() {
|
|
26892
25938
|
if (/^\s+$/.test(value)) {
|
|
26893
25939
|
hasFixed = true;
|
|
26894
|
-
if (!combinatorNode.raws) {
|
|
26895
|
-
combinatorNode.raws = {};
|
|
26896
|
-
}
|
|
25940
|
+
if (!combinatorNode.raws) combinatorNode.raws = {};
|
|
26897
25941
|
combinatorNode.raws.value = ` `;
|
|
26898
25942
|
combinatorNode.rawSpaceBefore = combinatorNode.rawSpaceBefore.replace(/^\s+/, ``);
|
|
26899
25943
|
combinatorNode.rawSpaceAfter = combinatorNode.rawSpaceAfter.replace(/\s+$/, ``);
|
|
@@ -26904,11 +25948,8 @@ function rule$g(primary) {
|
|
|
26904
25948
|
});
|
|
26905
25949
|
});
|
|
26906
25950
|
if (hasFixed && fixedSelector) {
|
|
26907
|
-
if (!ruleNode.raws.selector)
|
|
26908
|
-
|
|
26909
|
-
} else {
|
|
26910
|
-
ruleNode.raws.selector.raw = fixedSelector;
|
|
26911
|
-
}
|
|
25951
|
+
if (!ruleNode.raws.selector) ruleNode.selector = fixedSelector;
|
|
25952
|
+
else ruleNode.raws.selector.raw = fixedSelector;
|
|
26912
25953
|
}
|
|
26913
25954
|
});
|
|
26914
25955
|
};
|
|
@@ -26942,13 +25983,9 @@ function rule$f(primary, _secondaryOptions, context) {
|
|
|
26942
25983
|
actual: primary,
|
|
26943
25984
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
26944
25985
|
});
|
|
26945
|
-
if (!validOptions)
|
|
26946
|
-
return;
|
|
26947
|
-
}
|
|
25986
|
+
if (!validOptions) return;
|
|
26948
25987
|
root2.walkRules((ruleNode) => {
|
|
26949
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
26950
|
-
return;
|
|
26951
|
-
}
|
|
25988
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26952
25989
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
26953
25990
|
let fixIndices = [];
|
|
26954
25991
|
styleSearch(
|
|
@@ -26959,9 +25996,7 @@ function rule$f(primary, _secondaryOptions, context) {
|
|
|
26959
25996
|
},
|
|
26960
25997
|
(match) => {
|
|
26961
25998
|
let nextChars = selector2.slice(match.endIndex);
|
|
26962
|
-
if (/^\s+\/\//.test(nextChars))
|
|
26963
|
-
return;
|
|
26964
|
-
}
|
|
25999
|
+
if (/^\s+\/\//.test(nextChars)) return;
|
|
26965
26000
|
let indextoCheckAfter = /^\s+\/\*/.test(nextChars) ? selector2.indexOf(`*/`, match.endIndex) + 1 : match.startIndex;
|
|
26966
26001
|
checker.afterOneOnly({
|
|
26967
26002
|
source: selector2,
|
|
@@ -26987,18 +26022,12 @@ function rule$f(primary, _secondaryOptions, context) {
|
|
|
26987
26022
|
for (let index2 of fixIndices.sort((a2, b2) => b2 - a2)) {
|
|
26988
26023
|
let beforeSelector = fixedSelector.slice(0, index2);
|
|
26989
26024
|
let afterSelector = fixedSelector.slice(index2);
|
|
26990
|
-
if (primary.startsWith(`always`))
|
|
26991
|
-
|
|
26992
|
-
} else if (primary.startsWith(`never-multi-line`)) {
|
|
26993
|
-
afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
26994
|
-
}
|
|
26025
|
+
if (primary.startsWith(`always`)) afterSelector = context.newline + afterSelector;
|
|
26026
|
+
else if (primary.startsWith(`never-multi-line`)) afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
26995
26027
|
fixedSelector = beforeSelector + afterSelector;
|
|
26996
26028
|
}
|
|
26997
|
-
if (ruleNode.raws.selector)
|
|
26998
|
-
|
|
26999
|
-
} else {
|
|
27000
|
-
ruleNode.selector = fixedSelector;
|
|
27001
|
-
}
|
|
26029
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = fixedSelector;
|
|
26030
|
+
else ruleNode.selector = fixedSelector;
|
|
27002
26031
|
}
|
|
27003
26032
|
});
|
|
27004
26033
|
};
|
|
@@ -27016,9 +26045,7 @@ const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
27016
26045
|
let { utils: { report: report$9 } } = stylelint;
|
|
27017
26046
|
function selectorListCommaWhitespaceChecker(opts) {
|
|
27018
26047
|
opts.root.walkRules((rule2) => {
|
|
27019
|
-
if (!isStandardSyntaxRule(rule2))
|
|
27020
|
-
return;
|
|
27021
|
-
}
|
|
26048
|
+
if (!isStandardSyntaxRule(rule2)) return;
|
|
27022
26049
|
let selector2 = rule2.raws.selector ? rule2.raws.selector.raw : rule2.selector;
|
|
27023
26050
|
styleSearch(
|
|
27024
26051
|
{
|
|
@@ -27068,9 +26095,7 @@ function rule$e(primary, _secondaryOptions, context) {
|
|
|
27068
26095
|
actual: primary,
|
|
27069
26096
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
27070
26097
|
});
|
|
27071
|
-
if (!validOptions)
|
|
27072
|
-
return;
|
|
27073
|
-
}
|
|
26098
|
+
if (!validOptions) return;
|
|
27074
26099
|
let fixData;
|
|
27075
26100
|
selectorListCommaWhitespaceChecker({
|
|
27076
26101
|
root: root2,
|
|
@@ -27094,16 +26119,11 @@ function rule$e(primary, _secondaryOptions, context) {
|
|
|
27094
26119
|
if (primary.startsWith(`always`)) {
|
|
27095
26120
|
let spaceIndex = beforeSelector.search(/\s+$/);
|
|
27096
26121
|
beforeSelector = spaceIndex >= 0 ? beforeSelector.slice(0, spaceIndex) + context.newline + beforeSelector.slice(spaceIndex) : beforeSelector + context.newline;
|
|
27097
|
-
} else if (primary === `never-multi-line`)
|
|
27098
|
-
beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27099
|
-
}
|
|
26122
|
+
} else if (primary === `never-multi-line`) beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27100
26123
|
selector2 = beforeSelector + afterSelector;
|
|
27101
26124
|
}
|
|
27102
|
-
if (ruleNode.raws.selector)
|
|
27103
|
-
|
|
27104
|
-
} else {
|
|
27105
|
-
ruleNode.selector = selector2;
|
|
27106
|
-
}
|
|
26125
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = selector2;
|
|
26126
|
+
else ruleNode.selector = selector2;
|
|
27107
26127
|
}
|
|
27108
26128
|
}
|
|
27109
26129
|
};
|
|
@@ -27138,9 +26158,7 @@ function rule$d(primary) {
|
|
|
27138
26158
|
actual: primary,
|
|
27139
26159
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
27140
26160
|
});
|
|
27141
|
-
if (!validOptions)
|
|
27142
|
-
return;
|
|
27143
|
-
}
|
|
26161
|
+
if (!validOptions) return;
|
|
27144
26162
|
let fixData;
|
|
27145
26163
|
selectorListCommaWhitespaceChecker({
|
|
27146
26164
|
root: root2,
|
|
@@ -27161,18 +26179,12 @@ function rule$d(primary) {
|
|
|
27161
26179
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
27162
26180
|
let beforeSelector = selector2.slice(0, index2 + 1);
|
|
27163
26181
|
let afterSelector = selector2.slice(index2 + 1);
|
|
27164
|
-
if (primary.startsWith(`always`))
|
|
27165
|
-
|
|
27166
|
-
} else if (primary.startsWith(`never`)) {
|
|
27167
|
-
afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
27168
|
-
}
|
|
26182
|
+
if (primary.startsWith(`always`)) afterSelector = afterSelector.replace(/^\s*/, ` `);
|
|
26183
|
+
else if (primary.startsWith(`never`)) afterSelector = afterSelector.replace(/^\s*/, ``);
|
|
27169
26184
|
selector2 = beforeSelector + afterSelector;
|
|
27170
26185
|
}
|
|
27171
|
-
if (ruleNode.raws.selector)
|
|
27172
|
-
|
|
27173
|
-
} else {
|
|
27174
|
-
ruleNode.selector = selector2;
|
|
27175
|
-
}
|
|
26186
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = selector2;
|
|
26187
|
+
else ruleNode.selector = selector2;
|
|
27176
26188
|
}
|
|
27177
26189
|
}
|
|
27178
26190
|
};
|
|
@@ -27207,9 +26219,7 @@ function rule$c(primary) {
|
|
|
27207
26219
|
actual: primary,
|
|
27208
26220
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
27209
26221
|
});
|
|
27210
|
-
if (!validOptions)
|
|
27211
|
-
return;
|
|
27212
|
-
}
|
|
26222
|
+
if (!validOptions) return;
|
|
27213
26223
|
let fixData;
|
|
27214
26224
|
selectorListCommaWhitespaceChecker({
|
|
27215
26225
|
root: root2,
|
|
@@ -27230,18 +26240,12 @@ function rule$c(primary) {
|
|
|
27230
26240
|
for (let index2 of commaIndices.sort((a2, b2) => b2 - a2)) {
|
|
27231
26241
|
let beforeSelector = selector2.slice(0, index2);
|
|
27232
26242
|
let afterSelector = selector2.slice(index2);
|
|
27233
|
-
if (primary.includes(`always`))
|
|
27234
|
-
|
|
27235
|
-
} else if (primary.includes(`never`)) {
|
|
27236
|
-
beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27237
|
-
}
|
|
26243
|
+
if (primary.includes(`always`)) beforeSelector = beforeSelector.replace(/\s*$/, ` `);
|
|
26244
|
+
else if (primary.includes(`never`)) beforeSelector = beforeSelector.replace(/\s*$/, ``);
|
|
27238
26245
|
selector2 = beforeSelector + afterSelector;
|
|
27239
26246
|
}
|
|
27240
|
-
if (ruleNode.raws.selector)
|
|
27241
|
-
|
|
27242
|
-
} else {
|
|
27243
|
-
ruleNode.selector = selector2;
|
|
27244
|
-
}
|
|
26247
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = selector2;
|
|
26248
|
+
else ruleNode.selector = selector2;
|
|
27245
26249
|
}
|
|
27246
26250
|
}
|
|
27247
26251
|
};
|
|
@@ -27273,9 +26277,7 @@ function rule$b(primary) {
|
|
|
27273
26277
|
actual: primary,
|
|
27274
26278
|
possible: isNumber$1
|
|
27275
26279
|
});
|
|
27276
|
-
if (!validOptions)
|
|
27277
|
-
return;
|
|
27278
|
-
}
|
|
26280
|
+
if (!validOptions) return;
|
|
27279
26281
|
let violatedCRLFNewLinesRegex = new RegExp(`(?:\r
|
|
27280
26282
|
){${maxAdjacentNewlines + 1},}`);
|
|
27281
26283
|
let violatedLFNewLinesRegex = new RegExp(`
|
|
@@ -27297,11 +26299,8 @@ function rule$b(primary) {
|
|
|
27297
26299
|
ruleName: ruleName$b,
|
|
27298
26300
|
fix() {
|
|
27299
26301
|
let newSelectorString = selector2.replace(new RegExp(violatedLFNewLinesRegex, `gm`), allowedLFNewLinesString).replace(new RegExp(violatedCRLFNewLinesRegex, `gm`), allowedCRLFNewLinesString);
|
|
27300
|
-
if (ruleNode.raws.selector)
|
|
27301
|
-
|
|
27302
|
-
} else {
|
|
27303
|
-
ruleNode.selector = newSelectorString;
|
|
27304
|
-
}
|
|
26302
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = newSelectorString;
|
|
26303
|
+
else ruleNode.selector = newSelectorString;
|
|
27305
26304
|
}
|
|
27306
26305
|
});
|
|
27307
26306
|
}
|
|
@@ -27340,17 +26339,11 @@ function rule$a(primary) {
|
|
|
27340
26339
|
actual: primary,
|
|
27341
26340
|
possible: [`lower`, `upper`]
|
|
27342
26341
|
});
|
|
27343
|
-
if (!validOptions)
|
|
27344
|
-
return;
|
|
27345
|
-
}
|
|
26342
|
+
if (!validOptions) return;
|
|
27346
26343
|
root2.walkRules((ruleNode) => {
|
|
27347
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27348
|
-
return;
|
|
27349
|
-
}
|
|
26344
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
27350
26345
|
let selector2 = ruleNode.selector;
|
|
27351
|
-
if (!selector2.includes(`:`))
|
|
27352
|
-
return;
|
|
27353
|
-
}
|
|
26346
|
+
if (!selector2.includes(`:`)) return;
|
|
27354
26347
|
let fixedSelector = parseSelector(
|
|
27355
26348
|
ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector,
|
|
27356
26349
|
result2,
|
|
@@ -27358,16 +26351,10 @@ function rule$a(primary) {
|
|
|
27358
26351
|
(selectorTree) => {
|
|
27359
26352
|
selectorTree.walkPseudos((pseudoNode) => {
|
|
27360
26353
|
let pseudo2 = pseudoNode.value;
|
|
27361
|
-
if (!isStandardSyntaxSelector(pseudo2))
|
|
27362
|
-
|
|
27363
|
-
}
|
|
27364
|
-
if (pseudo2.includes(`::`) || levelOneAndTwoPseudoElements.has(pseudo2.toLowerCase().slice(1))) {
|
|
27365
|
-
return;
|
|
27366
|
-
}
|
|
26354
|
+
if (!isStandardSyntaxSelector(pseudo2)) return;
|
|
26355
|
+
if (pseudo2.includes(`::`) || levelOneAndTwoPseudoElements.has(pseudo2.toLowerCase().slice(1))) return;
|
|
27367
26356
|
let expectedPseudo = primary === `lower` ? pseudo2.toLowerCase() : pseudo2.toUpperCase();
|
|
27368
|
-
if (pseudo2 === expectedPseudo)
|
|
27369
|
-
return;
|
|
27370
|
-
}
|
|
26357
|
+
if (pseudo2 === expectedPseudo) return;
|
|
27371
26358
|
report$7({
|
|
27372
26359
|
message: messages$a.expected,
|
|
27373
26360
|
messageArgs: [pseudo2, expectedPseudo],
|
|
@@ -27384,11 +26371,8 @@ function rule$a(primary) {
|
|
|
27384
26371
|
}
|
|
27385
26372
|
);
|
|
27386
26373
|
if (fixedSelector) {
|
|
27387
|
-
if (ruleNode.raws.selector)
|
|
27388
|
-
|
|
27389
|
-
} else {
|
|
27390
|
-
ruleNode.selector = fixedSelector;
|
|
27391
|
-
}
|
|
26374
|
+
if (ruleNode.raws.selector) ruleNode.raws.selector.raw = fixedSelector;
|
|
26375
|
+
else ruleNode.selector = fixedSelector;
|
|
27392
26376
|
}
|
|
27393
26377
|
});
|
|
27394
26378
|
};
|
|
@@ -27422,25 +26406,19 @@ function rule$9(primary) {
|
|
|
27422
26406
|
actual: primary,
|
|
27423
26407
|
possible: [`always`, `never`]
|
|
27424
26408
|
});
|
|
27425
|
-
if (!validOptions)
|
|
27426
|
-
return;
|
|
27427
|
-
}
|
|
26409
|
+
if (!validOptions) return;
|
|
27428
26410
|
root2.walkRules((ruleNode) => {
|
|
27429
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27430
|
-
|
|
27431
|
-
}
|
|
27432
|
-
if (!ruleNode.selector.includes(`(`)) {
|
|
27433
|
-
return;
|
|
27434
|
-
}
|
|
26411
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26412
|
+
if (!ruleNode.selector.includes(`(`)) return;
|
|
27435
26413
|
let fix = null;
|
|
27436
26414
|
let hasFixed = false;
|
|
27437
26415
|
let selector2 = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector;
|
|
27438
26416
|
let fixedSelector = parseSelector(selector2, result2, ruleNode, (selectorTree) => {
|
|
27439
26417
|
selectorTree.walkPseudos((pseudoNode) => {
|
|
27440
|
-
if (!pseudoNode.length)
|
|
27441
|
-
return;
|
|
27442
|
-
}
|
|
26418
|
+
if (!pseudoNode.length) return;
|
|
27443
26419
|
let paramString = pseudoNode.map((node2) => String(node2)).join(`,`);
|
|
26420
|
+
let isParamStringMultiline = paramString.includes(`
|
|
26421
|
+
`);
|
|
27444
26422
|
let nextCharIsSpace = paramString.startsWith(` `);
|
|
27445
26423
|
let openIndex = pseudoNode.sourceIndex + pseudoNode.value.length + 1;
|
|
27446
26424
|
if (nextCharIsSpace && primary === `never`) {
|
|
@@ -27459,7 +26437,7 @@ function rule$9(primary) {
|
|
|
27459
26437
|
}
|
|
27460
26438
|
let prevCharIsSpace = paramString.endsWith(` `);
|
|
27461
26439
|
let closeIndex = openIndex + paramString.length - 1;
|
|
27462
|
-
if (prevCharIsSpace && primary === `never`) {
|
|
26440
|
+
if (prevCharIsSpace && primary === `never` && !isParamStringMultiline) {
|
|
27463
26441
|
fix = () => {
|
|
27464
26442
|
hasFixed = true;
|
|
27465
26443
|
setLastNodeSpaceAfter(pseudoNode, ``);
|
|
@@ -27476,11 +26454,8 @@ function rule$9(primary) {
|
|
|
27476
26454
|
});
|
|
27477
26455
|
});
|
|
27478
26456
|
if (hasFixed && fixedSelector) {
|
|
27479
|
-
if (!ruleNode.raws.selector)
|
|
27480
|
-
|
|
27481
|
-
} else {
|
|
27482
|
-
ruleNode.raws.selector.raw = fixedSelector;
|
|
27483
|
-
}
|
|
26457
|
+
if (!ruleNode.raws.selector) ruleNode.selector = fixedSelector;
|
|
26458
|
+
else ruleNode.raws.selector.raw = fixedSelector;
|
|
27484
26459
|
}
|
|
27485
26460
|
function complain(message, index2) {
|
|
27486
26461
|
report$6({
|
|
@@ -27498,19 +26473,13 @@ function rule$9(primary) {
|
|
|
27498
26473
|
}
|
|
27499
26474
|
function setFirstNodeSpaceBefore(node2, value) {
|
|
27500
26475
|
let target = node2.first;
|
|
27501
|
-
if (target.type === `selector`)
|
|
27502
|
-
|
|
27503
|
-
} else {
|
|
27504
|
-
target.spaces.before = value;
|
|
27505
|
-
}
|
|
26476
|
+
if (target.type === `selector`) setFirstNodeSpaceBefore(target, value);
|
|
26477
|
+
else target.spaces.before = value;
|
|
27506
26478
|
}
|
|
27507
26479
|
function setLastNodeSpaceAfter(node2, value) {
|
|
27508
26480
|
let target = node2.last;
|
|
27509
|
-
if (target.type === `selector`)
|
|
27510
|
-
|
|
27511
|
-
} else {
|
|
27512
|
-
target.spaces.after = value;
|
|
27513
|
-
}
|
|
26481
|
+
if (target.type === `selector`) setLastNodeSpaceAfter(target, value);
|
|
26482
|
+
else target.spaces.after = value;
|
|
27514
26483
|
}
|
|
27515
26484
|
rule$9.ruleName = ruleName$9;
|
|
27516
26485
|
rule$9.messages = messages$9;
|
|
@@ -27546,30 +26515,18 @@ function rule$8(primary) {
|
|
|
27546
26515
|
actual: primary,
|
|
27547
26516
|
possible: [`lower`, `upper`]
|
|
27548
26517
|
});
|
|
27549
|
-
if (!validOptions)
|
|
27550
|
-
return;
|
|
27551
|
-
}
|
|
26518
|
+
if (!validOptions) return;
|
|
27552
26519
|
root2.walkRules((ruleNode) => {
|
|
27553
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27554
|
-
return;
|
|
27555
|
-
}
|
|
26520
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
27556
26521
|
let selector2 = ruleNode.selector;
|
|
27557
|
-
if (!selector2.includes(`:`))
|
|
27558
|
-
return;
|
|
27559
|
-
}
|
|
26522
|
+
if (!selector2.includes(`:`)) return;
|
|
27560
26523
|
transformSelector(result2, ruleNode, (selectorTree) => {
|
|
27561
26524
|
selectorTree.walkPseudos((pseudoNode) => {
|
|
27562
26525
|
let pseudoElement = pseudoNode.value;
|
|
27563
|
-
if (!isStandardSyntaxSelector(pseudoElement))
|
|
27564
|
-
|
|
27565
|
-
}
|
|
27566
|
-
if (!pseudoElement.includes(`::`) && !levelOneAndTwoPseudoElements.has(pseudoElement.toLowerCase().slice(1))) {
|
|
27567
|
-
return;
|
|
27568
|
-
}
|
|
26526
|
+
if (!isStandardSyntaxSelector(pseudoElement)) return;
|
|
26527
|
+
if (!pseudoElement.includes(`::`) && !levelOneAndTwoPseudoElements.has(pseudoElement.toLowerCase().slice(1))) return;
|
|
27569
26528
|
let expectedPseudoElement = primary === `lower` ? pseudoElement.toLowerCase() : pseudoElement.toUpperCase();
|
|
27570
|
-
if (pseudoElement === expectedPseudoElement)
|
|
27571
|
-
return;
|
|
27572
|
-
}
|
|
26529
|
+
if (pseudoElement === expectedPseudoElement) return;
|
|
27573
26530
|
report$5({
|
|
27574
26531
|
message: messages$8.expected,
|
|
27575
26532
|
messageArgs: [pseudoElement, expectedPseudoElement],
|
|
@@ -27628,9 +26585,7 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27628
26585
|
optional: true
|
|
27629
26586
|
}
|
|
27630
26587
|
);
|
|
27631
|
-
if (!validOptions)
|
|
27632
|
-
return;
|
|
27633
|
-
}
|
|
26588
|
+
if (!validOptions) return;
|
|
27634
26589
|
let avoidEscape = secondaryOptions && secondaryOptions.avoidEscape !== void 0 ? secondaryOptions.avoidEscape : true;
|
|
27635
26590
|
root2.walk((node2) => {
|
|
27636
26591
|
switch (node2.type) {
|
|
@@ -27646,27 +26601,19 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27646
26601
|
}
|
|
27647
26602
|
});
|
|
27648
26603
|
function checkRule(ruleNode) {
|
|
27649
|
-
if (!isStandardSyntaxRule(ruleNode))
|
|
27650
|
-
|
|
27651
|
-
}
|
|
27652
|
-
if (!ruleNode.selector.includes(`[`) || !ruleNode.selector.includes(`=`)) {
|
|
27653
|
-
return;
|
|
27654
|
-
}
|
|
26604
|
+
if (!isStandardSyntaxRule(ruleNode)) return;
|
|
26605
|
+
if (!ruleNode.selector.includes(`[`) || !ruleNode.selector.includes(`=`)) return;
|
|
27655
26606
|
let fixPositions = [];
|
|
27656
26607
|
parseSelector(ruleNode.selector, result2, ruleNode, (selectorTree) => {
|
|
27657
26608
|
let selectorFixed = false;
|
|
27658
26609
|
selectorTree.walkAttributes((attributeNode) => {
|
|
27659
|
-
if (!attributeNode.quoted)
|
|
27660
|
-
return;
|
|
27661
|
-
}
|
|
26610
|
+
if (!attributeNode.quoted) return;
|
|
27662
26611
|
const maybeProblemIndex = attributeNode.sourceIndex + attributeNode.offsetOf(`value`);
|
|
27663
26612
|
if (attributeNode.quoteMark === correctQuote && avoidEscape) {
|
|
27664
26613
|
assertString(attributeNode.value);
|
|
27665
26614
|
let needsCorrectEscape = attributeNode.value.includes(correctQuote);
|
|
27666
26615
|
let needsOtherEscape = attributeNode.value.includes(erroneousQuote);
|
|
27667
|
-
if (needsOtherEscape)
|
|
27668
|
-
return;
|
|
27669
|
-
}
|
|
26616
|
+
if (needsOtherEscape) return;
|
|
27670
26617
|
if (needsCorrectEscape) {
|
|
27671
26618
|
report$4({
|
|
27672
26619
|
message: messages$7.expected,
|
|
@@ -27704,9 +26651,7 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27704
26651
|
});
|
|
27705
26652
|
return;
|
|
27706
26653
|
}
|
|
27707
|
-
if (needsCorrectEscape)
|
|
27708
|
-
return;
|
|
27709
|
-
}
|
|
26654
|
+
if (needsCorrectEscape) return;
|
|
27710
26655
|
}
|
|
27711
26656
|
report$4({
|
|
27712
26657
|
message: messages$7.expected,
|
|
@@ -27723,24 +26668,16 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27723
26668
|
});
|
|
27724
26669
|
}
|
|
27725
26670
|
});
|
|
27726
|
-
if (selectorFixed)
|
|
27727
|
-
ruleNode.selector = selectorTree.toString();
|
|
27728
|
-
}
|
|
26671
|
+
if (selectorFixed) ruleNode.selector = selectorTree.toString();
|
|
27729
26672
|
});
|
|
27730
|
-
for (let fixIndex of fixPositions)
|
|
27731
|
-
ruleNode.selector = replaceQuote(ruleNode.selector, fixIndex, correctQuote);
|
|
27732
|
-
}
|
|
26673
|
+
for (let fixIndex of fixPositions) ruleNode.selector = replaceQuote(ruleNode.selector, fixIndex, correctQuote);
|
|
27733
26674
|
}
|
|
27734
26675
|
function checkDeclOrAtRule(node2, value, getIndex) {
|
|
27735
26676
|
let fixPositions = [];
|
|
27736
|
-
if (!value.includes(erroneousQuote))
|
|
27737
|
-
return;
|
|
27738
|
-
}
|
|
26677
|
+
if (!value.includes(erroneousQuote)) return;
|
|
27739
26678
|
if (isAtRule(node2) && node2.name === `charset`) {
|
|
27740
26679
|
let hasValidQuotes = node2.params.startsWith(`"`) && node2.params.endsWith(`"`);
|
|
27741
|
-
if (hasValidQuotes || correctQuote === `'`)
|
|
27742
|
-
return;
|
|
27743
|
-
}
|
|
26680
|
+
if (hasValidQuotes || correctQuote === `'`) return;
|
|
27744
26681
|
}
|
|
27745
26682
|
valueParser(value).walk((valueNode) => {
|
|
27746
26683
|
if (valueNode.type === `string` && valueNode.quote === erroneousQuote) {
|
|
@@ -27768,11 +26705,8 @@ function rule$7(primary, secondaryOptions) {
|
|
|
27768
26705
|
}
|
|
27769
26706
|
});
|
|
27770
26707
|
for (let fixIndex of fixPositions) {
|
|
27771
|
-
if (isAtRule(node2))
|
|
27772
|
-
|
|
27773
|
-
} else {
|
|
27774
|
-
node2.value = replaceQuote(node2.value, fixIndex, correctQuote);
|
|
27775
|
-
}
|
|
26708
|
+
if (isAtRule(node2)) node2.params = replaceQuote(node2.params, fixIndex, correctQuote);
|
|
26709
|
+
else node2.value = replaceQuote(node2.value, fixIndex, correctQuote);
|
|
27776
26710
|
}
|
|
27777
26711
|
}
|
|
27778
26712
|
};
|
|
@@ -27806,9 +26740,7 @@ function rule$6(primary) {
|
|
|
27806
26740
|
actual: primary,
|
|
27807
26741
|
possible: [`always`, `never`]
|
|
27808
26742
|
});
|
|
27809
|
-
if (!validOptions || !root2.source || root2.source.inline || root2.source.lang === `object-literal` || root2.document !== void 0)
|
|
27810
|
-
return;
|
|
27811
|
-
}
|
|
26743
|
+
if (!validOptions || !root2.source || root2.source.inline || root2.source.lang === `object-literal` || root2.document !== void 0) return;
|
|
27812
26744
|
let { hasBOM } = root2.source.input;
|
|
27813
26745
|
if (primary === `always` && !hasBOM) {
|
|
27814
26746
|
report$3({
|
|
@@ -27843,27 +26775,13 @@ function blurInterpolation(source, blurChar = ` `) {
|
|
|
27843
26775
|
}
|
|
27844
26776
|
function isStandardSyntaxValue(value) {
|
|
27845
26777
|
let normalizedValue = value;
|
|
27846
|
-
if (/^[-+*/]/.test(value.charAt(0)))
|
|
27847
|
-
|
|
27848
|
-
|
|
27849
|
-
if (
|
|
27850
|
-
|
|
27851
|
-
|
|
27852
|
-
if (
|
|
27853
|
-
return false;
|
|
27854
|
-
}
|
|
27855
|
-
if (/^.+\.[-\w]+\(/.test(value)) {
|
|
27856
|
-
return false;
|
|
27857
|
-
}
|
|
27858
|
-
if (normalizedValue.startsWith(`@`)) {
|
|
27859
|
-
return false;
|
|
27860
|
-
}
|
|
27861
|
-
if (hasInterpolation(normalizedValue)) {
|
|
27862
|
-
return false;
|
|
27863
|
-
}
|
|
27864
|
-
if (/__MSG_\S+__/.test(value)) {
|
|
27865
|
-
return false;
|
|
27866
|
-
}
|
|
26778
|
+
if (/^[-+*/]/.test(value.charAt(0))) normalizedValue = normalizedValue.slice(1);
|
|
26779
|
+
if (normalizedValue.startsWith(`$`)) return false;
|
|
26780
|
+
if (/^.+\.\$/.test(value)) return false;
|
|
26781
|
+
if (/^.+\.[-\w]+\(/.test(value)) return false;
|
|
26782
|
+
if (normalizedValue.startsWith(`@`)) return false;
|
|
26783
|
+
if (hasInterpolation(normalizedValue)) return false;
|
|
26784
|
+
if (/__MSG_\S+__/.test(value)) return false;
|
|
27867
26785
|
return true;
|
|
27868
26786
|
}
|
|
27869
26787
|
function getDimension(node2) {
|
|
@@ -27917,20 +26835,14 @@ function rule$5(primary) {
|
|
|
27917
26835
|
actual: primary,
|
|
27918
26836
|
possible: [`lower`, `upper`]
|
|
27919
26837
|
});
|
|
27920
|
-
if (!validOptions)
|
|
27921
|
-
return;
|
|
27922
|
-
}
|
|
26838
|
+
if (!validOptions) return;
|
|
27923
26839
|
function check(node2, checkedValue, getIndex) {
|
|
27924
26840
|
let problems = [];
|
|
27925
26841
|
function processValue(valueNode) {
|
|
27926
26842
|
let { number, unit: unit2 } = getDimension(valueNode);
|
|
27927
|
-
if (!number || !unit2)
|
|
27928
|
-
return false;
|
|
27929
|
-
}
|
|
26843
|
+
if (!number || !unit2) return false;
|
|
27930
26844
|
let expectedUnit = primary === `lower` ? unit2.toLowerCase() : unit2.toUpperCase();
|
|
27931
|
-
if (unit2 === expectedUnit)
|
|
27932
|
-
return false;
|
|
27933
|
-
}
|
|
26845
|
+
if (unit2 === expectedUnit) return false;
|
|
27934
26846
|
let index2 = getIndex(node2);
|
|
27935
26847
|
problems.push({
|
|
27936
26848
|
index: index2 + valueNode.sourceIndex + number.length,
|
|
@@ -27942,9 +26854,7 @@ function rule$5(primary) {
|
|
|
27942
26854
|
}
|
|
27943
26855
|
let parsedValue = valueParser(checkedValue).walk((valueNode) => {
|
|
27944
26856
|
let value = valueNode.value;
|
|
27945
|
-
if (valueNode.type === `function` && value.toLowerCase() === `url`)
|
|
27946
|
-
return false;
|
|
27947
|
-
}
|
|
26857
|
+
if (valueNode.type === `function` && value.toLowerCase() === `url`) return false;
|
|
27948
26858
|
if (value.includes(`*`)) {
|
|
27949
26859
|
value.split(`*`).some((val) => processValue({
|
|
27950
26860
|
...valueNode,
|
|
@@ -27952,9 +26862,7 @@ function rule$5(primary) {
|
|
|
27952
26862
|
value: val
|
|
27953
26863
|
}));
|
|
27954
26864
|
}
|
|
27955
|
-
if (processValue(valueNode))
|
|
27956
|
-
valueNode.value = primary === `lower` ? value.toLowerCase() : value.toUpperCase();
|
|
27957
|
-
}
|
|
26865
|
+
if (processValue(valueNode)) valueNode.value = primary === `lower` ? value.toLowerCase() : value.toUpperCase();
|
|
27958
26866
|
});
|
|
27959
26867
|
if (problems.length) {
|
|
27960
26868
|
for (let err of problems) {
|
|
@@ -27967,20 +26875,15 @@ function rule$5(primary) {
|
|
|
27967
26875
|
result: result2,
|
|
27968
26876
|
ruleName: ruleName$5,
|
|
27969
26877
|
fix() {
|
|
27970
|
-
if (`name` in node2 && node2.name === `media`)
|
|
27971
|
-
|
|
27972
|
-
} else if (`value` in node2) {
|
|
27973
|
-
node2.value = parsedValue.toString();
|
|
27974
|
-
}
|
|
26878
|
+
if (`name` in node2 && node2.name === `media`) node2.params = parsedValue.toString();
|
|
26879
|
+
else if (`value` in node2) node2.value = parsedValue.toString();
|
|
27975
26880
|
}
|
|
27976
26881
|
});
|
|
27977
26882
|
}
|
|
27978
26883
|
}
|
|
27979
26884
|
}
|
|
27980
26885
|
root2.walkAtRules((atRule2) => {
|
|
27981
|
-
if (!/^media$/i.test(atRule2.name) && !(`variable` in atRule2))
|
|
27982
|
-
return;
|
|
27983
|
-
}
|
|
26886
|
+
if (!/^media$/i.test(atRule2.name) && !(`variable` in atRule2)) return;
|
|
27984
26887
|
check(atRule2, atRule2.params, atRuleParamIndex);
|
|
27985
26888
|
});
|
|
27986
26889
|
root2.walkDecls((decl) => check(decl, decl.value, declarationValueIndex));
|
|
@@ -27999,9 +26902,7 @@ const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
27999
26902
|
let { utils: { report: report$1 } } = stylelint;
|
|
28000
26903
|
function valueListCommaWhitespaceChecker(opts) {
|
|
28001
26904
|
opts.root.walkDecls((decl) => {
|
|
28002
|
-
if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop))
|
|
28003
|
-
return;
|
|
28004
|
-
}
|
|
26905
|
+
if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop)) return;
|
|
28005
26906
|
let declString = decl.toString();
|
|
28006
26907
|
styleSearch(
|
|
28007
26908
|
{
|
|
@@ -28011,9 +26912,7 @@ function valueListCommaWhitespaceChecker(opts) {
|
|
|
28011
26912
|
},
|
|
28012
26913
|
(match) => {
|
|
28013
26914
|
let indexToCheckAfter = opts.determineIndex ? opts.determineIndex(declString, match) : match.startIndex;
|
|
28014
|
-
if (indexToCheckAfter === false)
|
|
28015
|
-
return;
|
|
28016
|
-
}
|
|
26915
|
+
if (indexToCheckAfter === false) return;
|
|
28017
26916
|
checkComma(declString, indexToCheckAfter, decl);
|
|
28018
26917
|
}
|
|
28019
26918
|
);
|
|
@@ -28055,9 +26954,7 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28055
26954
|
actual: primary,
|
|
28056
26955
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
28057
26956
|
});
|
|
28058
|
-
if (!validOptions)
|
|
28059
|
-
return;
|
|
28060
|
-
}
|
|
26957
|
+
if (!validOptions) return;
|
|
28061
26958
|
let fixData;
|
|
28062
26959
|
valueListCommaWhitespaceChecker({
|
|
28063
26960
|
root: root2,
|
|
@@ -28066,9 +26963,7 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28066
26963
|
checkedRuleName: ruleName$4,
|
|
28067
26964
|
fix: (declNode, index2) => {
|
|
28068
26965
|
let valueIndex = declarationValueIndex(declNode);
|
|
28069
|
-
if (index2 <= valueIndex)
|
|
28070
|
-
return false;
|
|
28071
|
-
}
|
|
26966
|
+
if (index2 <= valueIndex) return false;
|
|
28072
26967
|
fixData = fixData || /* @__PURE__ */ new Map();
|
|
28073
26968
|
let commaIndices = fixData.get(declNode) || [];
|
|
28074
26969
|
commaIndices.push(index2);
|
|
@@ -28077,9 +26972,7 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28077
26972
|
},
|
|
28078
26973
|
determineIndex: (declString, match) => {
|
|
28079
26974
|
let nextChars = declString.substring(match.endIndex, declString.length);
|
|
28080
|
-
if (/^[ \t]*\/\//.test(nextChars))
|
|
28081
|
-
return false;
|
|
28082
|
-
}
|
|
26975
|
+
if (/^[ \t]*\/\//.test(nextChars)) return false;
|
|
28083
26976
|
return /^[ \t]*\/\*/.test(nextChars) ? declString.indexOf(`*/`, match.endIndex) + 1 : match.startIndex;
|
|
28084
26977
|
}
|
|
28085
26978
|
});
|
|
@@ -28090,11 +26983,8 @@ function rule$4(primary, _secondaryOptions, context) {
|
|
|
28090
26983
|
let valueIndex = index2 - declarationValueIndex(decl);
|
|
28091
26984
|
let beforeValue = value.slice(0, valueIndex + 1);
|
|
28092
26985
|
let afterValue = value.slice(valueIndex + 1);
|
|
28093
|
-
if (primary.startsWith(`always`))
|
|
28094
|
-
|
|
28095
|
-
} else if (primary.startsWith(`never-multi-line`)) {
|
|
28096
|
-
afterValue = afterValue.replace(/^\s*/, ``);
|
|
28097
|
-
}
|
|
26986
|
+
if (primary.startsWith(`always`)) afterValue = context.newline + afterValue;
|
|
26987
|
+
else if (primary.startsWith(`never-multi-line`)) afterValue = afterValue.replace(/^\s*/, ``);
|
|
28098
26988
|
setDeclarationValue(decl, beforeValue + afterValue);
|
|
28099
26989
|
}
|
|
28100
26990
|
}
|
|
@@ -28129,9 +27019,7 @@ function rule$3(primary) {
|
|
|
28129
27019
|
actual: primary,
|
|
28130
27020
|
possible: [`always`, `always-multi-line`, `never-multi-line`]
|
|
28131
27021
|
});
|
|
28132
|
-
if (!validOptions)
|
|
28133
|
-
return;
|
|
28134
|
-
}
|
|
27022
|
+
if (!validOptions) return;
|
|
28135
27023
|
valueListCommaWhitespaceChecker({
|
|
28136
27024
|
root: root2,
|
|
28137
27025
|
result: result2,
|
|
@@ -28170,9 +27058,7 @@ function rule$2(primary) {
|
|
|
28170
27058
|
actual: primary,
|
|
28171
27059
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
28172
27060
|
});
|
|
28173
|
-
if (!validOptions)
|
|
28174
|
-
return;
|
|
28175
|
-
}
|
|
27061
|
+
if (!validOptions) return;
|
|
28176
27062
|
let fixData;
|
|
28177
27063
|
valueListCommaWhitespaceChecker({
|
|
28178
27064
|
root: root2,
|
|
@@ -28181,9 +27067,7 @@ function rule$2(primary) {
|
|
|
28181
27067
|
checkedRuleName: ruleName$2,
|
|
28182
27068
|
fix: (declNode, index2) => {
|
|
28183
27069
|
let valueIndex = declarationValueIndex(declNode);
|
|
28184
|
-
if (index2 <= valueIndex)
|
|
28185
|
-
return false;
|
|
28186
|
-
}
|
|
27070
|
+
if (index2 <= valueIndex) return false;
|
|
28187
27071
|
fixData = fixData || /* @__PURE__ */ new Map();
|
|
28188
27072
|
let commaIndices = fixData.get(declNode) || [];
|
|
28189
27073
|
commaIndices.push(index2);
|
|
@@ -28198,11 +27082,8 @@ function rule$2(primary) {
|
|
|
28198
27082
|
let valueIndex = index2 - declarationValueIndex(decl);
|
|
28199
27083
|
let beforeValue = value.slice(0, valueIndex + 1);
|
|
28200
27084
|
let afterValue = value.slice(valueIndex + 1);
|
|
28201
|
-
if (primary.startsWith(`always`))
|
|
28202
|
-
|
|
28203
|
-
} else if (primary.startsWith(`never`)) {
|
|
28204
|
-
afterValue = afterValue.replace(/^\s*/, ``);
|
|
28205
|
-
}
|
|
27085
|
+
if (primary.startsWith(`always`)) afterValue = afterValue.replace(/^\s*/, ` `);
|
|
27086
|
+
else if (primary.startsWith(`never`)) afterValue = afterValue.replace(/^\s*/, ``);
|
|
28206
27087
|
setDeclarationValue(decl, beforeValue + afterValue);
|
|
28207
27088
|
}
|
|
28208
27089
|
}
|
|
@@ -28239,9 +27120,7 @@ function rule$1(primary) {
|
|
|
28239
27120
|
actual: primary,
|
|
28240
27121
|
possible: [`always`, `never`, `always-single-line`, `never-single-line`]
|
|
28241
27122
|
});
|
|
28242
|
-
if (!validOptions)
|
|
28243
|
-
return;
|
|
28244
|
-
}
|
|
27123
|
+
if (!validOptions) return;
|
|
28245
27124
|
let fixData;
|
|
28246
27125
|
valueListCommaWhitespaceChecker({
|
|
28247
27126
|
root: root2,
|
|
@@ -28250,9 +27129,7 @@ function rule$1(primary) {
|
|
|
28250
27129
|
checkedRuleName: ruleName$1,
|
|
28251
27130
|
fix: (declNode, index2) => {
|
|
28252
27131
|
let valueIndex = declarationValueIndex(declNode);
|
|
28253
|
-
if (index2 <= valueIndex)
|
|
28254
|
-
return false;
|
|
28255
|
-
}
|
|
27132
|
+
if (index2 <= valueIndex) return false;
|
|
28256
27133
|
fixData = fixData || /* @__PURE__ */ new Map();
|
|
28257
27134
|
let commaIndices = fixData.get(declNode) || [];
|
|
28258
27135
|
commaIndices.push(index2);
|
|
@@ -28267,11 +27144,8 @@ function rule$1(primary) {
|
|
|
28267
27144
|
let valueIndex = index2 - declarationValueIndex(decl);
|
|
28268
27145
|
let beforeValue = value.slice(0, valueIndex);
|
|
28269
27146
|
let afterValue = value.slice(valueIndex);
|
|
28270
|
-
if (primary.startsWith(`always`))
|
|
28271
|
-
|
|
28272
|
-
} else if (primary.startsWith(`never`)) {
|
|
28273
|
-
beforeValue = beforeValue.replace(/\s*$/, ``);
|
|
28274
|
-
}
|
|
27147
|
+
if (primary.startsWith(`always`)) beforeValue = beforeValue.replace(/\s*$/, ` `);
|
|
27148
|
+
else if (primary.startsWith(`never`)) beforeValue = beforeValue.replace(/\s*$/, ``);
|
|
28275
27149
|
setDeclarationValue(decl, beforeValue + afterValue);
|
|
28276
27150
|
}
|
|
28277
27151
|
}
|
|
@@ -28305,9 +27179,7 @@ function rule(primary) {
|
|
|
28305
27179
|
actual: primary,
|
|
28306
27180
|
possible: isNumber$1
|
|
28307
27181
|
});
|
|
28308
|
-
if (!validOptions)
|
|
28309
|
-
return;
|
|
28310
|
-
}
|
|
27182
|
+
if (!validOptions) return;
|
|
28311
27183
|
let violatedCRLFNewLinesRegex = new RegExp(`(?:\r
|
|
28312
27184
|
){${maxAdjacentNewlines + 1},}`);
|
|
28313
27185
|
let violatedLFNewLinesRegex = new RegExp(`
|