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/dist/index.cjs CHANGED
@@ -30,7 +30,8 @@ const DEFAULT_EXTRACTOR_CONFIG = {
30
30
  "cc",
31
31
  "clb",
32
32
  "cnb",
33
- "objstr"
33
+ "objstr",
34
+ "classed"
34
35
  ],
35
36
  tags: ["tw"],
36
37
  variablePatterns: [
@@ -39,6 +40,69 @@ const DEFAULT_EXTRACTOR_CONFIG = {
39
40
  /^styles?$/
40
41
  ]
41
42
  };
43
+ let _cachedConfig = null;
44
+ let _settingsResolved = false;
45
+ function mergeUnique(defaults, extras, exclusions) {
46
+ let base = defaults;
47
+ if (exclusions && exclusions.length > 0) {
48
+ const excludeSet = new Set(exclusions);
49
+ base = base.filter((d) => !excludeSet.has(d));
50
+ }
51
+ if (!extras || extras.length === 0) return base;
52
+ const set = new Set(base);
53
+ for (const e of extras) set.add(e);
54
+ return [...set];
55
+ }
56
+ /**
57
+ * Returns the extractor config, merging defaults with user settings from
58
+ * `settings.tailwindcss`. Caches after the first successful settings read.
59
+ * Falls back to DEFAULT_EXTRACTOR_CONFIG if settings are unavailable.
60
+ */
61
+ function getExtractorConfig(context) {
62
+ if (_settingsResolved) return _cachedConfig;
63
+ let tw;
64
+ try {
65
+ const raw = context.settings?.tailwindcss;
66
+ if (raw && typeof raw === "object") tw = raw;
67
+ _settingsResolved = true;
68
+ } catch {
69
+ return DEFAULT_EXTRACTOR_CONFIG;
70
+ }
71
+ if (!tw) {
72
+ _cachedConfig = DEFAULT_EXTRACTOR_CONFIG;
73
+ return _cachedConfig;
74
+ }
75
+ const exclude = tw.exclude;
76
+ const excludedPatternSources = new Set(exclude?.variablePatterns ?? []);
77
+ const filteredPatterns = excludedPatternSources.size > 0 ? DEFAULT_EXTRACTOR_CONFIG.variablePatterns.filter((re) => !excludedPatternSources.has(re.source)) : DEFAULT_EXTRACTOR_CONFIG.variablePatterns;
78
+ _cachedConfig = {
79
+ attributes: mergeUnique(DEFAULT_EXTRACTOR_CONFIG.attributes, tw.attributes, exclude?.attributes),
80
+ callees: mergeUnique(DEFAULT_EXTRACTOR_CONFIG.callees, tw.callees, exclude?.callees),
81
+ tags: mergeUnique(DEFAULT_EXTRACTOR_CONFIG.tags, tw.tags, exclude?.tags),
82
+ variablePatterns: [...filteredPatterns, ...(tw.variablePatterns ?? []).map((p) => new RegExp(p))]
83
+ };
84
+ return _cachedConfig;
85
+ }
86
+ /**
87
+ * Creates the 4 standard AST visitor callbacks that all rules use.
88
+ * Resolves extractor config lazily from context.settings on first visitor call.
89
+ */
90
+ function createExtractorVisitors(context, check) {
91
+ return {
92
+ JSXAttribute(node) {
93
+ check(extractFromJSXAttribute(node, getExtractorConfig(context)));
94
+ },
95
+ CallExpression(node) {
96
+ check(extractFromCallExpression(node, getExtractorConfig(context)));
97
+ },
98
+ TaggedTemplateExpression(node) {
99
+ check(extractFromTaggedTemplate(node, getExtractorConfig(context)));
100
+ },
101
+ VariableDeclarator(node) {
102
+ check(extractFromVariableDeclarator(node, getExtractorConfig(context)));
103
+ }
104
+ };
105
+ }
42
106
  /**
43
107
  * Extracts class locations from a JSXAttribute node.
44
108
  * Handles: className="...", className={`...`}, className={cond ? "..." : "..."}
@@ -52,7 +116,11 @@ function extractFromJSXAttribute(node, config = DEFAULT_EXTRACTOR_CONFIG) {
52
116
  node: node.value,
53
117
  range: [node.value.range[0] + 1, node.value.range[1] - 1]
54
118
  }];
55
- if (node.value.type === "JSXExpressionContainer") return extractFromExpression(node.value.expression);
119
+ if (node.value.type === "JSXExpressionContainer") {
120
+ const expr = node.value.expression;
121
+ if (expr.type === "ObjectExpression") return extractObjectValues(expr);
122
+ return extractFromExpression(expr);
123
+ }
56
124
  return [];
57
125
  }
58
126
  /**
@@ -64,6 +132,7 @@ function extractFromCallExpression(node, config = DEFAULT_EXTRACTOR_CONFIG) {
64
132
  if (!calleeName || !config.callees.includes(calleeName)) return [];
65
133
  if (calleeName === "cva") return extractFromCvaCall(node);
66
134
  if (calleeName === "tv") return extractFromTvCall(node);
135
+ if (calleeName === "classed") return extractFromClassedCall(node);
67
136
  const results = [];
68
137
  for (const arg of node.arguments) results.push(...extractFromExpression(arg));
69
138
  return results;
@@ -77,6 +146,40 @@ function extractFromTaggedTemplate(node, config = DEFAULT_EXTRACTOR_CONFIG) {
77
146
  return extractFromTemplateLiteral(node.quasi);
78
147
  }
79
148
  /**
149
+ * Extracts class string values from an ObjectExpression in a JSX attribute.
150
+ * For: classNames={{ root: "flex flex-col", label: "text-sm" }}
151
+ * Recurses into each property value via extractFromExpression.
152
+ */
153
+ function extractObjectValues(node) {
154
+ const results = [];
155
+ for (const prop of node.properties) if (prop.type === "Property") results.push(...extractFromExpression(prop.value));
156
+ return results;
157
+ }
158
+ /**
159
+ * Extracts class locations from a classed() call (tw-classed).
160
+ * First string argument is the element type (skipped), rest are class strings
161
+ * or cva-like config objects.
162
+ * classed("button", "flex items-center", { variants: { ... } })
163
+ */
164
+ function extractFromClassedCall(node) {
165
+ const results = [];
166
+ let skippedFirst = false;
167
+ for (const arg of node.arguments) {
168
+ if (!skippedFirst && arg.type === "Literal" && typeof arg.value === "string") {
169
+ skippedFirst = true;
170
+ continue;
171
+ }
172
+ if (!skippedFirst && arg.type === "Identifier") {
173
+ skippedFirst = true;
174
+ continue;
175
+ }
176
+ skippedFirst = true;
177
+ if (arg.type === "ObjectExpression") results.push(...extractFromCvaConfig(arg));
178
+ else results.push(...extractFromExpression(arg));
179
+ }
180
+ return results;
181
+ }
182
+ /**
80
183
  * Extracts class locations from a cva() call.
81
184
  * Handles: base string, variants config, compoundVariants.
82
185
  */
