tailwind-lint 0.10.1 → 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/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_linter = require("./linter-CQy2hg_B.cjs");
2
+ const require_linter = require("./linter-ChZk2xMs.cjs");
3
3
  let node_path = require("node:path");
4
4
  node_path = require_linter.__toESM(node_path, 1);
5
5
  let ansis = require("ansis");
@@ -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 files = await discoverFiles(cwd, patterns, configPath, autoDiscover);
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-CQy2hg_B.cjs");
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-lint",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "A command-line tool that uses the Tailwind CSS IntelliSense plugin to show linting suggestions for your Tailwind CSS classes",
5
5
  "keywords": [
6
6
  "cli",