eslint-plugin-readable-tailwind
Version:
auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.
23 lines • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSupportedVersion = isSupportedVersion;
exports.getTailwindcssVersion = getTailwindcssVersion;
const node_fs_1 = require("node:fs");
const resolvers_js_1 = require("../utils/resolvers.js");
function isSupportedVersion(version) {
return version === 3 || version === 4;
}
function getTailwindcssVersion() {
const packageJsonPath = resolvers_js_1.jsonResolver.resolveSync({}, process.cwd(), "tailwindcss/package.json");
const packageJson = packageJsonPath && JSON.parse((0, node_fs_1.readFileSync)(packageJsonPath, "utf-8"));
if (!packageJson) {
throw new Error("Could not find a Tailwind CSS package.json");
}
return parseSemanticVersion(packageJson.version);
}
function parseSemanticVersion(version) {
const [major, minor, patchString] = version.split(".");
const [patch, identifier] = patchString.split("-");
return { identifier, major: +major, minor: +minor, patch: +patch };
}
//# sourceMappingURL=version.js.map