@@ -287,20 +390,7 @@ const noDuplicateClasses = (0, _oxlint_plugins.defineRule)({
287
390
  }
288
391
  }
289
392
  }
290
- return {
291
- JSXAttribute(node) {
292
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
293
- },
294
- CallExpression(node) {
295
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
296
- },
297
- TaggedTemplateExpression(node) {
298
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
299
- },
300
- VariableDeclarator(node) {
301
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
302
- }
303
- };
393
+ return createExtractorVisitors(context, check);
304
394
  }
305
395
  });
306
396
  //#endregion
@@ -328,20 +418,7 @@ const noUnnecessaryWhitespace = (0, _oxlint_plugins.defineRule)({
328
418
  });
329
419
  }
330
420
  }
331
- return {
332
- JSXAttribute(node) {
333
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
334
- },
335
- CallExpression(node) {
336
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
337
- },
338
- TaggedTemplateExpression(node) {
339
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
340
- },
341
- VariableDeclarator(node) {
342
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
343
- }
344
- };
421
+ return createExtractorVisitors(context, check);
345
422
  }
346
423
  });
347
424
  //#endregion
@@ -1053,6 +1130,44 @@ function loadDesignSystemSync(cssPath) {
1053
1130
  }
1054
1131
  //#endregion
1055
1132
  //#region src/design-system/auto-detect.ts
