oxlint-tailwindcss 0.1.10 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -3
- package/dist/index.cjs +176 -313
- package/dist/index.mjs +176 -313
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -34,7 +34,8 @@ const DEFAULT_EXTRACTOR_CONFIG = {
|
|
|
34
34
|
"cc",
|
|
35
35
|
"clb",
|
|
36
36
|
"cnb",
|
|
37
|
-
"objstr"
|
|
37
|
+
"objstr",
|
|
38
|
+
"classed"
|
|
38
39
|
],
|
|
39
40
|
tags: ["tw"],
|
|
40
41
|
variablePatterns: [
|
|
@@ -43,6 +44,69 @@ const DEFAULT_EXTRACTOR_CONFIG = {
|
|
|
43
44
|
/^styles?$/
|
|
44
45
|
]
|
|
45
46
|
};
|
|
47
|
+
let _cachedConfig = null;
|
|
48
|
+
let _settingsResolved = false;
|
|
49
|
+
function mergeUnique(defaults, extras, exclusions) {
|
|
50
|
+
let base = defaults;
|
|
51
|
+
if (exclusions && exclusions.length > 0) {
|
|
52
|
+
const excludeSet = new Set(exclusions);
|
|
53
|
+
base = base.filter((d) => !excludeSet.has(d));
|
|
54
|
+
}
|
|
55
|
+
if (!extras || extras.length === 0) return base;
|
|
56
|
+
const set = new Set(base);
|
|
57
|
+
for (const e of extras) set.add(e);
|
|
58
|
+
return [...set];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Returns the extractor config, merging defaults with user settings from
|
|
62
|
+
* `settings.tailwindcss`. Caches after the first successful settings read.
|
|
63
|
+
* Falls back to DEFAULT_EXTRACTOR_CONFIG if settings are unavailable.
|
|
64
|
+
*/
|
|
65
|
+
function getExtractorConfig(context) {
|
|
66
|
+
if (_settingsResolved) return _cachedConfig;
|
|
67
|
+
let tw;
|
|
68
|
+
try {
|
|
69
|
+
const raw = context.settings?.tailwindcss;
|
|
70
|
+
if (raw && typeof raw === "object") tw = raw;
|
|
71
|
+
_settingsResolved = true;
|
|
72
|
+
} catch {
|
|
73
|
+
return DEFAULT_EXTRACTOR_CONFIG;
|
|
74
|
+
}
|
|
75
|
+
if (!tw) {
|
|
76
|
+
_cachedConfig = DEFAULT_EXTRACTOR_CONFIG;
|
|
77
|
+
return _cachedConfig;
|
|
78
|
+
}
|
|
79
|
+
const exclude = tw.exclude;
|
|
80
|
+
const excludedPatternSources = new Set(exclude?.variablePatterns ?? []);
|
|
81
|
+
const filteredPatterns = excludedPatternSources.size > 0 ? DEFAULT_EXTRACTOR_CONFIG.variablePatterns.filter((re) => !excludedPatternSources.has(re.source)) : DEFAULT_EXTRACTOR_CONFIG.variablePatterns;
|
|
82
|
+
_cachedConfig = {
|
|
83
|
+
attributes: mergeUnique(DEFAULT_EXTRACTOR_CONFIG.attributes, tw.attributes, exclude?.attributes),
|
|
84
|
+
callees: mergeUnique(DEFAULT_EXTRACTOR_CONFIG.callees, tw.callees, exclude?.callees),
|
|
85
|
+
tags: mergeUnique(DEFAULT_EXTRACTOR_CONFIG.tags, tw.tags, exclude?.tags),
|
|
86
|
+
variablePatterns: [...filteredPatterns, ...(tw.variablePatterns ?? []).map((p) => new RegExp(p))]
|
|
87
|
+
};
|
|
88
|
+
return _cachedConfig;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Creates the 4 standard AST visitor callbacks that all rules use.
|
|
92
|
+
* Resolves extractor config lazily from context.settings on first visitor call.
|
|
93
|
+
*/
|
|
94
|
+
function createExtractorVisitors(context, check) {
|
|
95
|
+
return {
|
|
96
|
+
JSXAttribute(node) {
|
|
97
|
+
check(extractFromJSXAttribute(node, getExtractorConfig(context)));
|
|
98
|
+
},
|
|
99
|
+
CallExpression(node) {
|
|
100
|
+
check(extractFromCallExpression(node, getExtractorConfig(context)));
|
|
101
|
+
},
|
|
102
|
+
TaggedTemplateExpression(node) {
|
|
103
|
+
check(extractFromTaggedTemplate(node, getExtractorConfig(context)));
|
|
104
|
+
},
|
|
105
|
+
VariableDeclarator(node) {
|
|
106
|
+
check(extractFromVariableDeclarator(node, getExtractorConfig(context)));
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
46
110
|
/**
|
|
47
111
|
* Extracts class locations from a JSXAttribute node.
|
|
48
112
|
* Handles: className="...", className={`...`}, className={cond ? "..." : "..."}
|
|
@@ -56,7 +120,11 @@ function extractFromJSXAttribute(node, config = DEFAULT_EXTRACTOR_CONFIG) {
|
|
|
56
120
|
node: node.value,
|
|
57
121
|
range: [node.value.range[0] + 1, node.value.range[1] - 1]
|
|
58
122
|
}];
|
|
59
|
-
if (node.value.type === "JSXExpressionContainer")
|
|
123
|
+
if (node.value.type === "JSXExpressionContainer") {
|
|
124
|
+
const expr = node.value.expression;
|
|
125
|
+
if (expr.type === "ObjectExpression") return extractObjectValues(expr);
|
|
126
|
+
return extractFromExpression(expr);
|
|
127
|
+
}
|
|
60
128
|
return [];
|
|
61
129
|
}
|
|
62
130
|
/**
|
|
@@ -68,6 +136,7 @@ function extractFromCallExpression(node, config = DEFAULT_EXTRACTOR_CONFIG) {
|
|
|
68
136
|
if (!calleeName || !config.callees.includes(calleeName)) return [];
|
|
69
137
|
if (calleeName === "cva") return extractFromCvaCall(node);
|
|
70
138
|
if (calleeName === "tv") return extractFromTvCall(node);
|
|
139
|
+
if (calleeName === "classed") return extractFromClassedCall(node);
|
|
71
140
|
const results = [];
|
|
72
141
|
for (const arg of node.arguments) results.push(...extractFromExpression(arg));
|
|
73
142
|
return results;
|
|
@@ -81,6 +150,40 @@ function extractFromTaggedTemplate(node, config = DEFAULT_EXTRACTOR_CONFIG) {
|
|
|
81
150
|
return extractFromTemplateLiteral(node.quasi);
|
|
82
151
|
}
|
|
83
152
|
/**
|
|
153
|
+
* Extracts class string values from an ObjectExpression in a JSX attribute.
|
|
154
|
+
* For: classNames={{ root: "flex flex-col", label: "text-sm" }}
|
|
155
|
+
* Recurses into each property value via extractFromExpression.
|
|
156
|
+
*/
|
|
157
|
+
function extractObjectValues(node) {
|
|
158
|
+
const results = [];
|
|
159
|
+
for (const prop of node.properties) if (prop.type === "Property") results.push(...extractFromExpression(prop.value));
|
|
160
|
+
return results;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Extracts class locations from a classed() call (tw-classed).
|
|
164
|
+
* First string argument is the element type (skipped), rest are class strings
|
|
165
|
+
* or cva-like config objects.
|
|
166
|
+
* classed("button", "flex items-center", { variants: { ... } })
|
|
167
|
+
*/
|
|
168
|
+
function extractFromClassedCall(node) {
|
|
169
|
+
const results = [];
|
|
170
|
+
let skippedFirst = false;
|
|
171
|
+
for (const arg of node.arguments) {
|
|
172
|
+
if (!skippedFirst && arg.type === "Literal" && typeof arg.value === "string") {
|
|
173
|
+
skippedFirst = true;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (!skippedFirst && arg.type === "Identifier") {
|
|
177
|
+
skippedFirst = true;
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
skippedFirst = true;
|
|
181
|
+
if (arg.type === "ObjectExpression") results.push(...extractFromCvaConfig(arg));
|
|
182
|
+
else results.push(...extractFromExpression(arg));
|
|
183
|
+
}
|
|
184
|
+
return results;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
84
187
|
* Extracts class locations from a cva() call.
|
|
85
188
|
* Handles: base string, variants config, compoundVariants.
|
|
86
189
|
*/
|
|
@@ -291,20 +394,7 @@ const noDuplicateClasses = defineRule({
|
|
|
291
394
|
}
|
|
292
395
|
}
|
|
293
396
|
}
|
|
294
|
-
return
|
|
295
|
-
JSXAttribute(node) {
|
|
296
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
297
|
-
},
|
|
298
|
-
CallExpression(node) {
|
|
299
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
300
|
-
},
|
|
301
|
-
TaggedTemplateExpression(node) {
|
|
302
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
303
|
-
},
|
|
304
|
-
VariableDeclarator(node) {
|
|
305
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
306
|
-
}
|
|
307
|
-
};
|
|
397
|
+
return createExtractorVisitors(context, check);
|
|
308
398
|
}
|
|
309
399
|
});
|
|
310
400
|
//#endregion
|
|
@@ -332,20 +422,7 @@ const noUnnecessaryWhitespace = defineRule({
|
|
|
332
422
|
});
|
|
333
423
|
}
|
|
334
424
|
}
|
|
335
|
-
return
|
|
336
|
-
JSXAttribute(node) {
|
|
337
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
338
|
-
},
|
|
339
|
-
CallExpression(node) {
|
|
340
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
341
|
-
},
|
|
342
|
-
TaggedTemplateExpression(node) {
|
|
343
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
344
|
-
},
|
|
345
|
-
VariableDeclarator(node) {
|
|
346
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
347
|
-
}
|
|
348
|
-
};
|
|
425
|
+
return createExtractorVisitors(context, check);
|
|
349
426
|
}
|
|
350
427
|
});
|
|
351
428
|
//#endregion
|
|
@@ -1057,6 +1134,44 @@ function loadDesignSystemSync(cssPath) {
|
|
|
1057
1134
|
}
|
|
1058
1135
|
//#endregion
|
|
1059
1136
|
//#region src/design-system/auto-detect.ts
|
|
1137
|
+
const IMPORT_RE = /@import\s+['"]([^'"]+)['"]/g;
|
|
1138
|
+
/**
|
|
1139
|
+
* Resolves a CSS @import specifier to an absolute path.
|
|
1140
|
+
* Handles relative paths and package imports (walks up to node_modules).
|
|
1141
|
+
*/
|
|
1142
|
+
function resolveImport(specifier, baseDir) {
|
|
1143
|
+
if (specifier.startsWith(".")) return resolve(baseDir, specifier);
|
|
1144
|
+
let dir = baseDir;
|
|
1145
|
+
while (true) {
|
|
1146
|
+
const candidate = join(dir, "node_modules", specifier);
|
|
1147
|
+
if (existsSync(candidate)) return candidate;
|
|
1148
|
+
const parent = dirname(dir);
|
|
1149
|
+
if (parent === dir) break;
|
|
1150
|
+
dir = parent;
|
|
1151
|
+
}
|
|
1152
|
+
return null;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Checks if any @import in the CSS content points to a file containing a Tailwind signal.
|
|
1156
|
+
* Only follows ONE level of imports — no recursion.
|
|
1157
|
+
*/
|
|
1158
|
+
function hasTailwindSignalInImports(content, baseDir, signals) {
|
|
1159
|
+
IMPORT_RE.lastIndex = 0;
|
|
1160
|
+
let match;
|
|
1161
|
+
while ((match = IMPORT_RE.exec(content)) !== null) {
|
|
1162
|
+
const specifier = match[1];
|
|
1163
|
+
if (specifier === "tailwindcss") continue;
|
|
1164
|
+
const resolved = resolveImport(specifier, baseDir);
|
|
1165
|
+
if (!resolved) continue;
|
|
1166
|
+
try {
|
|
1167
|
+
const imported = readFileSync(resolved, "utf-8");
|
|
1168
|
+
if (signals.some((signal) => imported.includes(signal))) return true;
|
|
1169
|
+
} catch {
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
return false;
|
|
1174
|
+
}
|
|
1060
1175
|
const CANDIDATE_DIRS = [
|
|
1061
1176
|
"src",
|
|
1062
1177
|
".",
|
|
@@ -1099,6 +1214,7 @@ function autoDetectEntryPoint(filePath) {
|
|
|
1099
1214
|
try {
|
|
1100
1215
|
const content = readFileSync(fullPath, "utf-8");
|
|
1101
1216
|
if (TAILWIND_SIGNALS.some((signal) => content.includes(signal))) return fullPath;
|
|
1217
|
+
if (hasTailwindSignalInImports(content, dirname(fullPath), TAILWIND_SIGNALS)) return fullPath;
|
|
1102
1218
|
} catch {
|
|
1103
1219
|
continue;
|
|
1104
1220
|
}
|
|
@@ -1112,6 +1228,7 @@ function autoDetectEntryPoint(filePath) {
|
|
|
1112
1228
|
try {
|
|
1113
1229
|
const content = readFileSync(fullPath, "utf-8");
|
|
1114
1230
|
if (TAILWIND_SIGNALS.some((signal) => content.includes(signal))) return fullPath;
|
|
1231
|
+
if (hasTailwindSignalInImports(content, dirname(fullPath), TAILWIND_SIGNALS)) return fullPath;
|
|
1115
1232
|
} catch {
|
|
1116
1233
|
continue;
|
|
1117
1234
|
}
|
|
@@ -1298,20 +1415,7 @@ const noDeprecatedClasses = defineRule({
|
|
|
1298
1415
|
}
|
|
1299
1416
|
}
|
|
1300
1417
|
}
|
|
1301
|
-
return
|
|
1302
|
-
JSXAttribute(node) {
|
|
1303
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1304
|
-
},
|
|
1305
|
-
CallExpression(node) {
|
|
1306
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1307
|
-
},
|
|
1308
|
-
TaggedTemplateExpression(node) {
|
|
1309
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1310
|
-
},
|
|
1311
|
-
VariableDeclarator(node) {
|
|
1312
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1313
|
-
}
|
|
1314
|
-
};
|
|
1418
|
+
return createExtractorVisitors(context, check);
|
|
1315
1419
|
}
|
|
1316
1420
|
});
|
|
1317
1421
|
//#endregion
|
|
@@ -1394,20 +1498,7 @@ const noUnknownClasses = defineRule({
|
|
|
1394
1498
|
}
|
|
1395
1499
|
}
|
|
1396
1500
|
}
|
|
1397
|
-
return
|
|
1398
|
-
JSXAttribute(node) {
|
|
1399
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1400
|
-
},
|
|
1401
|
-
CallExpression(node) {
|
|
1402
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1403
|
-
},
|
|
1404
|
-
TaggedTemplateExpression(node) {
|
|
1405
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1406
|
-
},
|
|
1407
|
-
VariableDeclarator(node) {
|
|
1408
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1409
|
-
}
|
|
1410
|
-
};
|
|
1501
|
+
return createExtractorVisitors(context, check);
|
|
1411
1502
|
}
|
|
1412
1503
|
});
|
|
1413
1504
|
//#endregion
|
|
@@ -1451,7 +1542,6 @@ const noConflictingClasses = defineRule({
|
|
|
1451
1542
|
}
|
|
1452
1543
|
const COMPLEMENTARY_GROUPS = [
|
|
1453
1544
|
/^(?:from|via|to)-/,
|
|
1454
|
-
/^(?:shadow|ring|ring-offset)-/,
|
|
1455
1545
|
/^(?:transition|duration|ease|delay)(?:-|$)/,
|
|
1456
1546
|
/^-?(?:translate|scale|rotate|skew)-/,
|
|
1457
1547
|
/^prose(?:-|$)/
|
|
@@ -1462,7 +1552,14 @@ const noConflictingClasses = defineRule({
|
|
|
1462
1552
|
[/^divide-/, /^border(?:-[trblxyse])?-/],
|
|
1463
1553
|
[/^prose(?:-|$)/, /^max-w-/]
|
|
1464
1554
|
];
|
|
1465
|
-
function
|
|
1555
|
+
function isCompositionViaCssVars(propsA, propsB) {
|
|
1556
|
+
const customA = propsA.filter((p) => p.startsWith("--"));
|
|
1557
|
+
const customB = propsB.filter((p) => p.startsWith("--"));
|
|
1558
|
+
if (customA.length === 0 || customB.length === 0) return false;
|
|
1559
|
+
return !customA.some((p) => customB.includes(p));
|
|
1560
|
+
}
|
|
1561
|
+
function shouldSkipPair(a, b, propsA, propsB) {
|
|
1562
|
+
if (isCompositionViaCssVars(propsA, propsB)) return true;
|
|
1466
1563
|
let ua = extractUtility(a);
|
|
1467
1564
|
let ub = extractUtility(b);
|
|
1468
1565
|
if (ua.startsWith("!")) ua = ua.slice(1);
|
|
@@ -1479,7 +1576,7 @@ const noConflictingClasses = defineRule({
|
|
|
1479
1576
|
for (let j = i + 1; j < variantClasses.length; j++) {
|
|
1480
1577
|
const classB = variantClasses[j];
|
|
1481
1578
|
const propsB = propsMap.get(classB) ?? [];
|
|
1482
|
-
if (shouldSkipPair(classA, classB)) continue;
|
|
1579
|
+
if (shouldSkipPair(classA, classB, propsA, propsB)) continue;
|
|
1483
1580
|
const overlap = propsA.filter((p) => propsB.includes(p));
|
|
1484
1581
|
if (overlap.length > 0) {
|
|
1485
1582
|
const propList = overlap.length <= 3 ? `"${overlap.join("\", \"")}"` : `${overlap.length} CSS properties`;
|
|
@@ -1499,20 +1596,7 @@ const noConflictingClasses = defineRule({
|
|
|
1499
1596
|
}
|
|
1500
1597
|
}
|
|
1501
1598
|
}
|
|
1502
|
-
return
|
|
1503
|
-
JSXAttribute(node) {
|
|
1504
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1505
|
-
},
|
|
1506
|
-
CallExpression(node) {
|
|
1507
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1508
|
-
},
|
|
1509
|
-
TaggedTemplateExpression(node) {
|
|
1510
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1511
|
-
},
|
|
1512
|
-
VariableDeclarator(node) {
|
|
1513
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1514
|
-
}
|
|
1515
|
-
};
|
|
1599
|
+
return createExtractorVisitors(context, check);
|
|
1516
1600
|
}
|
|
1517
1601
|
});
|
|
1518
1602
|
//#endregion
|
|
@@ -1568,20 +1652,7 @@ const enforceCanonical = defineRule({
|
|
|
1568
1652
|
}
|
|
1569
1653
|
}
|
|
1570
1654
|
}
|
|
1571
|
-
return
|
|
1572
|
-
JSXAttribute(node) {
|
|
1573
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1574
|
-
},
|
|
1575
|
-
CallExpression(node) {
|
|
1576
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1577
|
-
},
|
|
1578
|
-
TaggedTemplateExpression(node) {
|
|
1579
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1580
|
-
},
|
|
1581
|
-
VariableDeclarator(node) {
|
|
1582
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1583
|
-
}
|
|
1584
|
-
};
|
|
1655
|
+
return createExtractorVisitors(context, check);
|
|
1585
1656
|
}
|
|
1586
1657
|
});
|
|
1587
1658
|
//#endregion
|
|
@@ -1841,20 +1912,7 @@ const enforceSortOrder = defineRule({
|
|
|
1841
1912
|
});
|
|
1842
1913
|
}
|
|
1843
1914
|
}
|
|
1844
|
-
return
|
|
1845
|
-
JSXAttribute(node) {
|
|
1846
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1847
|
-
},
|
|
1848
|
-
CallExpression(node) {
|
|
1849
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1850
|
-
},
|
|
1851
|
-
TaggedTemplateExpression(node) {
|
|
1852
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1853
|
-
},
|
|
1854
|
-
VariableDeclarator(node) {
|
|
1855
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1856
|
-
}
|
|
1857
|
-
};
|
|
1915
|
+
return createExtractorVisitors(context, check);
|
|
1858
1916
|
}
|
|
1859
1917
|
});
|
|
1860
1918
|
//#endregion
|
|
@@ -1971,20 +2029,7 @@ const enforceShorthand = defineRule({
|
|
|
1971
2029
|
}
|
|
1972
2030
|
}
|
|
1973
2031
|
}
|
|
1974
|
-
return
|
|
1975
|
-
JSXAttribute(node) {
|
|
1976
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1977
|
-
},
|
|
1978
|
-
CallExpression(node) {
|
|
1979
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1980
|
-
},
|
|
1981
|
-
TaggedTemplateExpression(node) {
|
|
1982
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1983
|
-
},
|
|
1984
|
-
VariableDeclarator(node) {
|
|
1985
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
1986
|
-
}
|
|
1987
|
-
};
|
|
2032
|
+
return createExtractorVisitors(context, check);
|
|
1988
2033
|
}
|
|
1989
2034
|
});
|
|
1990
2035
|
//#endregion
|
|
@@ -2067,20 +2112,7 @@ const enforceLogical = defineRule({
|
|
|
2067
2112
|
}
|
|
2068
2113
|
}
|
|
2069
2114
|
}
|
|
2070
|
-
return
|
|
2071
|
-
JSXAttribute(node) {
|
|
2072
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2073
|
-
},
|
|
2074
|
-
CallExpression(node) {
|
|
2075
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2076
|
-
},
|
|
2077
|
-
TaggedTemplateExpression(node) {
|
|
2078
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2079
|
-
},
|
|
2080
|
-
VariableDeclarator(node) {
|
|
2081
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2082
|
-
}
|
|
2083
|
-
};
|
|
2115
|
+
return createExtractorVisitors(context, check);
|
|
2084
2116
|
}
|
|
2085
2117
|
});
|
|
2086
2118
|
//#endregion
|
|
@@ -2145,20 +2177,7 @@ const enforcePhysical = defineRule({
|
|
|
2145
2177
|
}
|
|
2146
2178
|
}
|
|
2147
2179
|
}
|
|
2148
|
-
return
|
|
2149
|
-
JSXAttribute(node) {
|
|
2150
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2151
|
-
},
|
|
2152
|
-
CallExpression(node) {
|
|
2153
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2154
|
-
},
|
|
2155
|
-
TaggedTemplateExpression(node) {
|
|
2156
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2157
|
-
},
|
|
2158
|
-
VariableDeclarator(node) {
|
|
2159
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2160
|
-
}
|
|
2161
|
-
};
|
|
2180
|
+
return createExtractorVisitors(context, check);
|
|
2162
2181
|
}
|
|
2163
2182
|
});
|
|
2164
2183
|
//#endregion
|
|
@@ -2195,20 +2214,7 @@ const maxClassCount = defineRule({
|
|
|
2195
2214
|
});
|
|
2196
2215
|
}
|
|
2197
2216
|
}
|
|
2198
|
-
return
|
|
2199
|
-
JSXAttribute(node) {
|
|
2200
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2201
|
-
},
|
|
2202
|
-
CallExpression(node) {
|
|
2203
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2204
|
-
},
|
|
2205
|
-
TaggedTemplateExpression(node) {
|
|
2206
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2207
|
-
},
|
|
2208
|
-
VariableDeclarator(node) {
|
|
2209
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2210
|
-
}
|
|
2211
|
-
};
|
|
2217
|
+
return createExtractorVisitors(context, check);
|
|
2212
2218
|
}
|
|
2213
2219
|
});
|
|
2214
2220
|
//#endregion
|
|
@@ -2292,20 +2298,7 @@ const noRestrictedClasses = defineRule({
|
|
|
2292
2298
|
}
|
|
2293
2299
|
}
|
|
2294
2300
|
}
|
|
2295
|
-
return
|
|
2296
|
-
JSXAttribute(node) {
|
|
2297
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2298
|
-
},
|
|
2299
|
-
CallExpression(node) {
|
|
2300
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2301
|
-
},
|
|
2302
|
-
TaggedTemplateExpression(node) {
|
|
2303
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2304
|
-
},
|
|
2305
|
-
VariableDeclarator(node) {
|
|
2306
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2307
|
-
}
|
|
2308
|
-
};
|
|
2301
|
+
return createExtractorVisitors(context, check);
|
|
2309
2302
|
}
|
|
2310
2303
|
});
|
|
2311
2304
|
//#endregion
|
|
@@ -2350,20 +2343,7 @@ const noArbitraryValue = defineRule({
|
|
|
2350
2343
|
}
|
|
2351
2344
|
}
|
|
2352
2345
|
}
|
|
2353
|
-
return
|
|
2354
|
-
JSXAttribute(node) {
|
|
2355
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2356
|
-
},
|
|
2357
|
-
CallExpression(node) {
|
|
2358
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2359
|
-
},
|
|
2360
|
-
TaggedTemplateExpression(node) {
|
|
2361
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2362
|
-
},
|
|
2363
|
-
VariableDeclarator(node) {
|
|
2364
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2365
|
-
}
|
|
2366
|
-
};
|
|
2346
|
+
return createExtractorVisitors(context, check);
|
|
2367
2347
|
}
|
|
2368
2348
|
});
|
|
2369
2349
|
//#endregion
|
|
@@ -2438,20 +2418,7 @@ const enforceConsistentImportantPosition = defineRule({
|
|
|
2438
2418
|
}
|
|
2439
2419
|
}
|
|
2440
2420
|
}
|
|
2441
|
-
return
|
|
2442
|
-
JSXAttribute(node) {
|
|
2443
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2444
|
-
},
|
|
2445
|
-
CallExpression(node) {
|
|
2446
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2447
|
-
},
|
|
2448
|
-
TaggedTemplateExpression(node) {
|
|
2449
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2450
|
-
},
|
|
2451
|
-
VariableDeclarator(node) {
|
|
2452
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2453
|
-
}
|
|
2454
|
-
};
|
|
2421
|
+
return createExtractorVisitors(context, check);
|
|
2455
2422
|
}
|
|
2456
2423
|
});
|
|
2457
2424
|
//#endregion
|
|
@@ -2522,20 +2489,7 @@ const enforceNegativeArbitraryValues = defineRule({
|
|
|
2522
2489
|
}
|
|
2523
2490
|
}
|
|
2524
2491
|
}
|
|
2525
|
-
return
|
|
2526
|
-
JSXAttribute(node) {
|
|
2527
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2528
|
-
},
|
|
2529
|
-
CallExpression(node) {
|
|
2530
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2531
|
-
},
|
|
2532
|
-
TaggedTemplateExpression(node) {
|
|
2533
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2534
|
-
},
|
|
2535
|
-
VariableDeclarator(node) {
|
|
2536
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2537
|
-
}
|
|
2538
|
-
};
|
|
2492
|
+
return createExtractorVisitors(context, check);
|
|
2539
2493
|
}
|
|
2540
2494
|
});
|
|
2541
2495
|
//#endregion
|
|
@@ -2628,20 +2582,7 @@ const enforceConsistentVariableSyntax = defineRule({
|
|
|
2628
2582
|
}
|
|
2629
2583
|
}
|
|
2630
2584
|
}
|
|
2631
|
-
return
|
|
2632
|
-
JSXAttribute(node) {
|
|
2633
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2634
|
-
},
|
|
2635
|
-
CallExpression(node) {
|
|
2636
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2637
|
-
},
|
|
2638
|
-
TaggedTemplateExpression(node) {
|
|
2639
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2640
|
-
},
|
|
2641
|
-
VariableDeclarator(node) {
|
|
2642
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2643
|
-
}
|
|
2644
|
-
};
|
|
2585
|
+
return createExtractorVisitors(context, check);
|
|
2645
2586
|
}
|
|
2646
2587
|
});
|
|
2647
2588
|
//#endregion
|
|
@@ -2744,20 +2685,7 @@ const noDarkWithoutLight = defineRule({
|
|
|
2744
2685
|
});
|
|
2745
2686
|
}
|
|
2746
2687
|
}
|
|
2747
|
-
return
|
|
2748
|
-
JSXAttribute(node) {
|
|
2749
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2750
|
-
},
|
|
2751
|
-
CallExpression(node) {
|
|
2752
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2753
|
-
},
|
|
2754
|
-
TaggedTemplateExpression(node) {
|
|
2755
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2756
|
-
},
|
|
2757
|
-
VariableDeclarator(node) {
|
|
2758
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2759
|
-
}
|
|
2760
|
-
};
|
|
2688
|
+
return createExtractorVisitors(context, check);
|
|
2761
2689
|
}
|
|
2762
2690
|
});
|
|
2763
2691
|
//#endregion
|
|
@@ -2853,20 +2781,7 @@ const noHardcodedColors = defineRule({
|
|
|
2853
2781
|
}
|
|
2854
2782
|
}
|
|
2855
2783
|
}
|
|
2856
|
-
return
|
|
2857
|
-
JSXAttribute(node) {
|
|
2858
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2859
|
-
},
|
|
2860
|
-
CallExpression(node) {
|
|
2861
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2862
|
-
},
|
|
2863
|
-
TaggedTemplateExpression(node) {
|
|
2864
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2865
|
-
},
|
|
2866
|
-
VariableDeclarator(node) {
|
|
2867
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2868
|
-
}
|
|
2869
|
-
};
|
|
2784
|
+
return createExtractorVisitors(context, check);
|
|
2870
2785
|
}
|
|
2871
2786
|
});
|
|
2872
2787
|
//#endregion
|
|
@@ -2918,20 +2833,7 @@ const noContradictingVariants = defineRule({
|
|
|
2918
2833
|
}
|
|
2919
2834
|
}
|
|
2920
2835
|
}
|
|
2921
|
-
return
|
|
2922
|
-
JSXAttribute(node) {
|
|
2923
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2924
|
-
},
|
|
2925
|
-
CallExpression(node) {
|
|
2926
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2927
|
-
},
|
|
2928
|
-
TaggedTemplateExpression(node) {
|
|
2929
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2930
|
-
},
|
|
2931
|
-
VariableDeclarator(node) {
|
|
2932
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
2933
|
-
}
|
|
2934
|
-
};
|
|
2836
|
+
return createExtractorVisitors(context, check);
|
|
2935
2837
|
}
|
|
2936
2838
|
});
|
|
2937
2839
|
//#endregion
|
|
@@ -3119,20 +3021,7 @@ const consistentVariantOrder = defineRule({
|
|
|
3119
3021
|
}
|
|
3120
3022
|
}
|
|
3121
3023
|
}
|
|
3122
|
-
return
|
|
3123
|
-
JSXAttribute(node) {
|
|
3124
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3125
|
-
},
|
|
3126
|
-
CallExpression(node) {
|
|
3127
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3128
|
-
},
|
|
3129
|
-
TaggedTemplateExpression(node) {
|
|
3130
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3131
|
-
},
|
|
3132
|
-
VariableDeclarator(node) {
|
|
3133
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3134
|
-
}
|
|
3135
|
-
};
|
|
3024
|
+
return createExtractorVisitors(context, check);
|
|
3136
3025
|
}
|
|
3137
3026
|
});
|
|
3138
3027
|
//#endregion
|
|
@@ -3209,20 +3098,7 @@ const enforceConsistentLineWrapping = defineRule({
|
|
|
3209
3098
|
}
|
|
3210
3099
|
}
|
|
3211
3100
|
}
|
|
3212
|
-
return
|
|
3213
|
-
JSXAttribute(node) {
|
|
3214
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3215
|
-
},
|
|
3216
|
-
CallExpression(node) {
|
|
3217
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3218
|
-
},
|
|
3219
|
-
TaggedTemplateExpression(node) {
|
|
3220
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3221
|
-
},
|
|
3222
|
-
VariableDeclarator(node) {
|
|
3223
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3224
|
-
}
|
|
3225
|
-
};
|
|
3101
|
+
return createExtractorVisitors(context, check);
|
|
3226
3102
|
}
|
|
3227
3103
|
});
|
|
3228
3104
|
//#endregion
|
|
@@ -3288,20 +3164,7 @@ const noUnnecessaryArbitraryValue = defineRule({
|
|
|
3288
3164
|
}
|
|
3289
3165
|
}
|
|
3290
3166
|
}
|
|
3291
|
-
return
|
|
3292
|
-
JSXAttribute(node) {
|
|
3293
|
-
check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3294
|
-
},
|
|
3295
|
-
CallExpression(node) {
|
|
3296
|
-
check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3297
|
-
},
|
|
3298
|
-
TaggedTemplateExpression(node) {
|
|
3299
|
-
check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3300
|
-
},
|
|
3301
|
-
VariableDeclarator(node) {
|
|
3302
|
-
check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
|
|
3303
|
-
}
|
|
3304
|
-
};
|
|
3167
|
+
return createExtractorVisitors(context, check);
|
|
3305
3168
|
}
|
|
3306
3169
|
});
|
|
3307
3170
|
//#endregion
|