eslint-plugin-better-tailwindcss
Version:
auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.
22 lines • 1.07 kB
JavaScript
// runner.js
import { resolve } from "node:path";
import { createSyncFn } from "synckit";
import { getTailwindConfigPath } from "./config.js";
import { invalidateByModifiedDate, withCache } from "../utils/cache.js";
import { getWorkerOptions } from "../utils/worker.js";
export function getCustomComponentClasses({ configPath, cwd }) {
const { path } = getTailwindConfigPath({ configPath, cwd });
return withCache("custom-components", () => {
return getCustomComponentClassesSync({ configPath: path });
}, date => invalidateByModifiedDate(date, path));
}
const getCustomComponentClassesSync = createSyncFn(getWorkerPath(), getWorkerOptions());
function getWorkerPath() {
return resolve(getCurrentDirectory(), "./custom-component-classes.async.js");
}
function getCurrentDirectory() {
// eslint-disable-next-line eslint-plugin-typescript/prefer-ts-expect-error
// @ts-ignore - `import.meta` doesn't exist in CommonJS -> will be transformed in build step
return import.meta.dirname;
}
//# sourceMappingURL=custom-component-classes.js.map