1133
+ const IMPORT_RE = /@import\s+['"]([^'"]+)['"]/g;
1134
+ /**
1135
+ * Resolves a CSS @import specifier to an absolute path.
1136
+ * Handles relative paths and package imports (walks up to node_modules).
1137
+ */
1138
+ function resolveImport(specifier, baseDir) {
1139
+ if (specifier.startsWith(".")) return (0, node_path.resolve)(baseDir, specifier);
1140
+ let dir = baseDir;
1141
+ while (true) {
1142
+ const candidate = (0, node_path.join)(dir, "node_modules", specifier);
1143
+ if ((0, node_fs.existsSync)(candidate)) return candidate;
1144
+ const parent = (0, node_path.dirname)(dir);
1145
+ if (parent === dir) break;
1146
+ dir = parent;
1147
+ }
1148
+ return null;
1149
+ }
1150
+ /**
1151
+ * Checks if any @import in the CSS content points to a file containing a Tailwind signal.
1152
+ * Only follows ONE level of imports — no recursion.
1153
+ */
1154
+ function hasTailwindSignalInImports(content, baseDir, signals) {
1155
+ IMPORT_RE.lastIndex = 0;
1156
+ let match;
1157
+ while ((match = IMPORT_RE.exec(content)) !== null) {
1158
+ const specifier = match[1];
1159
+ if (specifier === "tailwindcss") continue;
1160
+ const resolved = resolveImport(specifier, baseDir);
1161
+ if (!resolved) continue;
1162
+ try {
1163
+ const imported = (0, node_fs.readFileSync)(resolved, "utf-8");
1164
+ if (signals.some((signal) => imported.includes(signal))) return true;
1165
+ } catch {
1166
+ continue;
1167
+ }
1168
+ }
1169
+ return false;
1170
+ }
1056
1171
  const CANDIDATE_DIRS = [
1057
1172
  "src",
1058
1173
  ".",
@@ -1095,6 +1210,7 @@ function autoDetectEntryPoint(filePath) {
1095
1210
  try {
1096
1211
  const content = (0, node_fs.readFileSync)(fullPath, "utf-8");
1097
1212
  if (TAILWIND_SIGNALS.some((signal) => content.includes(signal))) return fullPath;
1213
+ if (hasTailwindSignalInImports(content, (0, node_path.dirname)(fullPath), TAILWIND_SIGNALS)) return fullPath;
1098
1214
  } catch {
1099
1215
  continue;
1100
1216
  }
@@ -1108,6 +1224,7 @@ function autoDetectEntryPoint(filePath) {
1108
1224
  try {
1109
1225
  const content = (0, node_fs.readFileSync)(fullPath, "utf-8");
1110
1226
  if (TAILWIND_SIGNALS.some((signal) => content.includes(signal))) return fullPath;
1227
+ if (hasTailwindSignalInImports(content, (0, node_path.dirname)(fullPath), TAILWIND_SIGNALS)) return fullPath;
1111
1228
  } catch {
1112
1229
  continue;
1113
1230
  }
@@ -1294,20 +1411,7 @@ const noDeprecatedClasses = (0, _oxlint_plugins.defineRule)({
1294
1411
  }
1295
1412
  }
1296
1413
  }
1297
- return {
1298
- JSXAttribute(node) {
1299
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
1300
- },
1301
- CallExpression(node) {
1302
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
1303
- },
1304
- TaggedTemplateExpression(node) {
1305
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
1306
- },
1307
- VariableDeclarator(node) {
1308
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
1309
- }
1310
- };
1414
+ return createExtractorVisitors(context, check);
1311
1415
  }
1312
1416
  });
1313
1417
  //#endregion
@@ -1390,20 +1494,7 @@ const noUnknownClasses = (0, _oxlint_plugins.defineRule)({
1390
1494
  }
1391
1495
  }
1392
1496
  }
1393
- return {
1394
- JSXAttribute(node) {
1395
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
1396
- },
1397
- CallExpression(node) {
1398
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
1399
- },
1400
- TaggedTemplateExpression(node) {
1401
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
1402
- },
1403
- VariableDeclarator(node) {
1404
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
1405
- }
1406
- };
1497
+ return createExtractorVisitors(context, check);
1407
1498
  }
1408
1499
  });
1409
1500
  //#endregion
