tailwind-lint 0.10.0 → 0.10.2
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 +2 -2
- package/dist/cli.cjs +1 -1
- package/dist/{linter-CQy2hg_B.cjs → linter-ChZk2xMs.cjs} +12 -7
- package/dist/linter.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ tailwind-lint --verbose
|
|
|
50
50
|
**Tailwind CSS v4:**
|
|
51
51
|
|
|
52
52
|
- Finds CSS config files in common locations: `app.css`, `index.css`, `tailwind.css`, `global.css`, etc.
|
|
53
|
-
- Searches in project root and subdirectories: `./`, `./src/`, `./src/styles/`, `./app/`,
|
|
53
|
+
- Searches in project root and subdirectories: `./`, `./src/`, `./src/styles/`, `./app/`, etc.
|
|
54
54
|
- Detects `vite.config.*` files that use `@tailwindcss/vite`
|
|
55
55
|
- Prefers real CSS configs when present, so custom `@theme` tokens and `@source` directives are available to diagnostics
|
|
56
56
|
- Uses file patterns from `@source` directives if present
|
|
@@ -145,7 +145,7 @@ export default defineConfig({
|
|
|
145
145
|
});
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
If a real CSS config is also present,
|
|
148
|
+
If a real CSS config is also present, the CLI uses that file so custom `@theme` tokens and `@source` directives are available to diagnostics.
|
|
149
149
|
|
|
150
150
|
### Tailwind CSS v3 (Legacy)
|
|
151
151
|
|
package/dist/cli.cjs
CHANGED
|
@@ -80,8 +80,7 @@ const V4_CSS_FOLDERS = [
|
|
|
80
80
|
"./style/",
|
|
81
81
|
"./styles/",
|
|
82
82
|
"./assets/css/",
|
|
83
|
-
"./resources/css/"
|
|
84
|
-
"./.ladle/"
|
|
83
|
+
"./resources/css/"
|
|
85
84
|
];
|
|
86
85
|
const VITE_CONFIG_PATHS = [
|
|
87
86
|
"vite.config.js",
|
|
@@ -700,6 +699,11 @@ async function discoverFilesFromConfig(cwd, configPath) {
|
|
|
700
699
|
}
|
|
701
700
|
const configDir = node_path.dirname(configFilePath);
|
|
702
701
|
const cssContent = fileExists(configFilePath) ? readFileSync(configFilePath) : SYNTHETIC_VITE_CSS_CONFIG_CONTENT;
|
|
702
|
+
const includeConfigFile = (files) => {
|
|
703
|
+
if (!fileExists(configFilePath)) return files;
|
|
704
|
+
const relativeConfigPath = node_path.relative(cwd, configFilePath);
|
|
705
|
+
return [...new Set([relativeConfigPath, ...files])].sort((a, b) => a.localeCompare(b));
|
|
706
|
+
};
|
|
703
707
|
const { include, exclude } = extractSourcePatterns(cssContent);
|
|
704
708
|
const importSource = extractImportSourceDirectives(cssContent);
|
|
705
709
|
const resolveFromConfig = (pattern) => {
|
|
@@ -709,10 +713,10 @@ async function discoverFilesFromConfig(cwd, configPath) {
|
|
|
709
713
|
const resolvedExclude = exclude.map(resolveFromConfig);
|
|
710
714
|
const gitignorePatterns = readGitignorePatterns(cwd);
|
|
711
715
|
const extraIgnore = [...resolvedExclude, ...gitignorePatterns];
|
|
712
|
-
if (include.length > 0) return expandPatterns(cwd, include.map(resolveFromConfig), extraIgnore);
|
|
713
|
-
if (importSource.roots.length > 0) return expandPatterns(cwd, importSource.roots.map((root) => resolveFromConfig(node_path.join(root, "**/*.{js,jsx,ts,tsx,html,vue,svelte,astro,mdx}"))), extraIgnore);
|
|
714
|
-
if (importSource.disableAutoSource) return [];
|
|
715
|
-
return expandPatterns(cwd, [DEFAULT_FILE_PATTERN], extraIgnore);
|
|
716
|
+
if (include.length > 0) return includeConfigFile(await expandPatterns(cwd, include.map(resolveFromConfig), extraIgnore));
|
|
717
|
+
if (importSource.roots.length > 0) return includeConfigFile(await expandPatterns(cwd, importSource.roots.map((root) => resolveFromConfig(node_path.join(root, "**/*.{js,jsx,ts,tsx,html,vue,svelte,astro,mdx}"))), extraIgnore));
|
|
718
|
+
if (importSource.disableAutoSource) return includeConfigFile([]);
|
|
719
|
+
return includeConfigFile(await expandPatterns(cwd, [DEFAULT_FILE_PATTERN], extraIgnore));
|
|
716
720
|
}
|
|
717
721
|
function extractContentPatterns(config) {
|
|
718
722
|
if (!config.content) return [];
|
|
@@ -796,7 +800,8 @@ async function initializeState(cwd, configPath, verbose = false) {
|
|
|
796
800
|
}
|
|
797
801
|
async function lint({ cwd, patterns, configPath, autoDiscover, fix = false, verbose = false, onProgress }) {
|
|
798
802
|
const state = await initializeState(cwd, configPath, verbose);
|
|
799
|
-
const
|
|
803
|
+
const discoveredFiles = await discoverFiles(cwd, patterns, configPath, autoDiscover);
|
|
804
|
+
const files = state.configPath && isCssConfigFile(state.configPath) && fileExists(state.configPath) ? [...new Set([node_path.relative(cwd, state.configPath), ...discoveredFiles])].sort((a, b) => a.localeCompare(b)) : discoveredFiles;
|
|
800
805
|
if (verbose) {
|
|
801
806
|
console.log(ansis.default.cyan.bold(`→ Discovered ${files.length} file${files.length !== 1 ? "s" : ""} to lint`));
|
|
802
807
|
console.log();
|
package/dist/linter.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_linter = require("./linter-
|
|
2
|
+
const require_linter = require("./linter-ChZk2xMs.cjs");
|
|
3
3
|
exports.extractImportSourceDirectives = require_linter.extractImportSourceDirectives;
|
|
4
4
|
exports.extractSourcePatterns = require_linter.extractSourcePatterns;
|
|
5
5
|
exports.lint = require_linter.lint;
|
package/package.json
CHANGED