UNPKG

eslint-plugin-readable-tailwind

Version:

auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.

31 lines 1.24 kB
import { existsSync, statSync } from "node:fs"; import { basename, dirname, resolve } from "node:path"; const CACHE = new Map(); export function findFileRecursive(cwd, paths) { const resolvedPaths = paths.map(p => resolve(cwd, p)); for (let resolvedPath = resolvedPaths.shift(); resolvedPath !== undefined; resolvedPath = resolvedPaths.shift()) { if (existsSync(resolvedPath)) { const stat = statSync(resolvedPath); if (!stat.isFile()) { CACHE.delete(resolvedPath); continue; } const invalidate = stat.mtimeMs > (CACHE.get(resolvedPath) ?? 0); CACHE.set(resolvedPath, stat.mtimeMs); return { invalidate, path: resolvedPath }; } CACHE.delete(resolvedPath); const fileName = basename(resolvedPath); const directory = dirname(resolvedPath); const parentDirectory = resolve(directory, ".."); const parentPath = resolve(parentDirectory, fileName); if (parentDirectory === directory || directory === cwd) { continue; } resolvedPaths.push(parentPath); } } //# sourceMappingURL=config.js.map