@@ -1447,7 +1538,6 @@ const noConflictingClasses = (0, _oxlint_plugins.defineRule)({
1447
1538
  }
1448
1539
  const COMPLEMENTARY_GROUPS = [
1449
1540
  /^(?:from|via|to)-/,
1450
- /^(?:shadow|ring|ring-offset)-/,
1451
1541
  /^(?:transition|duration|ease|delay)(?:-|$)/,
1452
1542
  /^-?(?:translate|scale|rotate|skew)-/,
1453
1543
  /^prose(?:-|$)/
@@ -1458,7 +1548,14 @@ const noConflictingClasses = (0, _oxlint_plugins.defineRule)({
1458
1548
  [/^divide-/, /^border(?:-[trblxyse])?-/],
1459
1549
  [/^prose(?:-|$)/, /^max-w-/]
1460
1550
  ];
1461
- function shouldSkipPair(a, b) {
1551
+ function isCompositionViaCssVars(propsA, propsB) {
1552
+ const customA = propsA.filter((p) => p.startsWith("--"));
1553
+ const customB = propsB.filter((p) => p.startsWith("--"));
1554
+ if (customA.length === 0 || customB.length === 0) return false;
1555
+ return !customA.some((p) => customB.includes(p));
1556
+ }
1557
+ function shouldSkipPair(a, b, propsA, propsB) {
1558
+ if (isCompositionViaCssVars(propsA, propsB)) return true;
1462
1559
  let ua = extractUtility(a);
1463
1560
  let ub = extractUtility(b);
1464
1561
  if (ua.startsWith("!")) ua = ua.slice(1);
@@ -1475,7 +1572,7 @@ const noConflictingClasses = (0, _oxlint_plugins.defineRule)({
1475
1572
  for (let j = i + 1; j < variantClasses.length; j++) {
1476
1573
  const classB = variantClasses[j];
1477
1574
  const propsB = propsMap.get(classB) ?? [];
1478
- if (shouldSkipPair(classA, classB)) continue;
1575
+ if (shouldSkipPair(classA, classB, propsA, propsB)) continue;
1479
1576
  const overlap = propsA.filter((p) => propsB.includes(p));
1480
1577
  if (overlap.length > 0) {
1481
1578
  const propList = overlap.length <= 3 ? `"${overlap.join("\", \"")}"` : `${overlap.length} CSS properties`;
@@ -1495,20 +1592,7 @@ const noConflictingClasses = (0, _oxlint_plugins.defineRule)({
1495
1592
  }
1496
1593
  }
1497
1594
  }
1498
- return {
1499
- JSXAttribute(node) {
1500
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
1501
- },
1502
- CallExpression(node) {
1503
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
1504
- },
1505
- TaggedTemplateExpression(node) {
1506
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
1507
- },
1508
- VariableDeclarator(node) {
1509
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
1510
- }
1511
- };
1595
+ return createExtractorVisitors(context, check);
1512
1596
  }
1513
1597
  });
1514
1598
  //#endregion
@@ -1564,20 +1648,7 @@ const enforceCanonical = (0, _oxlint_plugins.defineRule)({
1564
1648
  }
1565
1649
  }
1566
1650
  }
1567
- return {
1568
- JSXAttribute(node) {
1569
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
1570
- },
1571
- CallExpression(node) {
1572
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
1573
- },
1574
- TaggedTemplateExpression(node) {
1575
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
1576
- },
1577
- VariableDeclarator(node) {
1578
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
1579
- }
1580
- };
1651
+ return createExtractorVisitors(context, check);
1581
1652
  }
1582
1653
  });
1583
1654
  //#endregion
@@ -1837,20 +1908,7 @@ const enforceSortOrder = (0, _oxlint_plugins.defineRule)({
1837
1908
  });
1838
1909
  }
1839
1910
  }
1840
- return {
1841
- JSXAttribute(node) {
1842
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
1843
- },
1844
- CallExpression(node) {
1845
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
1846
- },
1847
- TaggedTemplateExpression(node) {
1848
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
1849
- },
1850
- VariableDeclarator(node) {
1851
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
1852
- }
1853
- };
1911
+ return createExtractorVisitors(context, check);
1854
1912
  }
1855
1913
  });
1856
1914
  //#endregion
@@ -1967,20 +2025,7 @@ const enforceShorthand = (0, _oxlint_plugins.defineRule)({
1967
2025
  }
1968
2026
  }
1969
2027
  }
1970
- return {
1971
- JSXAttribute(node) {
1972
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
1973
- },
1974
- CallExpression(node) {
1975
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
1976
- },
1977
- TaggedTemplateExpression(node) {
1978
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
1979
- },
1980
- VariableDeclarator(node) {
1981
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
1982
- }
1983
- };
2028
+ return createExtractorVisitors(context, check);
1984
2029
  }
1985
2030
  });
1986
2031
  //#endregion
@@ -2063,20 +2108,7 @@ const enforceLogical = (0, _oxlint_plugins.defineRule)({
2063
2108
  }
2064
2109
  }
2065
2110
  }
