eslint-plugin-readable-tailwind
Version:
auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.
26 lines • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClassOrder = getClassOrder;
const config_js_1 = require("./config.js");
const context_js_1 = require("./context.js");
async function getClassOrder({ classes, configPath, cwd }) {
const warnings = [];
const config = (0, config_js_1.findTailwindConfig)(cwd, configPath);
const defaultConfig = (0, config_js_1.findDefaultConfig)(cwd);
if (!config) {
warnings.push({
option: "entryPoint",
title: configPath
? `No tailwind css config found at \`${configPath}\``
: "No tailwind css entry point configured"
});
}
const path = config?.path ?? defaultConfig.path;
const invalidate = config?.invalidate ?? defaultConfig.invalidate;
if (!path) {
throw new Error("Could not find a valid Tailwind CSS configuration");
}
const context = await (0, context_js_1.createTailwindContextFromEntryPoint)(path, invalidate);
return [context.getClassOrder(classes), warnings];
}
//# sourceMappingURL=class-order.js.map