oxlint-tailwindcss 0.4.0 → 0.4.1
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 +1 -1
- package/dist/index.cjs +17 -20
- package/dist/index.mjs +17 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ assets/{name}.css assets/css/{name}.css resources/css/{name}.css
|
|
|
76
76
|
|
|
77
77
|
Where `{name}` is one of: `app`, `globals`, `global`, `style`, `styles`, `index`, `main`, `tailwind`, `tailwindcss`.
|
|
78
78
|
|
|
79
|
-
The search is monorepo-aware — it stops at `package.json` boundaries so each package resolves its own Tailwind config. If the signal isn't found directly in the CSS file, the auto-detector follows `@import` statements one level deep — supporting both relative paths and package imports (e.g. `@import '@company/theme/tailwind.config.css'`).
|
|
79
|
+
The search is monorepo-aware — it stops at `package.json` boundaries so each package resolves its own Tailwind config. Packages without a Tailwind CSS file are silently skipped (DS-dependent rules produce no diagnostics). If the signal isn't found directly in the CSS file, the auto-detector follows `@import` statements one level deep — supporting both relative paths and package imports (e.g. `@import '@company/theme/tailwind.config.css'`).
|
|
80
80
|
|
|
81
81
|
If auto-detection doesn't find your CSS file, set `entryPoint` once in `settings`:
|
|
82
82
|
|
package/dist/index.cjs
CHANGED
|
@@ -173,6 +173,10 @@ function extractFromClassedCall(node) {
|
|
|
173
173
|
skippedFirst = true;
|
|
174
174
|
continue;
|
|
175
175
|
}
|
|
176
|
+
if (!skippedFirst && arg.type === "TemplateLiteral") {
|
|
177
|
+
skippedFirst = true;
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
176
180
|
skippedFirst = true;
|
|
177
181
|
if (arg.type === "ObjectExpression") results.push(...extractFromCvaConfig(arg));
|
|
178
182
|
else results.push(...extractFromExpression(arg));
|
|
@@ -1257,22 +1261,9 @@ function autoDetectEntryPoint(filePath) {
|
|
|
1257
1261
|
continue;
|
|
1258
1262
|
}
|
|
1259
1263
|
}
|
|
1264
|
+
if ((0, node_fs.existsSync)((0, node_path.join)(currentDir, "package.json"))) break;
|
|
1260
1265
|
const parentDir = (0, node_path.dirname)(currentDir);
|
|
1261
1266
|
if (parentDir === currentDir) break;
|
|
1262
|
-
if (depth > 0 && (0, node_fs.existsSync)((0, node_path.join)(parentDir, "package.json"))) {
|
|
1263
|
-
for (const candidate of CANDIDATE_PATHS) {
|
|
1264
|
-
const fullPath = (0, node_path.join)(parentDir, candidate);
|
|
1265
|
-
if (!(0, node_fs.existsSync)(fullPath)) continue;
|
|
1266
|
-
try {
|
|
1267
|
-
const content = (0, node_fs.readFileSync)(fullPath, "utf-8");
|
|
1268
|
-
if (TAILWIND_SIGNALS.some((signal) => content.includes(signal))) return fullPath;
|
|
1269
|
-
if (hasTailwindSignalInImports(content, (0, node_path.dirname)(fullPath), TAILWIND_SIGNALS)) return fullPath;
|
|
1270
|
-
} catch {
|
|
1271
|
-
continue;
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
break;
|
|
1275
|
-
}
|
|
1276
1267
|
currentDir = parentDir;
|
|
1277
1268
|
}
|
|
1278
1269
|
return null;
|
|
@@ -1326,16 +1317,20 @@ function cachedAutoDetect(filePath) {
|
|
|
1326
1317
|
* Resolution order: rule option `entryPoint` > `settings.tailwindcss.entryPoint` > auto-detect.
|
|
1327
1318
|
*/
|
|
1328
1319
|
function getLoadedDesignSystem(entryPoint, settings, filePath) {
|
|
1329
|
-
const
|
|
1320
|
+
const explicitEntry = entryPoint ?? entryPointFromSettings(settings);
|
|
1321
|
+
const cssPath = explicitEntry ?? cachedAutoDetect(filePath) ?? lastLoadedPath;
|
|
1330
1322
|
if (!cssPath) return null;
|
|
1331
1323
|
const resolvedPath = (0, node_path.resolve)(cssPath);
|
|
1332
1324
|
try {
|
|
1333
1325
|
const mtime = (0, node_fs.statSync)(resolvedPath).mtimeMs;
|
|
1334
1326
|
const cached = dsCache.get(resolvedPath);
|
|
1335
|
-
if (cached && cached.mtime === mtime)
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1327
|
+
if (cached && cached.mtime === mtime) {
|
|
1328
|
+
if (explicitEntry) lastLoadedPath = resolvedPath;
|
|
1329
|
+
return {
|
|
1330
|
+
cache: cached.cache,
|
|
1331
|
+
entryPoint: resolvedPath
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1339
1334
|
const data = loadDesignSystemSync(resolvedPath, timeoutFromSettings(settings));
|
|
1340
1335
|
if (!data) return null;
|
|
1341
1336
|
const cache = DesignSystemCache.fromPrecomputed(data);
|
|
@@ -1343,7 +1338,8 @@ function getLoadedDesignSystem(entryPoint, settings, filePath) {
|
|
|
1343
1338
|
cache,
|
|
1344
1339
|
mtime
|
|
1345
1340
|
});
|
|
1346
|
-
|
|
1341
|
+
console.error(`[oxlint-tailwindcss] Loaded design system from "${resolvedPath}"`);
|
|
1342
|
+
if (explicitEntry) lastLoadedPath = resolvedPath;
|
|
1347
1343
|
return {
|
|
1348
1344
|
cache,
|
|
1349
1345
|
entryPoint: resolvedPath
|
|
@@ -1626,6 +1622,7 @@ const noConflictingClasses = (0, _oxlint_plugins.defineRule)({
|
|
|
1626
1622
|
];
|
|
1627
1623
|
const COMPOSITION_PAIRS = [
|
|
1628
1624
|
[/^text-/, /^leading-/],
|
|
1625
|
+
[/^text-/, /^tracking-/],
|
|
1629
1626
|
[/^border(?:-[0-9]|$)/, /^border-(?:solid|dashed|dotted|double|hidden|none)$/],
|
|
1630
1627
|
[/^divide-/, /^border(?:-[trblxyse])?-/],
|
|
1631
1628
|
[/^prose(?:-|$)/, /^max-w-/]
|
package/dist/index.mjs
CHANGED
|
@@ -177,6 +177,10 @@ function extractFromClassedCall(node) {
|
|
|
177
177
|
skippedFirst = true;
|
|
178
178
|
continue;
|
|
179
179
|
}
|
|
180
|
+
if (!skippedFirst && arg.type === "TemplateLiteral") {
|
|
181
|
+
skippedFirst = true;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
180
184
|
skippedFirst = true;
|
|
181
185
|
if (arg.type === "ObjectExpression") results.push(...extractFromCvaConfig(arg));
|
|
182
186
|
else results.push(...extractFromExpression(arg));
|
|
@@ -1261,22 +1265,9 @@ function autoDetectEntryPoint(filePath) {
|
|
|
1261
1265
|
continue;
|
|
1262
1266
|
}
|
|
1263
1267
|
}
|
|
1268
|
+
if (existsSync(join(currentDir, "package.json"))) break;
|
|
1264
1269
|
const parentDir = dirname(currentDir);
|
|
1265
1270
|
if (parentDir === currentDir) break;
|
|
1266
|
-
if (depth > 0 && existsSync(join(parentDir, "package.json"))) {
|
|
1267
|
-
for (const candidate of CANDIDATE_PATHS) {
|
|
1268
|
-
const fullPath = join(parentDir, candidate);
|
|
1269
|
-
if (!existsSync(fullPath)) continue;
|
|
1270
|
-
try {
|
|
1271
|
-
const content = readFileSync(fullPath, "utf-8");
|
|
1272
|
-
if (TAILWIND_SIGNALS.some((signal) => content.includes(signal))) return fullPath;
|
|
1273
|
-
if (hasTailwindSignalInImports(content, dirname(fullPath), TAILWIND_SIGNALS)) return fullPath;
|
|
1274
|
-
} catch {
|
|
1275
|
-
continue;
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
break;
|
|
1279
|
-
}
|
|
1280
1271
|
currentDir = parentDir;
|
|
1281
1272
|
}
|
|
1282
1273
|
return null;
|
|
@@ -1330,16 +1321,20 @@ function cachedAutoDetect(filePath) {
|
|
|
1330
1321
|
* Resolution order: rule option `entryPoint` > `settings.tailwindcss.entryPoint` > auto-detect.
|
|
1331
1322
|
*/
|
|
1332
1323
|
function getLoadedDesignSystem(entryPoint, settings, filePath) {
|
|
1333
|
-
const
|
|
1324
|
+
const explicitEntry = entryPoint ?? entryPointFromSettings(settings);
|
|
1325
|
+
const cssPath = explicitEntry ?? cachedAutoDetect(filePath) ?? lastLoadedPath;
|
|
1334
1326
|
if (!cssPath) return null;
|
|
1335
1327
|
const resolvedPath = resolve(cssPath);
|
|
1336
1328
|
try {
|
|
1337
1329
|
const mtime = statSync(resolvedPath).mtimeMs;
|
|
1338
1330
|
const cached = dsCache.get(resolvedPath);
|
|
1339
|
-
if (cached && cached.mtime === mtime)
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1331
|
+
if (cached && cached.mtime === mtime) {
|
|
1332
|
+
if (explicitEntry) lastLoadedPath = resolvedPath;
|
|
1333
|
+
return {
|
|
1334
|
+
cache: cached.cache,
|
|
1335
|
+
entryPoint: resolvedPath
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1343
1338
|
const data = loadDesignSystemSync(resolvedPath, timeoutFromSettings(settings));
|
|
1344
1339
|
if (!data) return null;
|
|
1345
1340
|
const cache = DesignSystemCache.fromPrecomputed(data);
|
|
@@ -1347,7 +1342,8 @@ function getLoadedDesignSystem(entryPoint, settings, filePath) {
|
|
|
1347
1342
|
cache,
|
|
1348
1343
|
mtime
|
|
1349
1344
|
});
|
|
1350
|
-
|
|
1345
|
+
console.error(`[oxlint-tailwindcss] Loaded design system from "${resolvedPath}"`);
|
|
1346
|
+
if (explicitEntry) lastLoadedPath = resolvedPath;
|
|
1351
1347
|
return {
|
|
1352
1348
|
cache,
|
|
1353
1349
|
entryPoint: resolvedPath
|
|
@@ -1630,6 +1626,7 @@ const noConflictingClasses = defineRule({
|
|
|
1630
1626
|
];
|
|
1631
1627
|
const COMPOSITION_PAIRS = [
|
|
1632
1628
|
[/^text-/, /^leading-/],
|
|
1629
|
+
[/^text-/, /^tracking-/],
|
|
1633
1630
|
[/^border(?:-[0-9]|$)/, /^border-(?:solid|dashed|dotted|double|hidden|none)$/],
|
|
1634
1631
|
[/^divide-/, /^border(?:-[trblxyse])?-/],
|
|
1635
1632
|
[/^prose(?:-|$)/, /^max-w-/]
|