eslint-plugin-readable-tailwind
Version:
auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.
34 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.findFileRecursive = findFileRecursive;
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const CACHE = new Map();
function findFileRecursive(cwd, paths) {
const resolvedPaths = paths.map(p => (0, node_path_1.resolve)(cwd, p));
for (let resolvedPath = resolvedPaths.shift(); resolvedPath !== undefined; resolvedPath = resolvedPaths.shift()) {
if ((0, node_fs_1.existsSync)(resolvedPath)) {
const stat = (0, node_fs_1.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 = (0, node_path_1.basename)(resolvedPath);
const directory = (0, node_path_1.dirname)(resolvedPath);
const parentDirectory = (0, node_path_1.resolve)(directory, "..");
const parentPath = (0, node_path_1.resolve)(parentDirectory, fileName);
if (parentDirectory === directory || directory === cwd) {
continue;
}
resolvedPaths.push(parentPath);
}
}
//# sourceMappingURL=config.js.map