eslint-plugin-better-tailwindcss
Version:
auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.
51 lines • 1.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTailwindConfigPath = void 0;
const node_path_1 = require("node:path");
const config_v3_js_1 = require("./config.v3.js");
const config_v4_js_1 = require("./config.v4.js");
const cache_js_1 = require("../async-utils/cache.js");
const version_js_1 = require("../async-utils/version.js");
const getTailwindConfigPath = ({ configPath, cwd }) => (0, cache_js_1.withCache)(configPath ?? "default", () => {
const version = (0, version_js_1.getTailwindcssVersion)();
if (version.major === 3 /* TailwindcssVersion.V3 */) {
const foundConfigPath = (0, config_v3_js_1.findTailwindConfigPath)(cwd, configPath);
return {
path: foundConfigPath ?? "default",
warning: getConfigPathWarning(configPath, foundConfigPath)
};
}
else {
const foundConfigPath = (0, config_v4_js_1.findTailwindConfigPath)(cwd, configPath);
return {
path: foundConfigPath ?? (0, config_v4_js_1.findDefaultConfigPath)(cwd),
warning: getEntryPointWarning(configPath, foundConfigPath)
};
}
});
exports.getTailwindConfigPath = getTailwindConfigPath;
function getConfigPathWarning(configPath, foundConfigPath) {
if (!configPath) {
return;
}
if (foundConfigPath && (0, node_path_1.resolve)(configPath) === (0, node_path_1.resolve)(foundConfigPath)) {
return;
}
return {
option: "tailwindConfig",
title: `No tailwind css config found at \`${configPath}\``
};
}
function getEntryPointWarning(entryPoint, foundEntryPoint) {
if (!entryPoint) {
return;
}
if (foundEntryPoint && (0, node_path_1.resolve)(entryPoint) === (0, node_path_1.resolve)(foundEntryPoint)) {
return;
}
return {
option: "entryPoint",
title: `No tailwind css entry point found at \`${entryPoint}\``
};
}
//# sourceMappingURL=config.js.map