2066
- return {
2067
- JSXAttribute(node) {
2068
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2069
- },
2070
- CallExpression(node) {
2071
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2072
- },
2073
- TaggedTemplateExpression(node) {
2074
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2075
- },
2076
- VariableDeclarator(node) {
2077
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2078
- }
2079
- };
2111
+ return createExtractorVisitors(context, check);
2080
2112
  }
2081
2113
  });
2082
2114
  //#endregion
@@ -2141,20 +2173,7 @@ const enforcePhysical = (0, _oxlint_plugins.defineRule)({
2141
2173
  }
2142
2174
  }
2143
2175
  }
2144
- return {
2145
- JSXAttribute(node) {
2146
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2147
- },
2148
- CallExpression(node) {
2149
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2150
- },
2151
- TaggedTemplateExpression(node) {
2152
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2153
- },
2154
- VariableDeclarator(node) {
2155
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2156
- }
2157
- };
2176
+ return createExtractorVisitors(context, check);
2158
2177
  }
2159
2178
  });
2160
2179
  //#endregion
@@ -2191,20 +2210,7 @@ const maxClassCount = (0, _oxlint_plugins.defineRule)({
2191
2210
  });
2192
2211
  }
2193
2212
  }
2194
- return {
2195
- JSXAttribute(node) {
2196
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2197
- },
2198
- CallExpression(node) {
2199
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2200
- },
2201
- TaggedTemplateExpression(node) {
2202
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2203
- },
2204
- VariableDeclarator(node) {
2205
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2206
- }
2207
- };
2213
+ return createExtractorVisitors(context, check);
2208
2214
  }
2209
2215
  });
2210
2216
  //#endregion
@@ -2288,20 +2294,7 @@ const noRestrictedClasses = (0, _oxlint_plugins.defineRule)({
2288
2294
  }
2289
2295
  }
2290
2296
  }
2291
- return {
2292
- JSXAttribute(node) {
2293
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2294
- },
2295
- CallExpression(node) {
2296
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2297
- },
2298
- TaggedTemplateExpression(node) {
2299
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2300
- },
2301
- VariableDeclarator(node) {
2302
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2303
- }
2304
- };
2297
+ return createExtractorVisitors(context, check);
2305
2298
  }
2306
2299
  });
2307
2300
  //#endregion
@@ -2346,20 +2339,7 @@ const noArbitraryValue = (0, _oxlint_plugins.defineRule)({
2346
2339
  }
2347
2340
  }
2348
2341
  }
2349
- return {
2350
- JSXAttribute(node) {
2351
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2352
- },
2353
- CallExpression(node) {
2354
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2355
- },
2356
- TaggedTemplateExpression(node) {
2357
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2358
- },
2359
- VariableDeclarator(node) {
2360
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2361
- }
2362
- };
2342
+ return createExtractorVisitors(context, check);
2363
2343
  }
2364
2344
  });
2365
2345
  //#endregion
@@ -2434,20 +2414,7 @@ const enforceConsistentImportantPosition = (0, _oxlint_plugins.defineRule)({
2434
2414
  }
2435
2415
  }
2436
2416
  }
2437
- return {
2438
- JSXAttribute(node) {
2439
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2440
- },
2441
- CallExpression(node) {
2442
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2443
- },
2444
- TaggedTemplateExpression(node) {
2445
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2446
- },
2447
- VariableDeclarator(node) {
2448
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2449
- }
2450
- };
2417
+ return createExtractorVisitors(context, check);
2451
2418
  }
2452
2419
  });
2453
2420
  //#endregion
@@ -2518,20 +2485,7 @@ const enforceNegativeArbitraryValues = (0, _oxlint_plugins.defineRule)({
2518
2485
  }
2519
2486
  }
2520
2487
  }
2521
- return {
2522
- JSXAttribute(node) {
2523
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2524
- },
2525
- CallExpression(node) {
2526
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2527
- },
2528
- TaggedTemplateExpression(node) {
2529
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2530
- },
2531
- VariableDeclarator(node) {
2532
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2533
- }
2534
- };
2488
+ return createExtractorVisitors(context, check);
2535
2489
  }
2536
2490
  });
2537
2491
  //#endregion
@@ -2624,20 +2578,7 @@ const enforceConsistentVariableSyntax = (0, _oxlint_plugins.defineRule)({
2624
2578
  }
2625
2579
  }
2626
2580
  }
