initial database integration
Deploy to Cloudflare Pages / deploy (push) Successful in 3m44s

This commit is contained in:
2026-08-11 23:50:16 +07:00 Unverified
parent 85d01acef9
commit 908f062161
39 changed files with 1633 additions and 100 deletions
+79
View File
@@ -0,0 +1,79 @@
const LUCIDE_PACKAGE = "@lucide/svelte";
function toKebabCase(iconName) {
return iconName
.replace(/^Lucide/, "")
.replace(/Icon$/, "")
.replace(/([a-z\d])([A-Z])/g, "$1-$2")
.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2")
.toLowerCase();
}
function getReplacement(specifier) {
if (specifier.type !== "ImportSpecifier" || specifier.importKind === "type") {
return null;
}
if (specifier.imported.type !== "Identifier") {
return null;
}
const importedName = specifier.imported.name;
const iconPath = toKebabCase(importedName);
if (!iconPath || iconPath === "lucide") {
return null;
}
return `import ${specifier.local.name} from "${LUCIDE_PACKAGE}/icons/${iconPath}";`;
}
const preferIconImports = {
meta: {
type: "suggestion",
docs: {
description: "Prefer direct Lucide icon imports over barrel imports",
},
fixable: "code",
messages: {
preferDirectImport:
"Replace barrel Lucide imports with direct icon imports.",
},
},
create(context) {
return {
ImportDeclaration(node) {
if (
node.source.value !== LUCIDE_PACKAGE ||
node.importKind === "type" ||
node.specifiers.length === 0
) {
return;
}
const replacements = node.specifiers.map(getReplacement);
if (replacements.some((replacement) => replacement === null)) {
return;
}
context.report({
node,
messageId: "preferDirectImport",
fix(fixer) {
return fixer.replaceText(node, replacements.join("\n"));
},
});
},
};
},
};
export default {
meta: {
name: "lucide",
},
rules: {
"prefer-icon-imports": preferIconImports,
},
};