2627
- return {
2628
- JSXAttribute(node) {
2629
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2630
- },
2631
- CallExpression(node) {
2632
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2633
- },
2634
- TaggedTemplateExpression(node) {
2635
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2636
- },
2637
- VariableDeclarator(node) {
2638
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2639
- }
2640
- };
2581
+ return createExtractorVisitors(context, check);
2641
2582
  }
2642
2583
  });
2643
2584
  //#endregion
@@ -2740,20 +2681,7 @@ const noDarkWithoutLight = (0, _oxlint_plugins.defineRule)({
2740
2681
  });
2741
2682
  }
2742
2683
  }
2743
- return {
2744
- JSXAttribute(node) {
2745
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2746
- },
2747
- CallExpression(node) {
2748
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2749
- },
2750
- TaggedTemplateExpression(node) {
2751
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2752
- },
2753
- VariableDeclarator(node) {
2754
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2755
- }
2756
- };
2684
+ return createExtractorVisitors(context, check);
2757
2685
  }
2758
2686
  });
2759
2687
  //#endregion
@@ -2849,20 +2777,7 @@ const noHardcodedColors = (0, _oxlint_plugins.defineRule)({
2849
2777
  }
2850
2778
  }
2851
2779
  }
2852
- return {
2853
- JSXAttribute(node) {
2854
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2855
- },
2856
- CallExpression(node) {
2857
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2858
- },
2859
- TaggedTemplateExpression(node) {
2860
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2861
- },
2862
- VariableDeclarator(node) {
2863
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2864
- }
2865
- };
2780
+ return createExtractorVisitors(context, check);
2866
2781
  }
2867
2782
  });
2868
2783
  //#endregion
@@ -2914,20 +2829,7 @@ const noContradictingVariants = (0, _oxlint_plugins.defineRule)({
2914
2829
  }
2915
2830
  }
2916
2831
  }
2917
- return {
2918
- JSXAttribute(node) {
2919
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
2920
- },
2921
- CallExpression(node) {
2922
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
2923
- },
2924
- TaggedTemplateExpression(node) {
2925
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
2926
- },
2927
- VariableDeclarator(node) {
2928
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
2929
- }
2930
- };
2832
+ return createExtractorVisitors(context, check);
2931
2833
  }
2932
2834
  });
2933
2835
  //#endregion
@@ -3115,20 +3017,7 @@ const consistentVariantOrder = (0, _oxlint_plugins.defineRule)({
3115
3017
  }
3116
3018
  }
3117
3019
  }
3118
- return {
3119
- JSXAttribute(node) {
3120
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
3121
- },
3122
- CallExpression(node) {
3123
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
3124
- },
3125
- TaggedTemplateExpression(node) {
3126
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
3127
- },
3128
- VariableDeclarator(node) {
3129
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
3130
- }
3131
- };
3020
+ return createExtractorVisitors(context, check);
3132
3021
  }
3133
3022
  });
3134
3023
  //#endregion
@@ -3205,20 +3094,7 @@ const enforceConsistentLineWrapping = (0, _oxlint_plugins.defineRule)({
3205
3094
  }
3206
3095
  }
3207
3096
  }
3208
- return {
3209
- JSXAttribute(node) {
3210
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
3211
- },
3212
- CallExpression(node) {
3213
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
3214
- },
3215
- TaggedTemplateExpression(node) {
3216
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
3217
- },
3218
- VariableDeclarator(node) {
3219
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
3220
- }
3221
- };
3097
+ return createExtractorVisitors(context, check);
3222
3098
  }
3223
3099
  });
3224
3100
  //#endregion
@@ -3284,20 +3160,7 @@ const noUnnecessaryArbitraryValue = (0, _oxlint_plugins.defineRule)({
3284
3160
  }
3285
3161
  }
3286
3162
  }
3287
- return {
3288
- JSXAttribute(node) {
3289
- check(extractFromJSXAttribute(node, DEFAULT_EXTRACTOR_CONFIG));
3290
- },
3291
- CallExpression(node) {
3292
- check(extractFromCallExpression(node, DEFAULT_EXTRACTOR_CONFIG));
3293
- },
3294
- TaggedTemplateExpression(node) {
3295
- check(extractFromTaggedTemplate(node, DEFAULT_EXTRACTOR_CONFIG));
3296
- },
3297
- VariableDeclarator(node) {
3298
- check(extractFromVariableDeclarator(node, DEFAULT_EXTRACTOR_CONFIG));
3299
- }
3300
- };
3163
+ return createExtractorVisitors(context, check);
3301
3164
  }
3302
3165
  });
3303
3166
  //#endregion