update: 升级vben5.5.9到5.7.0

This commit is contained in:
2026-09-22 17:09:46 +08:00
parent 345e4a31f8
commit 802f72cd9e
766 changed files with 28468 additions and 15447 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ deploy/ # 部署 TUI(原 ecom-deploy),流程见 deploy/MANU
- 只允许 pnpm;先 `pnpm install`(postinstall 会跑 `stub` 构建) - 只允许 pnpm;先 `pnpm install`(postinstall 会跑 `stub` 构建)
- 开发 `pnpm dev:antd`,构建 `pnpm build:antd`;类型检查 `pnpm -F @vben/web-antd typecheck` - 开发 `pnpm dev:antd`,构建 `pnpm build:antd`;类型检查 `pnpm -F @vben/web-antd typecheck`
- lefthook 钩子会对暂存文件自动 prettier/eslint/stylelint `--fix`,commitlint 强制 conventional commit,不要绕过 - lefthook 钩子会对暂存文件跑 `pnpm lint`(oxfmt/oxlint 等)与 `check:type`,commitlint 强制 conventional commit,不要绕过
- 代码内 `#/` 别名 = `src/` - 代码内 `#/` 别名 = `src/`
- **web-antd 视图里不要用 `<Spin :spinning>` 整块包住可滚动列表**(ant-spin-container 破坏滚动链);滚动依赖 `flex-1 min-h-0 overflow-y-auto`,加载态拆细(详见 `.cursor/rules/antd-spin-scrollable-layout.mdc`) - **web-antd 视图里不要用 `<Spin :spinning>` 整块包住可滚动列表**(ant-spin-container 破坏滚动链);滚动依赖 `flex-1 min-h-0 overflow-y-auto`,加载态拆细(详见 `.cursor/rules/antd-spin-scrollable-layout.mdc`)
- 智能助手页:`views/agent/chat`;开发代理 `/api/agent` → `localhost:8200`(见 `vite.config.mts`) - 智能助手页:`views/agent/chat`;开发代理 `/api/agent` → `localhost:8200`(见 `vite.config.mts`)
+1 -13
View File
@@ -1,13 +1 @@
registry = "https://registry.npmmirror.com" registry=https://registry.npmmirror.com
public-hoist-pattern[]=lefthook
public-hoist-pattern[]=eslint
public-hoist-pattern[]=prettier
public-hoist-pattern[]=prettier-plugin-tailwindcss
public-hoist-pattern[]=stylelint
public-hoist-pattern[]=*postcss*
public-hoist-pattern[]=@commitlint/*
public-hoist-pattern[]=czg
strict-peer-dependencies=false
auto-install-peers=true
dedupe-peer-dependents=true
+1 -1
View File
@@ -12,7 +12,7 @@
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
/> />
<!-- 由 vite 注入 VITE_APP_TITLE 变量,在 .env 文件内配置 --> <!-- 由 vite 注入 VITE_APP_TITLE 变量,在 .env 文件内配置 -->
<title><%= VITE_APP_TITLE %></title> <title>%VITE_APP_TITLE%</title>
<link rel="icon" href="/cd-logo.png" type="image/png" /> <link rel="icon" href="/cd-logo.png" type="image/png" />
</head> </head>
<body> <body>
+2 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@vben/web-antd", "name": "@vben/web-antd",
"version": "5.5.9", "version": "5.7.0",
"homepage": "https://vben.pro", "homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {
@@ -26,6 +26,7 @@
"#/*": "./src/*" "#/*": "./src/*"
}, },
"dependencies": { "dependencies": {
"@ant-design/icons-vue": "^7.0.1",
"@tdesign-vue-next/chat": "^0.7.0", "@tdesign-vue-next/chat": "^0.7.0",
"@vben/access": "workspace:*", "@vben/access": "workspace:*",
"@vben/common-ui": "workspace:*", "@vben/common-ui": "workspace:*",
@@ -1 +0,0 @@
export { default } from '@vben/tailwind-config/postcss';
+7 -3
View File
@@ -303,18 +303,22 @@ export function streamAgentChat(options: {
const parsed = JSON.parse(data) as { const parsed = JSON.parse(data) as {
toolCallId?: string; toolCallId?: string;
name?: string; name?: string;
args?: Record<string, unknown>; args?: unknown;
label?: string; label?: string;
}; };
if (parsed.name) { if (parsed.name) {
let toolArgs: Record<string, unknown> = {}; let toolArgs: Record<string, unknown> = {};
const rawArgs = parsed.args; const rawArgs = parsed.args;
if (rawArgs && typeof rawArgs === 'object') { if (rawArgs && typeof rawArgs === 'object' && !Array.isArray(rawArgs)) {
toolArgs = rawArgs as Record<string, unknown>; toolArgs = rawArgs as Record<string, unknown>;
} else if (typeof rawArgs === 'string' && rawArgs.trim()) { } else if (typeof rawArgs === 'string' && rawArgs.trim()) {
try { try {
const parsedArgs = JSON.parse(rawArgs) as unknown; const parsedArgs = JSON.parse(rawArgs) as unknown;
if (parsedArgs && typeof parsedArgs === 'object') { if (
parsedArgs &&
typeof parsedArgs === 'object' &&
!Array.isArray(parsedArgs)
) {
toolArgs = parsedArgs as Record<string, unknown>; toolArgs = parsedArgs as Record<string, unknown>;
} }
} catch { } catch {
@@ -18,7 +18,6 @@ import { getCompanyPageApi } from '#/api/company';
import { getUserPageApi } from '#/api/sys/user'; import { getUserPageApi } from '#/api/sys/user';
// 响应式数据 // 响应式数据
const formRef = ref();
const formData = ref({ const formData = ref({
companyId: undefined as number | undefined, companyId: undefined as number | undefined,
userId: undefined as number | undefined, userId: undefined as number | undefined,
@@ -375,7 +374,9 @@ defineExpose({
<div class="text-gray-500"> <div class="text-gray-500">
手机号码: {{ selectedUser.phone || '-' }} 手机号码: {{ selectedUser.phone || '-' }}
</div> </div>
<div class="text-gray-500">角色: {{ selectedUser.role }}</div> <div class="text-gray-500">
角色: {{ selectedUser.isSuper === 1 ? '超管' : '普通' }}
</div>
<div class="text-gray-500"> <div class="text-gray-500">
状态: {{ selectedUser.status === 1 ? '正常' : '禁用' }} 状态: {{ selectedUser.status === 1 ? '正常' : '禁用' }}
</div> </div>
@@ -27,6 +27,7 @@ const { hasPermission } = usePermission();
const notifications = ref<NotificationItem[]>([ const notifications = ref<NotificationItem[]>([
{ {
id: 1,
avatar: 'https://avatar.vercel.sh/vercel.svg?text=VB', avatar: 'https://avatar.vercel.sh/vercel.svg?text=VB',
date: '3小时前', date: '3小时前',
isRead: true, isRead: true,
@@ -34,6 +35,7 @@ const notifications = ref<NotificationItem[]>([
title: '收到了 14 份新周报', title: '收到了 14 份新周报',
}, },
{ {
id: 2,
avatar: 'https://avatar.vercel.sh/1', avatar: 'https://avatar.vercel.sh/1',
date: '刚刚', date: '刚刚',
isRead: false, isRead: false,
@@ -41,6 +43,7 @@ const notifications = ref<NotificationItem[]>([
title: '朱偏右 回复了你', title: '朱偏右 回复了你',
}, },
{ {
id: 3,
avatar: 'https://avatar.vercel.sh/1', avatar: 'https://avatar.vercel.sh/1',
date: '2024-01-01', date: '2024-01-01',
isRead: false, isRead: false,
@@ -48,6 +51,7 @@ const notifications = ref<NotificationItem[]>([
title: '曲丽丽 评论了你', title: '曲丽丽 评论了你',
}, },
{ {
id: 4,
avatar: 'https://avatar.vercel.sh/satori', avatar: 'https://avatar.vercel.sh/satori',
date: '1天前', date: '1天前',
isRead: false, isRead: false,
+1 -3
View File
@@ -27,9 +27,7 @@ export const overridesPreferences = defineOverridesPreferences({
navigation: { navigation: {
accordion: false, // 关闭手风琴模式,允许多个菜单同时展开 accordion: false, // 关闭手风琴模式,允许多个菜单同时展开
}, },
theme: { // 不要在此写死 theme.mode:用户切换深/浅色需持久化到缓存
mode: 'light',
},
transition: { transition: {
enable: false, enable: false,
loading: false, loading: false,
+13 -4
View File
@@ -132,13 +132,22 @@ function setupAccessGuard(router: Router) {
userInfo.homePath || preferences.app.defaultHomePath; userInfo.homePath || preferences.app.defaultHomePath;
} }
// 动态 addRoute 后必须发起一次新导航。
// 若期间有路由增删导致当前导航被取消,return true 只会继续已取消的导航,
// 表现即停在登录页 +「加载菜单中」(生产构建更易复现,开发环境不一定)。
// 不要展开 resolve() 的 matched,避免沿用生成路由前的 404 匹配记录。
const resolved = router.resolve(redirectPath); const resolved = router.resolve(redirectPath);
// 已在目标页则放行;不要展开 resolve(),以免带上过期的 matched(当时可能命中 404) if (resolved.name) {
if (resolved.name && resolved.name === to.name) { return {
return true; name: resolved.name,
params: resolved.params,
query: resolved.query,
hash: resolved.hash,
replace: true,
};
} }
return { return {
path: resolved.path, path: resolved.path || redirectPath,
query: resolved.query, query: resolved.query,
hash: resolved.hash, hash: resolved.hash,
replace: true, replace: true,
@@ -49,6 +49,9 @@ const formSchema = computed((): VbenFormSchema[] => {
:loading="authStore.loginLoading" :loading="authStore.loginLoading"
:show-forget-password="false" :show-forget-password="false"
:show-register="false" :show-register="false"
:show-code-login="false"
:show-qrcode-login="false"
:show-third-party-login="false"
@submit="authStore.authLogin" @submit="authStore.authLogin"
/> />
</template> </template>
@@ -67,7 +67,7 @@ async function handleSubmit() {
return; return;
} }
saving.value = true; saving.value = true;
modalApi.setState({ confirming: true }); modalApi.setState({ confirmLoading: true });
try { try {
if (isEdit.value && editing.value) { if (isEdit.value && editing.value) {
await updateAgentLlmProviderApi(editing.value.id, { await updateAgentLlmProviderApi(editing.value.id, {
@@ -90,7 +90,7 @@ async function handleSubmit() {
message.error(e?.message || '保存失败'); message.error(e?.message || '保存失败');
} finally { } finally {
saving.value = false; saving.value = false;
modalApi.setState({ confirming: false }); modalApi.setState({ confirmLoading: false });
} }
} }
@@ -29,7 +29,7 @@ const emit = defineEmits<{ success: [] }>();
type ModelRow = { type ModelRow = {
model: string; model: string;
contextWindow: number | null; contextWindow: number | undefined;
isDefault: boolean; isDefault: boolean;
enabled: boolean; enabled: boolean;
}; };
@@ -63,7 +63,7 @@ function applyProviderModels(detail: AgentVO.LlmProvider) {
modelRows.value = (detail.models || []).map((m) => ({ modelRows.value = (detail.models || []).map((m) => ({
model: m.model, model: m.model,
contextWindow: contextWindow:
m.contextWindow != null && m.contextWindow > 0 ? m.contextWindow : null, m.contextWindow != null && m.contextWindow > 0 ? m.contextWindow : undefined,
isDefault: !!m.isDefault, isDefault: !!m.isDefault,
enabled: m.enabled !== false, enabled: m.enabled !== false,
})); }));
@@ -101,7 +101,7 @@ function toggleProbed(p: AgentVO.ProbedLlmModel, checked: boolean) {
contextWindow: contextWindow:
p.contextWindow != null && p.contextWindow > 0 p.contextWindow != null && p.contextWindow > 0
? p.contextWindow ? p.contextWindow
: null, : undefined,
isDefault: false, isDefault: false,
enabled: true, enabled: true,
}); });
@@ -143,7 +143,7 @@ function addManual() {
} }
modelRows.value.push({ modelRows.value.push({
model: id, model: id,
contextWindow: null, contextWindow: undefined,
isDefault: false, isDefault: false,
enabled: true, enabled: true,
}); });
@@ -214,7 +214,7 @@ async function handleSave() {
return; return;
} }
saving.value = true; saving.value = true;
modalApi.setState({ confirming: true }); modalApi.setState({ confirmLoading: true });
try { try {
const models = modelRows.value.map((m) => ({ const models = modelRows.value.map((m) => ({
model: m.model, model: m.model,
@@ -234,7 +234,7 @@ async function handleSave() {
message.error(e?.message || '保存失败'); message.error(e?.message || '保存失败');
} finally { } finally {
saving.value = false; saving.value = false;
modalApi.setState({ confirming: false }); modalApi.setState({ confirmLoading: false });
} }
} }
@@ -310,11 +310,11 @@ onMounted(() => {
</div> </div>
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden"> <div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
<div class="min-h-0 flex-1 overflow-y-auto"> <div class="flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto">
<Card <Card
size="small" size="small"
:body-style="{ padding: '10px 12px' }" :body-style="{ padding: '10px 12px' }"
class="mb-2 cursor-pointer !shadow-none hover:border-primary" class="cursor-pointer !shadow-none hover:border-primary"
:class="allSelected ? 'border-primary bg-primary/5' : undefined" :class="allSelected ? 'border-primary bg-primary/5' : undefined"
@click="selectAll" @click="selectAll"
> >
@@ -337,7 +337,7 @@ onMounted(() => {
v-if="showUnassignedFilter" v-if="showUnassignedFilter"
size="small" size="small"
:body-style="{ padding: '10px 12px' }" :body-style="{ padding: '10px 12px' }"
class="mb-2 cursor-pointer !shadow-none hover:border-primary" class="cursor-pointer !shadow-none hover:border-primary"
:class=" :class="
unassignedSelected ? 'border-primary bg-primary/5' : undefined unassignedSelected ? 'border-primary bg-primary/5' : undefined
" "
@@ -371,19 +371,22 @@ onMounted(() => {
</div> </div>
</Card> </Card>
<Spin :spinning="shopsLoading"> <Spin
:spinning="shopsLoading"
wrapper-class-name="pdd-shop-sidebar-list-spin"
>
<Empty <Empty
v-if="!shopsLoading && shops.length === 0" v-if="!shopsLoading && shops.length === 0"
class="py-8" class="py-8"
description="暂无拼多多店铺" description="暂无拼多多店铺"
/> />
<template v-else> <div v-else class="flex flex-col gap-2">
<Card <Card
v-for="shop in shops" v-for="shop in shops"
:key="shop.id" :key="shop.id"
size="small" size="small"
:body-style="{ padding: '10px 12px' }" :body-style="{ padding: '10px 12px' }"
class="group mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary" class="group cursor-pointer !shadow-none hover:border-primary"
:class=" :class="
selectedShopId === shop.id selectedShopId === shop.id
? 'border-primary bg-primary/5' ? 'border-primary bg-primary/5'
@@ -433,7 +436,7 @@ onMounted(() => {
</div> </div>
</div> </div>
</Card> </Card>
</template> </div>
</Spin> </Spin>
</div> </div>
@@ -485,4 +488,13 @@ onMounted(() => {
align-items: center; align-items: center;
overflow: visible; overflow: visible;
} }
/* Spin 外层参与父级 gap 布局,避免列表项贴在一起 */
:deep(.pdd-shop-sidebar-list-spin),
:deep(.pdd-shop-sidebar-list-spin .ant-spin-container) {
display: flex;
width: 100%;
min-width: 0;
flex-direction: column;
}
</style> </style>
@@ -291,11 +291,11 @@ onMounted(() => {
</div> </div>
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden"> <div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
<div class="min-h-0 flex-1 overflow-y-auto"> <div class="flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto">
<Card <Card
size="small" size="small"
:body-style="{ padding: '10px 12px' }" :body-style="{ padding: '10px 12px' }"
class="mb-2 cursor-pointer !shadow-none hover:border-primary" class="cursor-pointer !shadow-none hover:border-primary"
:class="allSelected ? 'border-primary bg-primary/5' : undefined" :class="allSelected ? 'border-primary bg-primary/5' : undefined"
@click="selectAll" @click="selectAll"
> >
@@ -314,19 +314,22 @@ onMounted(() => {
</div> </div>
</Card> </Card>
<Spin :spinning="shopsLoading"> <Spin
:spinning="shopsLoading"
wrapper-class-name="shop-sidebar-list-spin"
>
<Empty <Empty
v-if="!shopsLoading && shops.length === 0" v-if="!shopsLoading && shops.length === 0"
class="py-8" class="py-8"
description="暂无店铺" description="暂无店铺"
/> />
<template v-else> <div v-else class="flex flex-col gap-2">
<Card <Card
v-for="shop in shops" v-for="shop in shops"
:key="shop.id" :key="shop.id"
size="small" size="small"
:body-style="{ padding: '10px 12px' }" :body-style="{ padding: '10px 12px' }"
class="group mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary" class="group cursor-pointer !shadow-none hover:border-primary"
:class=" :class="
selectedShopId === shop.id selectedShopId === shop.id
? 'border-primary bg-primary/5' ? 'border-primary bg-primary/5'
@@ -352,7 +355,7 @@ onMounted(() => {
</div> </div>
</div> </div>
</Card> </Card>
</template> </div>
</Spin> </Spin>
</div> </div>
@@ -404,4 +407,12 @@ onMounted(() => {
align-items: center; align-items: center;
overflow: visible; overflow: visible;
} }
:deep(.shop-sidebar-list-spin),
:deep(.shop-sidebar-list-spin .ant-spin-container) {
display: flex;
width: 100%;
min-width: 0;
flex-direction: column;
}
</style> </style>
@@ -198,7 +198,7 @@ defineExpose({ open, close });
:columns="itemColumns" :columns="itemColumns"
:data-source="detail.items || []" :data-source="detail.items || []"
:pagination="false" :pagination="false"
:row-key="(r: OrderItemVO.Info) => r.id ?? r.lineNo" :row-key="(r: OrderItemVO.Info) => r.id ?? r.lineNo ?? String(r)"
size="small" size="small"
bordered bordered
:scroll="{ x: 900 }" :scroll="{ x: 900 }"
@@ -212,11 +212,11 @@ defineExpose({ open, close });
:width="36" :width="36"
:height="36" :height="36"
/> />
<span>{{ itemTitle(record) }}</span> <span>{{ itemTitle(record as OrderItemVO.Info) }}</span>
</div> </div>
</template> </template>
<template v-else-if="column.key === 'linkSkuName'"> <template v-else-if="column.key === 'linkSkuName'">
{{ itemSpec(record) }} {{ itemSpec(record as OrderItemVO.Info) }}
</template> </template>
<template v-else-if="column.key === 'unitPrice'"> <template v-else-if="column.key === 'unitPrice'">
{{ money(record.unitPrice) }} {{ money(record.unitPrice) }}
@@ -965,7 +965,7 @@ const skuColumns = [
record: SkuFormRow; record: SkuFormRow;
index: number; index: number;
}) => { }) => {
const children = []; const children: ReturnType<typeof h>[] = [];
if (isPersistedSkuId(record.id) && currentProductData.value?.id) { if (isPersistedSkuId(record.id) && currentProductData.value?.id) {
children.push( children.push(
h( h(
@@ -188,7 +188,7 @@ defineExpose({ open });
ok-text="确认迁入" ok-text="确认迁入"
cancel-text="取消" cancel-text="取消"
:ok-button-props="{ loading: migratingSkuId === record.id }" :ok-button-props="{ loading: migratingSkuId === record.id }"
@confirm="confirmMigrate(record)" @confirm="confirmMigrate(record as ProductSkuVO.Info)"
> >
<Button <Button
type="link" type="link"
@@ -638,7 +638,7 @@ function valueColumns(spec: DraftSpec) {
dataIndex: 'valueName', dataIndex: 'valueName',
key: 'valueName', key: 'valueName',
customRender: ({ record }: { record: DraftValue }) => customRender: ({ record }: { record: DraftValue }) =>
h(Select, { h(Select as any, {
value: record.valueName || undefined, value: record.valueName || undefined,
showSearch: true, showSearch: true,
allowClear: true, allowClear: true,
@@ -69,11 +69,6 @@ const cellMoney = (v: number | null | undefined) =>
const cellRoi = (v: number | null | undefined) => const cellRoi = (v: number | null | undefined) =>
formatNumberCell(v, (n) => n.toFixed(2)); formatNumberCell(v, (n) => n.toFixed(2));
const formatPercent = (value: number | undefined) => {
if (value === undefined || value === null) return '-';
return `${value.toFixed(1)}%`;
};
const computedFooter = computed(() => { const computedFooter = computed(() => {
if (!props.data || props.data.length === 0) return null; if (!props.data || props.data.length === 0) return null;
const total: SkuData = { const total: SkuData = {
@@ -72,16 +72,19 @@ const formRef = ref();
const isEdit = ref(false); const isEdit = ref(false);
/** 表单内用 Dayjs,提交时再格式化为 YYYY-MM-DD */ /** 表单内用 Dayjs,提交时再格式化为 YYYY-MM-DD */
type AdFeeFormState = Omit<AdFeeDTO.Create, 'feeDate'> & { type AdFeeFormState = Omit<AdFeeDTO.Create, 'feeDate' | 'productId' | 'shopId' | 'feeAmount'> & {
shopId?: number;
productId?: number;
feeAmount?: number;
feeDate?: Dayjs; feeDate?: Dayjs;
}; };
const formData = ref<AdFeeFormState>({ const formData = ref<AdFeeFormState>({
shopId: undefined as any, shopId: undefined,
productId: undefined, productId: undefined,
campaignName: '', campaignName: '',
feeAmount: undefined as any, feeAmount: undefined,
feeDate: undefined as any, feeDate: undefined,
remark: '', remark: '',
}); });
@@ -166,11 +169,11 @@ const loadProductList = async () => {
const resetFormData = () => { const resetFormData = () => {
formData.value = { formData.value = {
shopId: undefined as any, shopId: undefined,
productId: undefined, productId: undefined,
campaignName: '', campaignName: '',
feeAmount: undefined as any, feeAmount: undefined,
feeDate: undefined as any, feeDate: undefined,
remark: '', remark: '',
}; };
}; };
@@ -190,18 +193,18 @@ const handleOk = async () => {
const feeDate = feeDateToApiString(formData.value.feeDate!); const feeDate = feeDateToApiString(formData.value.feeDate!);
if (isEdit.value && props.adFeeData) { if (isEdit.value && props.adFeeData) {
const updateData: AdFeeDTO.Update = { const updateData = {
id: props.adFeeData.id, id: props.adFeeData.id,
...formData.value, ...formData.value,
feeDate, feeDate,
}; } as AdFeeDTO.Update;
await updateAdFeeApi(updateData); await updateAdFeeApi(updateData);
message.success('更新成功'); message.success('更新成功');
} else { } else {
await createAdFeeApi({ await createAdFeeApi({
...formData.value, ...formData.value,
feeDate, feeDate,
}); } as AdFeeDTO.Create);
message.success('创建成功'); message.success('创建成功');
} }
@@ -615,7 +615,10 @@ function handleEdit(record: ShopListRow) {
} }
function handleDelete(record: ShopListRow) { function handleDelete(record: ShopListRow) {
shopDeleteModalRef.value?.open({ id: record.id, name: record.name }); shopDeleteModalRef.value?.open({
id: record.id,
name: record.name ?? '',
});
} }
function handleModalSuccess() { function handleModalSuccess() {
@@ -1 +0,0 @@
export { default } from '@vben/tailwind-config';
+29 -6
View File
@@ -7,19 +7,29 @@
"acmr", "acmr",
"antd", "antd",
"antdv", "antdv",
"archiver",
"astro", "astro",
"axios",
"brotli", "brotli",
"cascader",
"chatcmpl",
"clsx", "clsx",
"dedup",
"defu", "defu",
"demi", "demi",
"dotenv",
"echart",
"echarts", "echarts",
"ependencies", "ependencies",
"esbuild",
"esno", "esno",
"etag", "etag",
"execa", "execa",
"iconify", "iconify",
"iconoir", "iconoir",
"intlify", "intlify",
"isequal",
"jspm",
"lockb", "lockb",
"lucide", "lucide",
"minh", "minh",
@@ -27,20 +37,32 @@
"mkdist", "mkdist",
"mockjs", "mockjs",
"naiveui", "naiveui",
"napi",
"nocheck", "nocheck",
"nolebase",
"noopener", "noopener",
"noreferrer", "noreferrer",
"nprogress", "nprogress",
"nuxt", "nuxt",
"organisation",
"oxfmt",
"oxlint",
"pinia", "pinia",
"prefixs", "prefixs",
"publint", "publint",
"qrcode", "qrcode",
"reka",
"rollup",
"shadcn", "shadcn",
"sonner", "sonner",
"sortablejs", "sortablejs",
"styl", "styl",
"tabler",
"taze", "taze",
"tdesign",
"tsdown",
"tsgolint",
"turborepo",
"ui-kit", "ui-kit",
"uicons", "uicons",
"unplugin", "unplugin",
@@ -50,19 +72,20 @@
"vite", "vite",
"vitejs", "vitejs",
"vitepress", "vitepress",
"vitest",
"vnode", "vnode",
"vueuse", "vueuse",
"yxxx" "yxxx"
], ],
"ignorePaths": [ "ignorePaths": [
"**/node_modules/**",
"**/dist/**",
"**/*-dist/**", "**/*-dist/**",
"**/icons/**",
"pnpm-lock.yaml",
"**/*.log", "**/*.log",
"**/*.test.ts",
"**/*.spec.ts", "**/*.spec.ts",
"**/__tests__/**" "**/*.test.ts",
"**/__tests__/**",
"**/dist/**",
"**/icons/**",
"**/node_modules/**",
"pnpm-lock.yaml"
] ]
} }
-2
View File
@@ -1,5 +1,3 @@
// @ts-check
import { defineConfig } from '@vben/eslint-config'; import { defineConfig } from '@vben/eslint-config';
export default defineConfig(); export default defineConfig();
@@ -21,7 +21,7 @@ const scopeComplete = execSync('git status --porcelain || true')
.trim() .trim()
.split('\n') .split('\n')
.find((r) => ~r.indexOf('M src')) .find((r) => ~r.indexOf('M src'))
?.replace(/(\/)/g, '%%') ?.replaceAll(/(\/)/g, '%%')
?.match(/src%%((\w|-)*)/)?.[1] ?.match(/src%%((\w|-)*)/)?.[1]
?.replace(/s$/, ''); ?.replace(/s$/, '');
@@ -1,6 +1,6 @@
{ {
"name": "@vben/commitlint-config", "name": "@vben/commitlint-config",
"version": "5.5.9", "version": "5.7.0",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
@@ -1,7 +0,0 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index'],
});
@@ -1,6 +1,6 @@
{ {
"name": "@vben/eslint-config", "name": "@vben/eslint-config",
"version": "5.0.0", "version": "5.7.0",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
@@ -12,7 +12,7 @@
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"scripts": { "scripts": {
"stub": "pnpm unbuild --stub" "stub": "pnpm exec tsdown"
}, },
"files": [ "files": [
"dist" "dist"
@@ -27,30 +27,21 @@
} }
}, },
"dependencies": { "dependencies": {
"eslint-config-turbo": "catalog:",
"eslint-plugin-command": "catalog:",
"eslint-plugin-import-x": "catalog:"
},
"devDependencies": {
"@eslint/js": "catalog:", "@eslint/js": "catalog:",
"@types/eslint": "catalog:",
"@typescript-eslint/eslint-plugin": "catalog:", "@typescript-eslint/eslint-plugin": "catalog:",
"@typescript-eslint/parser": "catalog:", "@typescript-eslint/parser": "catalog:",
"@vben/oxlint-config": "workspace:*",
"eslint": "catalog:", "eslint": "catalog:",
"eslint-plugin-eslint-comments": "catalog:",
"eslint-plugin-jsdoc": "catalog:",
"eslint-plugin-jsonc": "catalog:", "eslint-plugin-jsonc": "catalog:",
"eslint-plugin-n": "catalog:", "eslint-plugin-n": "catalog:",
"eslint-plugin-no-only-tests": "catalog:",
"eslint-plugin-perfectionist": "catalog:", "eslint-plugin-perfectionist": "catalog:",
"eslint-plugin-prettier": "catalog:", "eslint-plugin-pnpm": "catalog:",
"eslint-plugin-regexp": "catalog:",
"eslint-plugin-unicorn": "catalog:", "eslint-plugin-unicorn": "catalog:",
"eslint-plugin-unused-imports": "catalog:", "eslint-plugin-unused-imports": "catalog:",
"eslint-plugin-vitest": "catalog:",
"eslint-plugin-vue": "catalog:", "eslint-plugin-vue": "catalog:",
"eslint-plugin-yml": "catalog:",
"globals": "catalog:", "globals": "catalog:",
"jsonc-eslint-parser": "catalog:", "vue-eslint-parser": "catalog:",
"vue-eslint-parser": "catalog:" "yaml-eslint-parser": "catalog:"
} }
} }
@@ -1,10 +0,0 @@
import createCommand from 'eslint-plugin-command/config';
export async function command() {
return [
{
// @ts-expect-error - no types
...createCommand(),
},
];
}
@@ -1,24 +0,0 @@
import type { Linter } from 'eslint';
import { interopDefault } from '../util';
export async function comments(): Promise<Linter.Config[]> {
const [pluginComments] = await Promise.all([
// @ts-expect-error - no types
interopDefault(import('eslint-plugin-eslint-comments')),
] as const);
return [
{
plugins: {
'eslint-comments': pluginComments,
},
rules: {
'eslint-comments/no-aggregating-enable': 'error',
'eslint-comments/no-duplicate-disable': 'error',
'eslint-comments/no-unlimited-disable': 'error',
'eslint-comments/no-unused-enable': 'error',
},
},
];
}
@@ -1,28 +0,0 @@
import type { Linter } from 'eslint';
export async function disableds(): Promise<Linter.Config[]> {
return [
{
files: ['**/__tests__/**/*.?([cm])[jt]s?(x)'],
name: 'disables/test',
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'no-console': 'off',
},
},
{
files: ['**/*.d.ts'],
name: 'disables/dts',
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
},
},
{
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
name: 'disables/js',
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
];
}
@@ -46,6 +46,14 @@ export async function ignores(): Promise<Linter.Config[]> {
'**/*.sh', '**/*.sh',
'**/*.ttf', '**/*.ttf',
'**/*.woff', '**/*.woff',
'**/.github',
'**/lefthook.yml',
'**/.agent/**',
'**/.agents/**',
'**/.codex/**',
'**/.claude/**',
'**/.cursor/**',
], ],
}, },
]; ];
@@ -1,25 +0,0 @@
import type { Linter } from 'eslint';
import * as pluginImport from 'eslint-plugin-import-x';
export async function importPluginConfig(): Promise<Linter.Config[]> {
return [
{
plugins: {
// @ts-expect-error - This is a dynamic import
import: pluginImport,
},
rules: {
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'import/no-mutable-exports': 'error',
'import/no-named-default': 'error',
'import/no-self-import': 'error',
'import/no-unresolved': 'off',
'import/no-webpack-loader-syntax': 'error',
},
},
];
}
@@ -1,17 +1,10 @@
export * from './command';
export * from './comments';
export * from './disableds';
export * from './ignores'; export * from './ignores';
export * from './import';
export * from './javascript'; export * from './javascript';
export * from './jsdoc';
export * from './jsonc'; export * from './jsonc';
export * from './node'; export * from './node';
export * from './perfectionist'; export * from './perfectionist';
export * from './prettier'; export * from './pnpm';
export * from './regexp';
export * from './test';
export * from './turbo';
export * from './typescript'; export * from './typescript';
export * from './unicorn'; export * from './unicorn';
export * from './vue'; export * from './vue';
export * from './yaml';
@@ -4,7 +4,73 @@ import js from '@eslint/js';
import pluginUnusedImports from 'eslint-plugin-unused-imports'; import pluginUnusedImports from 'eslint-plugin-unused-imports';
import globals from 'globals'; import globals from 'globals';
const rulesCoveredByOxlint = new Set([
'constructor-super',
'for-direction',
'getter-return',
'no-async-promise-executor',
'no-case-declarations',
'no-class-assign',
'no-compare-neg-zero',
'no-cond-assign',
'no-const-assign',
'no-constant-binary-expression',
'no-constant-condition',
'no-debugger',
'no-delete-var',
'no-dupe-args',
'no-dupe-class-members',
'no-dupe-else-if',
'no-dupe-keys',
'no-duplicate-case',
'no-empty',
'no-empty-character-class',
'no-empty-pattern',
'no-empty-static-block',
'no-ex-assign',
'no-extra-boolean-cast',
'no-fallthrough',
'no-func-assign',
'no-global-assign',
'no-import-assign',
'no-invalid-regexp',
'no-irregular-whitespace',
'no-loss-of-precision',
'no-misleading-character-class',
'no-new-native-nonconstructor',
'no-nonoctal-decimal-escape',
'no-obj-calls',
'no-prototype-builtins',
'no-redeclare',
'no-regex-spaces',
'no-self-assign',
'no-setter-return',
'no-shadow-restricted-names',
'no-sparse-arrays',
'no-this-before-super',
'no-unreachable',
'no-unsafe-finally',
'no-unsafe-negation',
'no-unsafe-optional-chaining',
'no-unused-labels',
'no-unused-private-class-members',
'no-unused-vars',
'no-useless-backreference',
'no-useless-catch',
'no-useless-escape',
'no-with',
'require-yield',
'use-isnan',
'valid-typeof',
]);
export async function javascript(): Promise<Linter.Config[]> { export async function javascript(): Promise<Linter.Config[]> {
const recommendedRules = Object.fromEntries(
Object.entries(js.configs.recommended.rules).filter(
([ruleName]) => !rulesCoveredByOxlint.has(ruleName),
),
);
return [ return [
{ {
languageOptions: { languageOptions: {
@@ -33,79 +99,13 @@ export async function javascript(): Promise<Linter.Config[]> {
'unused-imports': pluginUnusedImports, 'unused-imports': pluginUnusedImports,
}, },
rules: { rules: {
...js.configs.recommended.rules, ...recommendedRules,
'accessor-pairs': [
'error',
{ enforceForClassMembers: true, setWithoutGet: true },
],
'array-callback-return': 'error',
'block-scoped-var': 'error',
'constructor-super': 'error',
'default-case-last': 'error',
'dot-notation': ['error', { allowKeywords: true }], 'dot-notation': ['error', { allowKeywords: true }],
eqeqeq: ['error', 'always'],
'keyword-spacing': 'off', 'keyword-spacing': 'off',
'new-cap': [
'error',
{ capIsNew: false, newIsCap: true, properties: true },
],
'no-alert': 'error',
'no-array-constructor': 'error',
'no-async-promise-executor': 'error',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-class-assign': 'error',
'no-compare-neg-zero': 'error',
'no-cond-assign': ['error', 'always'],
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-const-assign': 'error',
'no-control-regex': 'error', 'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-class-members': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-empty-character-class': 'error',
'no-empty-function': 'off', 'no-empty-function': 'off',
'no-empty-pattern': 'error',
'no-eval': 'error',
'no-ex-assign': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-global-assign': 'error',
'no-implied-eval': 'error',
'no-import-assign': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-iterator': 'error',
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
'no-lone-blocks': 'error',
'no-loss-of-precision': 'error',
'no-misleading-character-class': 'error',
'no-multi-str': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-symbol': 'error',
'no-new-wrappers': 'error',
'no-obj-calls': 'error',
'no-octal': 'error', 'no-octal': 'error',
'no-octal-escape': 'error', 'no-octal-escape': 'error',
'no-proto': 'error',
'no-prototype-builtins': 'error',
'no-redeclare': ['error', { builtinGlobals: false }],
'no-regex-spaces': 'error',
'no-restricted-globals': [
'error',
{ message: 'Use `globalThis` instead.', name: 'global' },
{ message: 'Use `globalThis` instead.', name: 'self' },
],
'no-restricted-properties': [ 'no-restricted-properties': [
'error', 'error',
{ {
@@ -138,57 +138,16 @@ export async function javascript(): Promise<Linter.Config[]> {
'TSEnumDeclaration[const=true]', 'TSEnumDeclaration[const=true]',
'TSExportAssignment', 'TSExportAssignment',
], ],
'no-self-assign': ['error', { props: true }],
'no-self-compare': 'error',
'no-sequences': 'error',
'no-shadow-restricted-names': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-this-before-super': 'error',
'no-throw-literal': 'error',
'no-undef': 'off',
'no-undef-init': 'error', 'no-undef-init': 'error',
'no-unexpected-multiline': 'error', 'no-undef': 'off',
'no-unmodified-loop-condition': 'error',
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
'no-unreachable': 'error',
'no-unreachable-loop': 'error', 'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTaggedTemplates: true,
allowTernary: true,
},
],
'no-unused-vars': [
'error',
{
args: 'none',
caughtErrors: 'none',
ignoreRestSiblings: true,
vars: 'all',
},
],
'no-use-before-define': [
'error',
{ classes: false, functions: false, variables: false },
],
'no-useless-backreference': 'error',
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-computed-key': 'error',
'no-useless-constructor': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-with': 'error',
'object-shorthand': [ 'object-shorthand': [
'error', 'error',
'always', 'always',
{ avoidQuotes: true, ignoreConstructors: false }, {
avoidQuotes: true,
ignoreConstructors: false,
},
], ],
'one-var': ['error', { initialized: 'never' }], 'one-var': ['error', { initialized: 'never' }],
'prefer-arrow-callback': [ 'prefer-arrow-callback': [
@@ -198,24 +157,14 @@ export async function javascript(): Promise<Linter.Config[]> {
allowUnboundThis: true, allowUnboundThis: true,
}, },
], ],
'prefer-const': [ 'prefer-regex-literals': [
'error', 'error',
{ {
destructuring: 'all', disallowRedundantWrapping: true,
ignoreReadBeforeAssign: true,
}, },
], ],
'prefer-exponentiation-operator': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'space-before-function-paren': 'off',
'spaced-comment': 'error', 'spaced-comment': 'error',
'symbol-description': 'error', 'space-before-function-paren': 'off',
'unicode-bom': ['error', 'never'],
'unused-imports/no-unused-imports': 'error', 'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [ 'unused-imports/no-unused-vars': [
@@ -227,14 +176,6 @@ export async function javascript(): Promise<Linter.Config[]> {
varsIgnorePattern: '^_', varsIgnorePattern: '^_',
}, },
], ],
'use-isnan': [
'error',
{ enforceForIndexOf: true, enforceForSwitchCase: true },
],
'valid-typeof': ['error', { requireStringLiterals: true }],
'vars-on-top': 'error',
yoda: ['error', 'never'],
}, },
}, },
]; ];
@@ -1,34 +0,0 @@
import type { Linter } from 'eslint';
import { interopDefault } from '../util';
export async function jsdoc(): Promise<Linter.Config[]> {
const [pluginJsdoc] = await Promise.all([
interopDefault(import('eslint-plugin-jsdoc')),
] as const);
return [
{
plugins: {
jsdoc: pluginJsdoc,
},
rules: {
'jsdoc/check-access': 'warn',
'jsdoc/check-param-names': 'warn',
'jsdoc/check-property-names': 'warn',
'jsdoc/check-types': 'warn',
'jsdoc/empty-tags': 'warn',
'jsdoc/implements-on-classes': 'warn',
'jsdoc/no-defaults': 'warn',
'jsdoc/no-multi-asterisks': 'warn',
'jsdoc/require-param-name': 'warn',
'jsdoc/require-property': 'warn',
'jsdoc/require-property-description': 'warn',
'jsdoc/require-property-name': 'warn',
'jsdoc/require-returns-check': 'warn',
'jsdoc/require-returns-description': 'warn',
'jsdoc/require-yields-check': 'warn',
},
},
];
}
@@ -3,17 +3,12 @@ import type { Linter } from 'eslint';
import { interopDefault } from '../util'; import { interopDefault } from '../util';
export async function jsonc(): Promise<Linter.Config[]> { export async function jsonc(): Promise<Linter.Config[]> {
const [pluginJsonc, parserJsonc] = await Promise.all([ const pluginJsonc = await interopDefault(import('eslint-plugin-jsonc'));
interopDefault(import('eslint-plugin-jsonc')),
interopDefault(import('jsonc-eslint-parser')),
] as const);
return [ return [
{ {
files: ['**/*.json', '**/*.json5', '**/*.jsonc', '*.code-workspace'], files: ['**/*.json', '**/*.json5', '**/*.jsonc', '*.code-workspace'],
languageOptions: { language: 'jsonc/x',
parser: parserJsonc as any,
},
plugins: { plugins: {
jsonc: pluginJsonc as any, jsonc: pluginJsonc as any,
}, },
@@ -48,6 +43,7 @@ export async function jsonc(): Promise<Linter.Config[]> {
}, },
sortTsconfig(), sortTsconfig(),
sortPackageJson(), sortPackageJson(),
sortCspellJson(),
]; ];
} }
@@ -130,6 +126,21 @@ function sortPackageJson(): Linter.Config {
}; };
} }
function sortCspellJson(): Linter.Config {
return {
files: ['**/cspell.json', '**/.cspell.json'],
rules: {
'jsonc/sort-array-values': [
'error',
{
order: { type: 'asc' },
pathPattern: '^words$|^ignorePaths$',
},
],
},
};
}
function sortTsconfig(): Linter.Config { function sortTsconfig(): Linter.Config {
return { return {
files: [ files: [
@@ -13,29 +13,26 @@ export async function node(): Promise<Linter.Config[]> {
rules: { rules: {
'n/handle-callback-err': ['error', '^(err|error)$'], 'n/handle-callback-err': ['error', '^(err|error)$'],
'n/no-deprecated-api': 'error', 'n/no-deprecated-api': 'error',
'n/no-exports-assign': 'error',
'n/no-extraneous-import': [ 'n/no-extraneous-import': [
'error', 'error',
{ {
allowModules: [ allowModules: [
'unbuild', 'tsdown',
'unplugin-vue',
'@vben/vite-config', '@vben/vite-config',
'vitest', 'vitest',
'vite', 'vite',
'@vue/test-utils', '@vue/test-utils',
'@vben/tailwind-config',
'@playwright/test', '@playwright/test',
], ],
}, },
], ],
'n/no-new-require': 'error',
'n/no-path-concat': 'error',
// 'n/no-unpublished-import': 'off', // 'n/no-unpublished-import': 'off',
'n/no-unsupported-features/es-syntax': [ 'n/no-unsupported-features/es-syntax': [
'error', 'error',
{ {
ignores: [], ignores: [],
version: '>=18.0.0', version: '>=20.12.0',
}, },
], ],
'n/prefer-global/buffer': ['error', 'never'], 'n/prefer-global/buffer': ['error', 'never'],
@@ -44,6 +41,33 @@ export async function node(): Promise<Linter.Config[]> {
'n/process-exit-as-throw': 'error', 'n/process-exit-as-throw': 'error',
}, },
}, },
{
files: [
'**/__tests__/**/*.?([cm])[jt]s?(x)',
'**/*.spec.?([cm])[jt]s?(x)',
'**/*.test.?([cm])[jt]s?(x)',
'**/*.bench.?([cm])[jt]s?(x)',
'**/*.benchmark.?([cm])[jt]s?(x)',
],
rules: {
'n/prefer-global/process': 'off',
},
},
{
files: ['apps/backend-mock/**/**', 'docs/**/**'],
rules: {
'n/no-extraneous-import': 'off',
'n/prefer-global/buffer': 'off',
'n/prefer-global/process': 'off',
},
},
{
files: ['**/**/playwright.config.ts'],
rules: {
'n/prefer-global/buffer': 'off',
'n/prefer-global/process': 'off',
},
},
{ {
files: [ files: [
'scripts/**/*.?([cm])[jt]s?(x)', 'scripts/**/*.?([cm])[jt]s?(x)',
@@ -4,7 +4,6 @@ import { interopDefault } from '../util';
export async function perfectionist(): Promise<Linter.Config[]> { export async function perfectionist(): Promise<Linter.Config[]> {
const perfectionistPlugin = await interopDefault( const perfectionistPlugin = await interopDefault(
// @ts-expect-error - no types
import('eslint-plugin-perfectionist'), import('eslint-plugin-perfectionist'),
); );
@@ -22,41 +21,58 @@ export async function perfectionist(): Promise<Linter.Config[]> {
'perfectionist/sort-imports': [ 'perfectionist/sort-imports': [
'error', 'error',
{ {
customGroups: { customGroups: [
type: { {
'vben-core-type': ['^@vben-core/.+'], selector: 'type',
'vben-type': ['^@vben/.+'], groupName: 'vben-core-type',
'vue-type': ['^vue$', '^vue-.+', '^@vue/.+'], elementNamePattern: '^@vben-core/.+',
}, },
value: { {
vben: ['^@vben/.+'], selector: 'type',
'vben-core': ['^@vben-core/.+'], groupName: 'vben-type',
vue: ['^vue$', '^vue-.+', '^@vue/.+'], elementNamePattern: '^@vben/.+',
}, },
}, {
selector: 'type',
groupName: 'vue-type',
elementNamePattern: ['^vue$', '^vue-.+', '^@vue/.+'],
},
{
groupName: 'vben',
elementNamePattern: '^@vben/.+',
},
{
groupName: 'vben-core',
elementNamePattern: '^@vben-core/.+',
},
{
groupName: 'vue',
elementNamePattern: ['^vue$', '^vue-.+', '^@vue/.+'],
},
],
environment: 'node', environment: 'node',
groups: [ groups: [
['external-type', 'builtin-type', 'type'], ['type-external', 'type-builtin', 'type-import'],
'vue-type', 'vue-type',
'vben-type', 'vben-type',
'vben-core-type', 'vben-core-type',
['parent-type', 'sibling-type', 'index-type'], ['type-parent', 'type-sibling', 'type-index'],
['internal-type'], ['type-internal'],
'builtin', 'value-builtin',
'vue', 'vue',
'vben', 'vben',
'vben-core', 'vben-core',
'external', 'value-external',
'internal', 'value-internal',
['parent', 'sibling', 'index'], ['value-parent', 'value-sibling', 'value-index'],
'side-effect', 'side-effect',
'side-effect-style', 'side-effect-style',
'style', 'style',
'object', 'ts-equals-import',
'unknown', 'unknown',
], ],
internalPattern: ['^#/.+'], internalPattern: ['^#/.+'],
newlinesBetween: 'always', newlinesBetween: 1,
order: 'asc', order: 'asc',
type: 'natural', type: 'natural',
}, },
@@ -0,0 +1,38 @@
import type { Linter } from 'eslint';
import { interopDefault } from '../util';
export async function pnpm(): Promise<Linter.Config[]> {
const [pluginPnpm, parserPnpm] = await Promise.all([
interopDefault(import('eslint-plugin-pnpm')),
interopDefault(import('yaml-eslint-parser')),
] as const);
return [
{
files: ['package.json', '**/package.json'],
language: 'jsonc/x',
plugins: {
pnpm: pluginPnpm,
},
rules: {
'pnpm/json-enforce-catalog': 'error',
'pnpm/json-prefer-workspace-settings': 'error',
'pnpm/json-valid-catalog': 'error',
},
},
{
files: ['pnpm-workspace.yaml'],
languageOptions: {
parser: parserPnpm,
},
plugins: {
pnpm: pluginPnpm,
},
rules: {
'pnpm/yaml-no-duplicate-catalog-item': 'error',
'pnpm/yaml-no-unused-catalog-item': 'error',
},
},
];
}
@@ -1,19 +0,0 @@
import type { Linter } from 'eslint';
import { interopDefault } from '../util';
export async function prettier(): Promise<Linter.Config[]> {
const [pluginPrettier] = await Promise.all([
interopDefault(import('eslint-plugin-prettier')),
] as const);
return [
{
plugins: {
prettier: pluginPrettier,
},
rules: {
'prettier/prettier': 'error',
},
},
];
}
@@ -1,20 +0,0 @@
import type { Linter } from 'eslint';
import { interopDefault } from '../util';
export async function regexp(): Promise<Linter.Config[]> {
const [pluginRegexp] = await Promise.all([
interopDefault(import('eslint-plugin-regexp')),
] as const);
return [
{
plugins: {
regexp: pluginRegexp,
},
rules: {
...pluginRegexp.configs.recommended.rules,
},
},
];
}
@@ -1,45 +0,0 @@
import type { Linter } from 'eslint';
import { interopDefault } from '../util';
export async function test(): Promise<Linter.Config[]> {
const [pluginTest, pluginNoOnlyTests] = await Promise.all([
interopDefault(import('eslint-plugin-vitest')),
// @ts-expect-error - no types
interopDefault(import('eslint-plugin-no-only-tests')),
] as const);
return [
{
files: [
`**/__tests__/**/*.?([cm])[jt]s?(x)`,
`**/*.spec.?([cm])[jt]s?(x)`,
`**/*.test.?([cm])[jt]s?(x)`,
`**/*.bench.?([cm])[jt]s?(x)`,
`**/*.benchmark.?([cm])[jt]s?(x)`,
],
plugins: {
test: {
...pluginTest,
rules: {
...pluginTest.rules,
...pluginNoOnlyTests.rules,
},
},
},
rules: {
'no-console': 'off',
'node/prefer-global/process': 'off',
'test/consistent-test-it': [
'error',
{ fn: 'it', withinDescribe: 'it' },
],
'test/no-identical-title': 'error',
'test/no-import-node-test': 'error',
'test/no-only-tests': 'error',
'test/prefer-hooks-in-order': 'error',
'test/prefer-lowercase-title': 'error',
},
},
];
}
@@ -1,18 +0,0 @@
import type { Linter } from 'eslint';
import { interopDefault } from '../util';
export async function turbo(): Promise<Linter.Config[]> {
const [pluginTurbo] = await Promise.all([
// @ts-expect-error - no types
interopDefault(import('eslint-config-turbo')),
] as const);
return [
{
plugins: {
turbo: pluginTurbo,
},
},
];
}
@@ -2,12 +2,24 @@ import type { Linter } from 'eslint';
import { interopDefault } from '../util'; import { interopDefault } from '../util';
const rulesCoveredByOxlint = new Set([
'@typescript-eslint/ban-ts-comment',
'@typescript-eslint/no-non-null-assertion',
'@typescript-eslint/no-unused-expressions',
'@typescript-eslint/no-unused-vars',
'@typescript-eslint/triple-slash-reference',
]);
export async function typescript(): Promise<Linter.Config[]> { export async function typescript(): Promise<Linter.Config[]> {
const [pluginTs, parserTs] = await Promise.all([ const [pluginTs, parserTs] = await Promise.all([
interopDefault(import('@typescript-eslint/eslint-plugin')), interopDefault(import('@typescript-eslint/eslint-plugin')),
// @ts-expect-error missing types
interopDefault(import('@typescript-eslint/parser')), interopDefault(import('@typescript-eslint/parser')),
] as const); ] as const);
const strictRules = Object.fromEntries(
Object.entries(pluginTs.configs.strict?.rules ?? {}).filter(
([ruleName]) => !rulesCoveredByOxlint.has(ruleName),
),
);
return [ return [
{ {
@@ -27,44 +39,18 @@ export async function typescript(): Promise<Linter.Config[]> {
}, },
}, },
plugins: { plugins: {
'@typescript-eslint': pluginTs, '@typescript-eslint': pluginTs as any,
}, },
rules: { rules: {
...pluginTs.configs['eslint-recommended'].overrides?.[0].rules, ...pluginTs.configs['eslint-recommended']?.overrides?.[0]?.rules,
...pluginTs.configs.strict.rules, ...strictRules,
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-check': false,
'ts-expect-error': 'allow-with-description',
'ts-ignore': 'allow-with-description',
'ts-nocheck': 'allow-with-description',
},
],
// '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'], // '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
'@typescript-eslint/consistent-type-definitions': 'off', '@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': [
'error',
{
allow: ['arrowFunctions', 'functions', 'methods'],
},
],
'@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off', '@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-use-before-define': 'off', '@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'error',
'unused-imports/no-unused-vars': 'off', 'unused-imports/no-unused-vars': 'off',
}, },
}, },
@@ -2,10 +2,20 @@ import type { Linter } from 'eslint';
import { interopDefault } from '../util'; import { interopDefault } from '../util';
const rulesCoveredByOxlint = new Set([
'unicorn/consistent-function-scoping',
'unicorn/no-process-exit',
'unicorn/prefer-global-this',
'unicorn/prefer-module',
]);
export async function unicorn(): Promise<Linter.Config[]> { export async function unicorn(): Promise<Linter.Config[]> {
const [pluginUnicorn] = await Promise.all([ const pluginUnicorn = await interopDefault(import('eslint-plugin-unicorn'));
interopDefault(import('eslint-plugin-unicorn')), const recommendedRules = Object.fromEntries(
] as const); Object.entries(pluginUnicorn.configs.recommended.rules ?? {}).filter(
([ruleName]) => !rulesCoveredByOxlint.has(ruleName),
),
);
return [ return [
{ {
@@ -13,11 +23,10 @@ export async function unicorn(): Promise<Linter.Config[]> {
unicorn: pluginUnicorn, unicorn: pluginUnicorn,
}, },
rules: { rules: {
...pluginUnicorn.configs.recommended.rules, ...recommendedRules,
'unicorn/better-regex': 'off', 'unicorn/better-regex': 'off',
'unicorn/consistent-destructuring': 'off', 'unicorn/consistent-destructuring': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/expiring-todo-comments': 'off', 'unicorn/expiring-todo-comments': 'off',
'unicorn/filename-case': 'off', 'unicorn/filename-case': 'off',
'unicorn/import-style': 'off', 'unicorn/import-style': 'off',
@@ -27,19 +36,9 @@ export async function unicorn(): Promise<Linter.Config[]> {
'unicorn/prefer-at': 'off', 'unicorn/prefer-at': 'off',
'unicorn/prefer-dom-node-text-content': 'off', 'unicorn/prefer-dom-node-text-content': 'off',
'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }], 'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
'unicorn/prefer-global-this': 'off',
'unicorn/prefer-top-level-await': 'off', 'unicorn/prefer-top-level-await': 'off',
'unicorn/prevent-abbreviations': 'off', 'unicorn/prevent-abbreviations': 'off',
}, },
}, },
{
files: [
'scripts/**/*.?([cm])[jt]s?(x)',
'internal/**/*.?([cm])[jt]s?(x)',
],
rules: {
'unicorn/no-process-exit': 'off',
},
},
]; ];
} }
@@ -6,7 +6,6 @@ export async function vue(): Promise<Linter.Config[]> {
const [pluginVue, parserVue, parserTs] = await Promise.all([ const [pluginVue, parserVue, parserTs] = await Promise.all([
interopDefault(import('eslint-plugin-vue')), interopDefault(import('eslint-plugin-vue')),
interopDefault(import('vue-eslint-parser')), interopDefault(import('vue-eslint-parser')),
// @ts-expect-error missing types
interopDefault(import('@typescript-eslint/parser')), interopDefault(import('@typescript-eslint/parser')),
] as const); ] as const);
@@ -129,7 +128,6 @@ export async function vue(): Promise<Linter.Config[]> {
}, },
], ],
'vue/one-component-per-file': 'error', 'vue/one-component-per-file': 'error',
'vue/prefer-import-from-vue': 'error',
'vue/prefer-separate-static-class': 'error', 'vue/prefer-separate-static-class': 'error',
'vue/prefer-template': 'error', 'vue/prefer-template': 'error',
'vue/prop-name-casing': ['error', 'camelCase'], 'vue/prop-name-casing': ['error', 'camelCase'],
@@ -0,0 +1,87 @@
import type { Linter } from 'eslint';
import { interopDefault } from '../util';
export async function yaml(): Promise<Linter.Config[]> {
const [pluginYaml, parserYaml] = await Promise.all([
interopDefault(import('eslint-plugin-yml')),
interopDefault(import('yaml-eslint-parser')),
] as const);
return [
{
files: ['**/*.y?(a)ml'],
plugins: {
yaml: pluginYaml,
},
languageOptions: {
parser: parserYaml,
},
rules: {
'style/spaced-comment': 'off',
'yaml/block-mapping': 'error',
'yaml/block-sequence': 'error',
'yaml/no-empty-key': 'error',
'yaml/no-empty-sequence-entry': 'error',
'yaml/no-irregular-whitespace': 'error',
'yaml/plain-scalar': 'error',
'yaml/vue-custom-block/no-parsing-error': 'error',
'yaml/block-mapping-question-indicator-newline': 'error',
'yaml/block-sequence-hyphen-indicator-newline': 'error',
'yaml/flow-mapping-curly-newline': 'error',
'yaml/flow-mapping-curly-spacing': 'error',
'yaml/flow-sequence-bracket-newline': 'error',
'yaml/flow-sequence-bracket-spacing': 'error',
'yaml/indent': ['error', 2],
'yaml/key-spacing': 'error',
'yaml/no-tab-indent': 'error',
'yaml/quotes': [
'error',
{
avoidEscape: true,
prefer: 'single',
},
],
'yaml/spaced-comment': 'error',
},
},
{
files: ['pnpm-workspace.yaml'],
rules: {
'yaml/sort-keys': [
'error',
{
order: [
'packages',
'overrides',
'patchedDependencies',
'hoistPattern',
'catalog',
'catalogs',
'allowedDeprecatedVersions',
'allowNonAppliedPatches',
'configDependencies',
'ignoredBuiltDependencies',
'ignoredOptionalDependencies',
'neverBuiltDependencies',
'onlyBuiltDependencies',
'onlyBuiltDependenciesFile',
'packageExtensions',
'peerDependencyRules',
'supportedArchitectures',
],
pathPattern: '^$',
},
{
order: { type: 'asc' },
pathPattern: '.*',
},
],
},
},
];
}
@@ -1,10 +1,6 @@
import type { Linter } from 'eslint'; import type { Linter } from 'eslint';
const restrictedImportIgnores = [ const restrictedImportIgnores = ['**/vite.config.mts'];
'**/vite.config.mts',
'**/tailwind.config.mjs',
'**/postcss.config.mjs',
];
const customConfig: Linter.Config[] = [ const customConfig: Linter.Config[] = [
// shadcn-ui 内部组件是自动生成的,不做太多限制 // shadcn-ui 内部组件是自动生成的,不做太多限制
@@ -25,14 +21,6 @@ const customConfig: Linter.Config[] = [
ignores: restrictedImportIgnores, ignores: restrictedImportIgnores,
rules: { rules: {
'perfectionist/sort-interfaces': 'off', 'perfectionist/sort-interfaces': 'off',
'perfectionist/sort-objects': 'off',
},
},
{
files: ['**/**.vue'],
ignores: restrictedImportIgnores,
rules: {
'perfectionist/sort-objects': 'off',
}, },
}, },
{ {
@@ -67,7 +55,6 @@ const customConfig: Linter.Config[] = [
], ],
}, },
], ],
'perfectionist/sort-interfaces': 'off',
}, },
}, },
{ {
@@ -141,19 +128,12 @@ const customConfig: Linter.Config[] = [
{ {
files: ['apps/backend-mock/**/**', 'docs/**/**'], files: ['apps/backend-mock/**/**', 'docs/**/**'],
rules: { rules: {
'@typescript-eslint/no-extraneous-class': 'off',
'n/no-extraneous-import': 'off',
'n/prefer-global/buffer': 'off',
'n/prefer-global/process': 'off',
'no-console': 'off', 'no-console': 'off',
'unicorn/prefer-module': 'off',
}, },
}, },
{ {
files: ['**/**/playwright.config.ts'], files: ['**/**/playwright.config.ts'],
rules: { rules: {
'n/prefer-global/buffer': 'off',
'n/prefer-global/process': 'off',
'no-console': 'off', 'no-console': 'off',
}, },
}, },
@@ -163,6 +143,12 @@ const customConfig: Linter.Config[] = [
'no-console': 'off', 'no-console': 'off',
}, },
}, },
{
files: ['packages/@core/base/shared/src/utils/inference.ts'],
rules: {
'vue/prefer-import-from-vue': 'off',
},
},
]; ];
export { customConfig }; export { customConfig };
@@ -1,23 +1,16 @@
import type { Linter } from 'eslint'; import type { Linter } from 'eslint';
import { import {
command,
comments,
disableds,
ignores, ignores,
importPluginConfig,
javascript, javascript,
jsdoc,
jsonc, jsonc,
node, node,
perfectionist, perfectionist,
prettier, pnpm,
regexp,
test,
turbo,
typescript, typescript,
unicorn, unicorn,
vue, vue,
yaml,
} from './configs'; } from './configs';
import { customConfig } from './custom-config'; import { customConfig } from './custom-config';
@@ -34,20 +27,13 @@ async function defineConfig(config: FlatConfig[] = []) {
vue(), vue(),
javascript(), javascript(),
ignores(), ignores(),
prettier(),
typescript(), typescript(),
jsonc(), jsonc(),
disableds(),
importPluginConfig(),
node(), node(),
perfectionist(), perfectionist(),
comments(),
jsdoc(),
unicorn(), unicorn(),
test(), yaml(),
regexp(), pnpm(),
command(),
turbo(),
...customConfig, ...customConfig,
...config, ...config,
]; ];
@@ -0,0 +1,16 @@
import { defineConfig } from 'tsdown';
export default defineConfig({
clean: true,
deps: {
skipNodeModulesBundle: true,
},
dts: {
resolver: 'tsc',
},
entry: ['src/index.ts'],
format: ['esm'],
outExtensions: () => ({
dts: '.d.ts',
}),
});
@@ -1,28 +1,32 @@
{ {
"name": "@vben/prettier-config", "name": "@vben/oxfmt-config",
"version": "5.0.0", "version": "5.7.0",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git", "url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "internal/lint-configs/prettier-config" "directory": "internal/lint-configs/oxfmt-config"
}, },
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"scripts": {
"stub": "pnpm exec tsdown"
},
"files": [ "files": [
"dist" "dist"
], ],
"main": "./index.mjs", "main": "./dist/index.mjs",
"module": "./index.mjs", "module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": { "exports": {
".": { ".": {
"default": "./index.mjs" "types": "./dist/index.d.ts",
"import": "./dist/index.mjs"
} }
}, },
"dependencies": { "dependencies": {
"prettier": "catalog:", "oxfmt": "catalog:"
"prettier-plugin-tailwindcss": "catalog:"
} }
} }
@@ -0,0 +1,39 @@
import { defineConfig as defineOxfmtConfig } from 'oxfmt';
type OxfmtConfig = Parameters<typeof defineOxfmtConfig>[0];
const oxfmtConfig: OxfmtConfig = defineOxfmtConfig({
printWidth: 80,
proseWrap: 'never',
semi: true,
singleQuote: true,
sortPackageJson: false,
trailingComma: 'all',
overrides: [
{
files: [
'*.json',
'*.json5',
'*.jsonc',
'*.code-workspace',
'**/*.json',
'**/*.json5',
'**/*.jsonc',
'**/*.code-workspace',
],
options: {
trailingComma: 'none',
},
},
],
});
function defineConfig(config: OxfmtConfig = {}): OxfmtConfig {
return defineOxfmtConfig({
...oxfmtConfig,
...config,
});
}
export { defineConfig, oxfmtConfig };
export type { OxfmtConfig };
@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@vben/tsconfig/node.json",
"include": ["src"],
"exclude": ["node_modules"]
}
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsdown';
export default defineConfig({
clean: true,
dts: true,
entry: ['src/index.ts'],
format: ['esm'],
outExtensions: () => ({
dts: '.d.ts',
}),
});
@@ -0,0 +1,35 @@
{
"name": "@vben/oxlint-config",
"version": "5.7.0",
"private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "internal/lint-configs/oxlint-config"
},
"license": "MIT",
"type": "module",
"scripts": {
"stub": "pnpm exec tsdown"
},
"files": [
"dist"
],
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs"
}
},
"dependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "catalog:",
"eslint-plugin-better-tailwindcss": "catalog:",
"eslint-plugin-command": "catalog:",
"oxlint": "catalog:"
}
}
@@ -0,0 +1,15 @@
import type { OxlintConfig } from 'oxlint';
const command: OxlintConfig = {
jsPlugins: [
{
name: 'command',
specifier: 'eslint-plugin-command',
},
],
rules: {
'command/command': 'error',
},
};
export { command };
@@ -0,0 +1,19 @@
import type { OxlintConfig } from 'oxlint';
const comments: OxlintConfig = {
jsPlugins: [
{
name: 'eslint-comments',
specifier: '@eslint-community/eslint-plugin-eslint-comments',
},
],
rules: {
'eslint/no-underscore-dangle': 'off',
'eslint-comments/no-aggregating-enable': 'error',
'eslint-comments/no-duplicate-disable': 'error',
'eslint-comments/no-unlimited-disable': 'error',
'eslint-comments/no-unused-enable': 'error',
},
};
export { comments };
@@ -0,0 +1,17 @@
import type { OxlintConfig } from 'oxlint';
const ignores: OxlintConfig = {
ignorePatterns: [
'**/dist/**',
'**/node_modules/**',
'docs/**',
'playground/public/**',
'**/*.json',
'**/*.md',
'**/*.svg',
'**/*.yaml',
'**/*.yml',
],
};
export { ignores };
@@ -0,0 +1,18 @@
import type { OxlintConfig } from 'oxlint';
const importPluginConfig: OxlintConfig = {
rules: {
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'import/first': 'error',
'import/no-duplicates': 'error',
'import/no-mutable-exports': 'error',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-named-default': 'error',
'import/no-self-import': 'error',
'import/no-unassigned-import': 'off',
'import/no-webpack-loader-syntax': 'error',
},
};
export { importPluginConfig };
@@ -0,0 +1,96 @@
import type { OxlintConfig } from 'oxlint';
import { defineConfig as defineOxlintConfig } from 'oxlint';
import { command } from './command';
import { comments } from './comments';
import { ignores } from './ignores';
import { importPluginConfig } from './import';
import { javascript } from './javascript';
import { node } from './node';
import { overrides } from './overrides';
import { plugins } from './plugins';
import { tailwindcss } from './tailwindcss';
import { test } from './test';
import { typescript } from './typescript';
import { unicorn } from './unicorn';
import { vue } from './vue';
function mergeOxlintConfigs(...configs: OxlintConfig[]): OxlintConfig {
const merged: OxlintConfig = {};
for (const config of configs) {
merged.categories =
merged.categories && config.categories
? { ...merged.categories, ...config.categories }
: (config.categories ?? merged.categories);
merged.env =
merged.env && config.env
? { ...merged.env, ...config.env }
: (config.env ?? merged.env);
merged.globals =
merged.globals && config.globals
? { ...merged.globals, ...config.globals }
: (config.globals ?? merged.globals);
merged.ignorePatterns = [
...(merged.ignorePatterns ?? []),
...(config.ignorePatterns ?? []),
];
merged.jsPlugins = [
...new Set([...(merged.jsPlugins ?? []), ...(config.jsPlugins ?? [])]),
];
merged.overrides = [
...(merged.overrides ?? []),
...(config.overrides ?? []),
];
merged.plugins = [
...new Set([...(merged.plugins ?? []), ...(config.plugins ?? [])]),
];
merged.rules =
merged.rules && config.rules
? { ...merged.rules, ...config.rules }
: (config.rules ?? merged.rules);
merged.settings =
merged.settings && config.settings
? { ...merged.settings, ...config.settings }
: (config.settings ?? merged.settings);
}
return merged;
}
const oxlintConfig = defineOxlintConfig(
mergeOxlintConfigs(
javascript,
command,
comments,
ignores,
plugins,
importPluginConfig,
node,
overrides,
tailwindcss,
test,
typescript,
unicorn,
vue,
),
);
export {
command,
comments,
ignores,
importPluginConfig,
javascript,
mergeOxlintConfigs,
node,
overrides,
oxlintConfig,
plugins,
tailwindcss,
test,
typescript,
unicorn,
vue,
};
@@ -0,0 +1,131 @@
import type { OxlintConfig } from 'oxlint';
const javascript: OxlintConfig = {
categories: {
correctness: 'error',
suspicious: 'warn',
},
env: {
browser: true,
es2021: true,
node: true,
},
globals: {
document: 'readonly',
navigator: 'readonly',
window: 'readonly',
},
rules: {
'accessor-pairs': [
'error',
{
enforceForClassMembers: true,
setWithoutGet: true,
},
],
'array-callback-return': 'error',
'block-scoped-var': 'error',
'default-case-last': 'error',
eqeqeq: ['error', 'always'],
'eslint/no-unreachable': 'error',
'new-cap': [
'error',
{
capIsNew: false,
newIsCap: true,
properties: true,
},
],
'no-alert': 'error',
'no-array-constructor': 'error',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-control-regex': 'off',
'no-debugger': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-fallthrough': 'error',
'no-new-func': 'error',
'no-object-constructor': 'error',
'no-new-native-nonconstructor': 'error',
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
'no-lone-blocks': 'error',
'no-multi-str': 'error',
'no-nonoctal-decimal-escape': 'error',
'no-proto': 'error',
'no-prototype-builtins': 'error',
'no-redeclare': ['error', { builtinGlobals: false }],
'no-regex-spaces': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-shadow': 'off',
'no-shadow-restricted-names': 'error',
'eslint/no-empty-function': [
'error',
{
allow: ['arrowFunctions', 'functions', 'methods'],
},
],
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTaggedTemplates: true,
allowTernary: true,
},
],
'eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'no-var': 'error',
'no-eval': 'error',
'no-iterator': 'error',
'no-new-wrappers': 'error',
'no-restricted-globals': [
'error',
{ message: 'Use `globalThis` instead.', name: 'global' },
{ message: 'Use `globalThis` instead.', name: 'self' },
],
'no-useless-call': 'error',
'no-useless-computed-key': 'error',
'no-useless-constructor': 'error',
'no-useless-return': 'error',
'prefer-const': [
'error',
{
destructuring: 'all',
ignoreReadBeforeAssign: true,
},
],
'prefer-exponentiation-operator': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'symbol-description': 'error',
'unicode-bom': ['error', 'never'],
'use-isnan': [
'error',
{
enforceForIndexOf: true,
enforceForSwitchCase: true,
},
],
'valid-typeof': [
'error',
{
requireStringLiterals: true,
},
],
'vars-on-top': 'error',
yoda: ['error', 'never'],
},
};
export { javascript };
@@ -0,0 +1,11 @@
import type { OxlintConfig } from 'oxlint';
const node: OxlintConfig = {
rules: {
'node/no-exports-assign': 'error',
'node/no-new-require': 'error',
'node/no-path-concat': 'error',
},
};
export { node };
@@ -0,0 +1,98 @@
import type { OxlintConfig } from 'oxlint';
const overrides: OxlintConfig = {
overrides: [
{
files: ['*.d.ts', '**/*.d.ts'],
rules: {
'import/no-unassigned-import': 'off',
'typescript/triple-slash-reference': 'off',
},
},
{
files: [
'**/__tests__/**/*.js',
'**/__tests__/**/*.cjs',
'**/__tests__/**/*.mjs',
'**/__tests__/**/*.jsx',
'**/__tests__/**/*.ts',
'**/__tests__/**/*.cts',
'**/__tests__/**/*.mts',
'**/__tests__/**/*.tsx',
'**/*.spec.js',
'**/*.spec.cjs',
'**/*.spec.mjs',
'**/*.spec.jsx',
'**/*.spec.ts',
'**/*.spec.cts',
'**/*.spec.mts',
'**/*.spec.tsx',
'**/*.test.js',
'**/*.test.cjs',
'**/*.test.mjs',
'**/*.test.jsx',
'**/*.test.ts',
'**/*.test.cts',
'**/*.test.mts',
'**/*.test.tsx',
'**/*.bench.js',
'**/*.bench.cjs',
'**/*.bench.mjs',
'**/*.bench.jsx',
'**/*.bench.ts',
'**/*.bench.cts',
'**/*.bench.mts',
'**/*.bench.tsx',
'**/*.benchmark.js',
'**/*.benchmark.cjs',
'**/*.benchmark.mjs',
'**/*.benchmark.jsx',
'**/*.benchmark.ts',
'**/*.benchmark.cts',
'**/*.benchmark.mts',
'**/*.benchmark.tsx',
],
rules: {
'no-console': 'off',
},
},
{
files: ['packages/@core/base/shared/src/utils/inference.ts'],
rules: {
'vue/prefer-import-from-vue': 'off',
},
},
{
files: ['packages/@core/ui-kit/menu-ui/src/sub-menu.vue'],
rules: {
'import/no-self-import': 'off',
},
},
{
files: [
'scripts/**/*.js',
'scripts/**/*.cjs',
'scripts/**/*.mjs',
'scripts/**/*.jsx',
'scripts/**/*.ts',
'scripts/**/*.cts',
'scripts/**/*.mts',
'scripts/**/*.tsx',
'internal/**/*.js',
'internal/**/*.cjs',
'internal/**/*.mjs',
'internal/**/*.jsx',
'internal/**/*.ts',
'internal/**/*.cts',
'internal/**/*.mts',
'internal/**/*.tsx',
],
rules: {
'no-console': 'off',
'unicorn/no-process-exit': 'off',
},
},
],
};
export { overrides };
@@ -0,0 +1,7 @@
import type { OxlintConfig } from 'oxlint';
const plugins: OxlintConfig = {
plugins: ['import', 'node', 'oxc', 'typescript', 'unicorn', 'vitest', 'vue'],
};
export { plugins };
@@ -0,0 +1,56 @@
import type { OxlintConfig } from 'oxlint';
import { fileURLToPath } from 'node:url';
import eslintPluginBetterTailwindcss from 'eslint-plugin-better-tailwindcss';
import { getDefaultSelectors } from 'eslint-plugin-better-tailwindcss/defaults';
import { SelectorKind } from 'eslint-plugin-better-tailwindcss/types';
const selectors = [
...getDefaultSelectors(),
{
kind: SelectorKind.Attribute,
match: [{ type: 'objectValues' }],
name: '^classNames$',
},
];
const entryPoint = fileURLToPath(
new URL('../../../../tailwind-config/src/theme.css', import.meta.url),
);
const settings = {
entryPoint,
selectors,
};
const tailwindcss: OxlintConfig = {
// Generated shadcn-ui internals are intentionally left unmanaged.
ignorePatterns: ['packages/@core/ui-kit/shadcn-ui/**/*'],
jsPlugins: [
{
name: 'better-tailwindcss',
specifier: 'eslint-plugin-better-tailwindcss',
},
],
rules: {
...eslintPluginBetterTailwindcss.configs.recommended.rules,
'better-tailwindcss/enforce-consistent-class-order': [
'error',
{
detectComponentClasses: true,
unknownClassOrder: 'asc',
unknownClassPosition: 'start',
},
],
// Let Prettier own wrapping decisions to avoid ping-pong formatting.
'better-tailwindcss/enforce-consistent-line-wrapping': 'off',
'better-tailwindcss/no-unknown-classes': 'off',
},
settings: {
'better-tailwindcss': settings,
'eslint-plugin-better-tailwindcss': settings,
},
};
export { tailwindcss };
@@ -0,0 +1,24 @@
import type { OxlintConfig } from 'oxlint';
const test: OxlintConfig = {
rules: {
'jest/no-conditional-expect': 'off',
'jest/require-to-throw-message': 'off',
'vitest/consistent-test-it': [
'error',
{
fn: 'it',
withinDescribe: 'it',
},
],
'vitest/hoisted-apis-on-top': 'off',
'vitest/no-focused-tests': 'error',
'vitest/no-identical-title': 'error',
'vitest/no-import-node-test': 'error',
'vitest/prefer-hooks-in-order': 'error',
'vitest/prefer-lowercase-title': 'error',
'vitest/require-mock-type-parameters': 'off',
},
};
export { test };
@@ -0,0 +1,28 @@
import type { OxlintConfig } from 'oxlint';
const typescript: OxlintConfig = {
rules: {
'typescript/ban-ts-comment': 'error',
// Keep the first type-aware rollout conservative. These rules currently
// produce high-volume diagnostics and need file-by-file cleanup later.
'typescript/await-thenable': 'off',
'typescript/no-base-to-string': 'off',
'typescript/no-duplicate-type-constituents': 'off',
'typescript/no-floating-promises': 'off',
'typescript/no-misused-spread': 'off',
'typescript/no-non-null-assertion': 'error',
'typescript/no-redundant-type-constituents': 'off',
'typescript/no-unnecessary-boolean-literal-compare': 'off',
'typescript/no-unnecessary-type-assertion': 'off',
'typescript/no-unnecessary-type-arguments': 'off',
'typescript/no-unnecessary-template-expression': 'off',
'typescript/no-unsafe-enum-comparison': 'off',
'typescript/no-unsafe-type-assertion': 'off',
'typescript/no-var-requires': 'error',
'typescript/restrict-template-expressions': 'off',
'typescript/triple-slash-reference': 'error',
'typescript/unbound-method': 'off',
},
};
export { typescript };
@@ -0,0 +1,14 @@
import type { OxlintConfig } from 'oxlint';
const unicorn: OxlintConfig = {
rules: {
'unicorn/consistent-function-scoping': 'off',
'unicorn/no-process-exit': 'error',
'unicorn/no-single-promise-in-promise-methods': 'off',
'unicorn/no-useless-spread': 'off',
'unicorn/prefer-global-this': 'off',
'unicorn/prefer-module': 'error',
},
};
export { unicorn };
@@ -0,0 +1,9 @@
import type { OxlintConfig } from 'oxlint';
const vue: OxlintConfig = {
rules: {
'vue/prefer-import-from-vue': 'error',
},
};
export { vue };
@@ -0,0 +1,21 @@
import type { OxlintConfig } from 'oxlint';
import { defineConfig as defineOxlintConfig } from 'oxlint';
import { mergeOxlintConfigs, oxlintConfig } from './configs';
type VbenOxlintConfig = Omit<OxlintConfig, 'extends'> & {
extends?: OxlintConfig[];
};
function defineConfig(config: VbenOxlintConfig = {}) {
const { extends: extendedConfigs = [], ...restConfig } = config;
return defineOxlintConfig(
mergeOxlintConfigs(oxlintConfig, ...extendedConfigs, restConfig),
);
}
export { defineConfig, oxlintConfig };
export * from './configs';
export type { OxlintConfig, VbenOxlintConfig };
@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@vben/tsconfig/node.json",
"include": ["src"],
"exclude": ["node_modules"]
}
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsdown';
export default defineConfig({
clean: true,
dts: true,
entry: ['src/index.ts'],
format: ['esm'],
outExtensions: () => ({
dts: '.d.ts',
}),
});
@@ -1,18 +0,0 @@
export default {
endOfLine: 'auto',
overrides: [
{
files: ['*.json5'],
options: {
quoteProps: 'preserve',
singleQuote: false,
},
},
],
plugins: ['prettier-plugin-tailwindcss'],
printWidth: 80,
proseWrap: 'never',
semi: true,
singleQuote: true,
trailingComma: 'all',
};
@@ -36,12 +36,7 @@ export default {
files: ['*.scss', '**/*.scss'], files: ['*.scss', '**/*.scss'],
}, },
], ],
plugins: [ plugins: ['stylelint-order', '@stylistic/stylelint-plugin', 'stylelint-scss'],
'stylelint-order',
'@stylistic/stylelint-plugin',
'stylelint-prettier',
'stylelint-scss',
],
rules: { rules: {
'at-rule-no-deprecated': null, 'at-rule-no-deprecated': null,
'at-rule-no-unknown': [ 'at-rule-no-unknown': [
@@ -67,6 +62,12 @@ export default {
'use', 'use',
'forward', 'forward',
'return', 'return',
'reference',
'plugin',
'source',
'theme',
'utility',
'custom-variant',
], ],
}, },
], ],
@@ -75,6 +76,7 @@ export default {
'import-notation': null, 'import-notation': null,
'media-feature-range-notation': null, 'media-feature-range-notation': null,
'named-grid-areas-no-invalid': null, 'named-grid-areas-no-invalid': null,
'nesting-selector-no-missing-scoping-root': null,
'no-descending-specificity': null, 'no-descending-specificity': null,
'no-empty-source': null, 'no-empty-source': null,
'order/order': [ 'order/order': [
@@ -99,7 +101,6 @@ export default {
], ],
{ severity: 'error' }, { severity: 'error' },
], ],
'prettier/prettier': true,
'rule-empty-line-before': [ 'rule-empty-line-before': [
'always', 'always',
{ {
@@ -129,12 +130,18 @@ export default {
'use', 'use',
'forward', 'forward',
'return', 'return',
'reference',
'plugin',
'source',
'theme',
'utility',
'custom-variant',
], ],
}, },
], ],
'scss/operator-no-newline-after': null, 'scss/operator-no-newline-after': null,
'selector-class-pattern': 'selector-class-pattern':
'^(?:(?:o|c|u|t|s|is|has|_|js|qa)-)?[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*(?:__[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*)?(?:--[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*)?(?:[.+])?$', '^-?(?:(?:o|c|u|t|s|is|has|_|js|qa)-)?[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*(?:__[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*)?(?:--[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*)?(?:[.+])?$',
'selector-not-notation': null, 'selector-not-notation': null,
}, },
@@ -1,6 +1,6 @@
{ {
"name": "@vben/stylelint-config", "name": "@vben/stylelint-config",
"version": "5.5.9", "version": "5.7.0",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
@@ -31,13 +31,11 @@
"postcss": "catalog:", "postcss": "catalog:",
"postcss-html": "catalog:", "postcss-html": "catalog:",
"postcss-scss": "catalog:", "postcss-scss": "catalog:",
"prettier": "catalog:",
"stylelint": "catalog:", "stylelint": "catalog:",
"stylelint-config-recommended": "catalog:", "stylelint-config-recommended": "catalog:",
"stylelint-config-recommended-scss": "catalog:", "stylelint-config-recommended-scss": "catalog:",
"stylelint-config-recommended-vue": "catalog:", "stylelint-config-recommended-vue": "catalog:",
"stylelint-config-standard": "catalog:", "stylelint-config-standard": "catalog:",
"stylelint-order": "catalog:", "stylelint-order": "catalog:"
"stylelint-prettier": "catalog:"
} }
} }
@@ -1,7 +0,0 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index'],
});
+3 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "@vben/node-utils", "name": "@vben/node-utils",
"version": "5.5.9", "version": "5.7.0",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
@@ -12,7 +12,7 @@
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"scripts": { "scripts": {
"stub": "pnpm unbuild --stub" "stub": "node ./scripts/build.mjs"
}, },
"files": [ "files": [
"dist" "dist"
@@ -22,7 +22,7 @@
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./src/index.ts", "types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"default": "./dist/index.mjs" "default": "./dist/index.mjs"
} }
@@ -37,7 +37,6 @@
"find-up": "catalog:", "find-up": "catalog:",
"ora": "catalog:", "ora": "catalog:",
"pkg-types": "catalog:", "pkg-types": "catalog:",
"prettier": "catalog:",
"rimraf": "catalog:" "rimraf": "catalog:"
} }
} }
@@ -0,0 +1,40 @@
import { spawnSync } from 'node:child_process';
const pnpmCommand =
process.env.npm_execpath && process.env.npm_execpath.endsWith('.cjs')
? [process.execPath, process.env.npm_execpath]
: ['pnpm'];
const steps = [
['exec', 'tsdown', '--no-dts'],
[
'exec',
'tsc',
'-p',
'tsconfig.build.json',
'--emitDeclarationOnly',
'--declaration',
'--outDir',
'dist',
],
];
for (const args of steps) {
const [command, ...commandArgs] = pnpmCommand;
let cmd = command;
if (cmd.includes(' ')) {
cmd = `"${command}"`;
}
const result = spawnSync(cmd, [...commandArgs, ...args], {
shell: true,
stdio: 'inherit',
});
if (result.error) {
throw result.error;
}
if (result.status !== 0) {
process.exit(result.status ?? 1);
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import timezone from 'dayjs/plugin/timezone'; import timezone from 'dayjs/plugin/timezone.js';
import utc from 'dayjs/plugin/utc'; import utc from 'dayjs/plugin/utc.js';
dayjs.extend(utc); dayjs.extend(utc);
dayjs.extend(timezone); dayjs.extend(timezone);
@@ -0,0 +1,13 @@
import fs from 'node:fs/promises';
import { execa } from 'execa';
async function formatFile(filepath: string) {
await execa('oxfmt', [filepath], {
stdio: 'inherit',
});
return await fs.readFile(filepath, 'utf8');
}
export { formatFile };
+1 -1
View File
@@ -1,12 +1,12 @@
export * from './constants'; export * from './constants';
export * from './date'; export * from './date';
export { formatFile } from './formatter';
export * from './fs'; export * from './fs';
export * from './git'; export * from './git';
export { getStagedFiles, add as gitAdd } from './git'; export { getStagedFiles, add as gitAdd } from './git';
export { generatorContentHash } from './hash'; export { generatorContentHash } from './hash';
export * from './monorepo'; export * from './monorepo';
export { toPosixPath } from './path'; export { toPosixPath } from './path';
export { prettierFormat } from './prettier';
export * from './spinner'; export * from './spinner';
export type { Package } from '@manypkg/get-packages'; export type { Package } from '@manypkg/get-packages';
export { default as colors } from 'chalk'; export { default as colors } from 'chalk';
+22 -12
View File
@@ -1,21 +1,31 @@
import { dirname } from 'node:path'; import type { Package } from '@manypkg/get-packages';
import { import { existsSync } from 'node:fs';
getPackages as getPackagesFunc, import { dirname, join, resolve } from 'node:path';
getPackagesSync as getPackagesSyncFunc,
} from '@manypkg/get-packages'; import * as manypkg from '@manypkg/get-packages';
import { findUpSync } from 'find-up'; const { getPackages: getPackagesFunc, getPackagesSync: getPackagesSyncFunc } =
manypkg;
/** /**
* 查找大仓的根目录 * 查找大仓的根目录
* @param cwd * @param cwd
*/ */
function findMonorepoRoot(cwd: string = process.cwd()) { function findMonorepoRoot(cwd: string = process.cwd()) {
const lockFile = findUpSync('pnpm-lock.yaml', { let currentDir = resolve(cwd);
cwd,
type: 'file', while (true) {
}); if (existsSync(join(currentDir, 'pnpm-lock.yaml'))) {
return dirname(lockFile || ''); return currentDir;
}
const parentDir = dirname(currentDir);
if (parentDir === currentDir) {
return '';
}
currentDir = parentDir;
}
} }
/** /**
@@ -40,7 +50,7 @@ async function getPackages() {
*/ */
async function getPackage(pkgName: string) { async function getPackage(pkgName: string) {
const { packages } = await getPackages(); const { packages } = await getPackages();
return packages.find((pkg) => pkg.packageJson.name === pkgName); return packages.find((pkg: Package) => pkg.packageJson.name === pkgName);
} }
export { findMonorepoRoot, getPackage, getPackages, getPackagesSync }; export { findMonorepoRoot, getPackage, getPackages, getPackagesSync };
@@ -1,21 +0,0 @@
import fs from 'node:fs/promises';
import { format, getFileInfo, resolveConfig } from 'prettier';
async function prettierFormat(filepath: string) {
const prettierOptions = await resolveConfig(filepath, {});
const fileInfo = await getFileInfo(filepath);
const input = await fs.readFile(filepath, 'utf8');
const output = await format(input, {
...prettierOptions,
parser: fileInfo.inferredParser as any,
});
if (output !== input) {
await fs.writeFile(filepath, output, 'utf8');
}
return output;
}
export { prettierFormat };
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"noEmit": false
},
"exclude": ["node_modules", "src/__tests__"]
}
@@ -0,0 +1,10 @@
import { defineConfig } from 'tsdown';
export default defineConfig({
clean: false,
deps: {
skipNodeModulesBundle: true,
},
entry: ['src/index.ts'],
format: ['esm'],
});
@@ -1,10 +0,0 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index', './src/postcss.config'],
rollup: {
emitCJS: true,
},
});
+14 -42
View File
@@ -1,6 +1,6 @@
{ {
"name": "@vben/tailwind-config", "name": "@vben/tailwind-config",
"version": "5.5.9", "version": "5.7.0",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
@@ -11,56 +11,28 @@
}, },
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"scripts": {
"stub": "pnpm unbuild --stub"
},
"files": [ "files": [
"dist" "src"
], ],
"main": "./dist/index.mjs", "sideEffects": [
"module": "./dist/index.mjs", "**/*.css"
"types": "./dist/index.d.ts", ],
"typesVersions": { "main": "./src/index.ts",
"*": { "module": "./src/index.ts",
"*": [ "types": "./src/index.ts",
"./dist/*",
"./*"
]
}
},
"exports": { "exports": {
".": { ".": {
"types": "./src/index.ts", "types": "./src/index.ts",
"import": "./dist/index.mjs", "default": "./src/index.ts"
"require": "./dist/index.cjs"
}, },
"./postcss": { "./theme": {
"types": "./src/postcss.config.ts", "default": "./src/theme.css"
"import": "./dist/postcss.config.mjs", }
"require": "./dist/postcss.config.cjs",
"default": "./dist/postcss.config.mjs"
},
"./*": "./*"
},
"peerDependencies": {
"tailwindcss": "^3.4.3"
}, },
"dependencies": { "dependencies": {
"@iconify/json": "catalog:", "@iconify/tailwind4": "catalog:",
"@iconify/tailwind": "catalog:",
"@manypkg/get-packages": "catalog:",
"@tailwindcss/nesting": "catalog:",
"@tailwindcss/typography": "catalog:", "@tailwindcss/typography": "catalog:",
"autoprefixer": "catalog:",
"cssnano": "catalog:",
"postcss": "catalog:",
"postcss-antd-fixes": "catalog:",
"postcss-import": "catalog:",
"postcss-preset-env": "catalog:",
"tailwindcss": "catalog:", "tailwindcss": "catalog:",
"tailwindcss-animate": "catalog:" "tw-animate-css": "catalog:"
},
"devDependencies": {
"@types/postcss-import": "catalog:"
} }
} }
+1 -266
View File
@@ -1,266 +1 @@
import type { Config } from 'tailwindcss'; import './theme.css';
import path from 'node:path';
import { addDynamicIconSelectors } from '@iconify/tailwind';
import { getPackagesSync } from '@manypkg/get-packages';
import typographyPlugin from '@tailwindcss/typography';
import animate from 'tailwindcss-animate';
import { enterAnimationPlugin } from './plugins/entry';
// import defaultTheme from 'tailwindcss/defaultTheme';
const { packages } = getPackagesSync(process.cwd());
const tailwindPackages: string[] = [];
packages.forEach((pkg) => {
// apps目录下和 @vben-core/tailwind-ui 包需要使用到 tailwindcss ui
// if (fs.existsSync(path.join(pkg.dir, 'tailwind.config.mjs'))) {
tailwindPackages.push(pkg.dir);
// }
});
const shadcnUiColors = {
accent: {
DEFAULT: 'hsl(var(--accent))',
foreground: 'hsl(var(--accent-foreground))',
hover: 'hsl(var(--accent-hover))',
lighter: 'has(val(--accent-lighter))',
},
background: {
deep: 'hsl(var(--background-deep))',
DEFAULT: 'hsl(var(--background))',
},
border: {
DEFAULT: 'hsl(var(--border))',
},
card: {
DEFAULT: 'hsl(var(--card))',
foreground: 'hsl(var(--card-foreground))',
},
destructive: {
...createColorsPalette('destructive'),
DEFAULT: 'hsl(var(--destructive))',
},
foreground: {
DEFAULT: 'hsl(var(--foreground))',
},
input: {
background: 'hsl(var(--input-background))',
DEFAULT: 'hsl(var(--input))',
},
muted: {
DEFAULT: 'hsl(var(--muted))',
foreground: 'hsl(var(--muted-foreground))',
},
popover: {
DEFAULT: 'hsl(var(--popover))',
foreground: 'hsl(var(--popover-foreground))',
},
primary: {
...createColorsPalette('primary'),
DEFAULT: 'hsl(var(--primary))',
},
ring: 'hsl(var(--ring))',
secondary: {
DEFAULT: 'hsl(var(--secondary))',
desc: 'hsl(var(--secondary-desc))',
foreground: 'hsl(var(--secondary-foreground))',
},
};
const customColors = {
green: {
...createColorsPalette('green'),
foreground: 'hsl(var(--success-foreground))',
},
header: {
DEFAULT: 'hsl(var(--header))',
},
heavy: {
DEFAULT: 'hsl(var(--heavy))',
foreground: 'hsl(var(--heavy-foreground))',
},
main: {
DEFAULT: 'hsl(var(--main))',
},
overlay: {
content: 'hsl(var(--overlay-content))',
DEFAULT: 'hsl(var(--overlay))',
},
red: {
...createColorsPalette('red'),
foreground: 'hsl(var(--destructive-foreground))',
},
sidebar: {
deep: 'hsl(var(--sidebar-deep))',
DEFAULT: 'hsl(var(--sidebar))',
},
success: {
...createColorsPalette('success'),
DEFAULT: 'hsl(var(--success))',
},
warning: {
...createColorsPalette('warning'),
DEFAULT: 'hsl(var(--warning))',
},
yellow: {
...createColorsPalette('yellow'),
foreground: 'hsl(var(--warning-foreground))',
},
};
export default {
content: [
'./index.html',
...tailwindPackages.map((item) =>
path.join(item, 'src/**/*.{vue,js,ts,jsx,tsx,svelte,astro,html}'),
),
],
darkMode: 'selector',
plugins: [
animate,
typographyPlugin,
addDynamicIconSelectors(),
enterAnimationPlugin,
],
prefix: '',
theme: {
container: {
center: true,
padding: '2rem',
screens: {
'2xl': '1400px',
},
},
extend: {
animation: {
'accordion-down': 'accordion-down 0.2s ease-out',
'accordion-up': 'accordion-up 0.2s ease-out',
'collapsible-down': 'collapsible-down 0.2s ease-in-out',
'collapsible-up': 'collapsible-up 0.2s ease-in-out',
float: 'float 5s linear 0ms infinite',
},
animationDuration: {
'2000': '2000ms',
'3000': '3000ms',
},
borderRadius: {
lg: 'var(--radius)',
md: 'calc(var(--radius) - 2px)',
sm: 'calc(var(--radius) - 4px)',
xl: 'calc(var(--radius) + 4px)',
},
boxShadow: {
float: `0 6px 16px 0 rgb(0 0 0 / 8%),
0 3px 6px -4px rgb(0 0 0 / 12%),
0 9px 28px 8px rgb(0 0 0 / 5%)`,
},
colors: {
...customColors,
...shadcnUiColors,
},
fontFamily: {
sans: [
'var(--font-family)',
// ...defaultTheme.fontFamily.sans
],
},
keyframes: {
'accordion-down': {
from: { height: '0' },
to: { height: 'var(--radix-accordion-content-height)' },
},
'accordion-up': {
from: { height: 'var(--radix-accordion-content-height)' },
to: { height: '0' },
},
'collapsible-down': {
from: { height: '0' },
to: { height: 'var(--radix-collapsible-content-height)' },
},
'collapsible-up': {
from: { height: 'var(--radix-collapsible-content-height)' },
to: { height: '0' },
},
float: {
'0%': { transform: 'translateY(0)' },
'50%': { transform: 'translateY(-20px)' },
'100%': { transform: 'translateY(0)' },
},
},
zIndex: {
'100': '100',
'1000': '1000',
},
},
},
safelist: ['dark'],
} as Config;
function createColorsPalette(name: string) {
// backgroundLightest: '#EFF6FF', // Tailwind CSS 默认的 `blue-50`
// backgroundLighter: '#DBEAFE', // Tailwind CSS 默认的 `blue-100`
// backgroundLight: '#BFDBFE', // Tailwind CSS 默认的 `blue-200`
// borderLight: '#93C5FD', // Tailwind CSS 默认的 `blue-300`
// border: '#60A5FA', // Tailwind CSS 默认的 `blue-400`
// main: '#3B82F6', // Tailwind CSS 默认的 `blue-500`
// hover: '#2563EB', // Tailwind CSS 默认的 `blue-600`
// active: '#1D4ED8', // Tailwind CSS 默认的 `blue-700`
// backgroundDark: '#1E40AF', // Tailwind CSS 默认的 `blue-800`
// backgroundDarker: '#1E3A8A', // Tailwind CSS 默认的 `blue-900`
// backgroundDarkest: '#172554', // Tailwind CSS 默认的 `blue-950`
// • backgroundLightest (#EFF6FF): 适用于最浅的背景色,可能用于非常轻微的阴影或卡片的背景。
// • backgroundLighter (#DBEAFE): 适用于略浅的背景色,通常用于次要背景或略浅的区域。
// • backgroundLight (#BFDBFE): 适用于浅色背景,可能用于输入框或表单区域的背景。
// • borderLight (#93C5FD): 适用于浅色边框,可能用于输入框或卡片的边框。
// • border (#60A5FA): 适用于普通边框,可能用于按钮或卡片的边框。
// • main (#3B82F6): 适用于主要的主题色,通常用于按钮、链接或主要的强调色。
// • hover (#2563EB): 适用于鼠标悬停状态下的颜色,例如按钮悬停时的背景色或边框色。
// • active (#1D4ED8): 适用于激活状态下的颜色,例如按钮按下时的背景色或边框色。
// • backgroundDark (#1E40AF): 适用于深色背景,可能用于主要按钮或深色卡片背景。
// • backgroundDarker (#1E3A8A): 适用于更深的背景,通常用于头部导航栏或页脚。
// • backgroundDarkest (#172554): 适用于最深的背景,可能用于非常深色的区域或极端对比色。
return {
50: `hsl(var(--${name}-50))`,
100: `hsl(var(--${name}-100))`,
200: `hsl(var(--${name}-200))`,
300: `hsl(var(--${name}-300))`,
400: `hsl(var(--${name}-400))`,
500: `hsl(var(--${name}-500))`,
600: `hsl(var(--${name}-600))`,
700: `hsl(var(--${name}-700))`,
// 800: `hsl(var(--${name}-800))`,
// 900: `hsl(var(--${name}-900))`,
// 950: `hsl(var(--${name}-950))`,
// 激活状态下的颜色,适用于按钮按下时的背景色或边框色。
active: `hsl(var(--${name}-700))`,
// 浅色背景,适用于输入框或表单区域的背景。
'background-light': `hsl(var(--${name}-200))`,
// 适用于略浅的背景色,通常用于次要背景或略浅的区域。
'background-lighter': `hsl(var(--${name}-100))`,
// 最浅的背景色,适用于非常轻微的阴影或卡片的背景。
'background-lightest': `hsl(var(--${name}-50))`,
// 适用于普通边框,可能用于按钮或卡片的边框。
border: `hsl(var(--${name}-400))`,
// 浅色边框,适用于输入框或卡片的边框。
'border-light': `hsl(var(--${name}-300))`,
foreground: `hsl(var(--${name}-foreground))`,
// 鼠标悬停状态下的颜色,适用于按钮悬停时的背景色或边框色。
hover: `hsl(var(--${name}-600))`,
// 主色文本
text: `hsl(var(--${name}-500))`,
// 主色文本激活态
'text-active': `hsl(var(--${name}-700))`,
// 主色文本悬浮态
'text-hover': `hsl(var(--${name}-600))`,
};
}
-3
View File
@@ -1,3 +0,0 @@
declare module '@tailwindcss/nesting' {
export default any;
}
@@ -1,53 +0,0 @@
import plugin from 'tailwindcss/plugin.js';
const enterAnimationPlugin = plugin(({ addUtilities }) => {
const maxChild = 5;
const utilities: Record<string, any> = {};
for (let i = 1; i <= maxChild; i++) {
const baseDelay = 0.1;
const delay = `${baseDelay * i}s`;
utilities[`.enter-x:nth-child(${i})`] = {
animation: `enter-x-animation 0.3s ease-in-out ${delay} forwards`,
opacity: '0',
transform: `translateX(50px)`,
};
utilities[`.enter-y:nth-child(${i})`] = {
animation: `enter-y-animation 0.3s ease-in-out ${delay} forwards`,
opacity: '0',
transform: `translateY(50px)`,
};
utilities[`.-enter-x:nth-child(${i})`] = {
animation: `enter-x-animation 0.3s ease-in-out ${delay} forwards`,
opacity: '0',
transform: `translateX(-50px)`,
};
utilities[`.-enter-y:nth-child(${i})`] = {
animation: `enter-y-animation 0.3s ease-in-out ${delay} forwards`,
opacity: '0',
transform: `translateY(-50px)`,
};
}
// 添加动画关键帧
addUtilities(utilities);
addUtilities({
'@keyframes enter-x-animation': {
to: {
opacity: '1',
transform: 'translateX(0)',
},
},
'@keyframes enter-y-animation': {
to: {
opacity: '1',
transform: 'translateY(0)',
},
},
});
});
export { enterAnimationPlugin };
@@ -1,15 +0,0 @@
import config from '.';
export default {
plugins: {
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {}),
// Specifying the config is not necessary in most cases, but it is included
autoprefixer: {},
// 修复 element-plus 和 ant-design-vue 的样式和tailwindcss冲突问题
'postcss-antd-fixes': { prefixes: ['ant', 'el'] },
'postcss-import': {},
'postcss-preset-env': {},
tailwindcss: { config },
'tailwindcss/nesting': {},
},
};
@@ -0,0 +1,579 @@
@import 'tailwindcss';
@import 'tw-animate-css';
@plugin '@tailwindcss/typography';
@plugin '@iconify/tailwind4';
/* Monorepo source detection: scan all packages and apps for utility classes */
@source '../../../packages/';
@source '../../../apps/';
@source '../../../docs/';
@source '../../../playground/';
/* Dark mode uses .dark class selector, not prefers-color-scheme */
@custom-variant dark (&:is(.dark *));
/* Explicitly pin Tailwind v4 dynamic spacing for classes like w-150/h-55. */
@theme {
--spacing: 0.25rem;
}
@theme inline {
/* Font */
--font-sans: var(--font-family);
/* Border Radius */
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
/* Box Shadow */
--shadow-float:
0 6px 16px 0 rgb(0 0 0 / 8%), 0 3px 6px -4px rgb(0 0 0 / 12%),
0 9px 28px 8px rgb(0 0 0 / 5%);
/* Animations */
--animate-accordion-down: accordion-down 0.2s ease-out;
--animate-accordion-up: accordion-up 0.2s ease-out;
--animate-collapsible-down: collapsible-down 0.2s ease-in-out;
--animate-collapsible-up: collapsible-up 0.2s ease-in-out;
--animate-float: float 5s linear 0ms infinite;
/* ===== Semantic Colors (shadcn-ui) ===== */
--color-background: hsl(var(--background));
--color-background-deep: hsl(var(--background-deep));
--color-foreground: hsl(var(--foreground));
--color-card: hsl(var(--card));
--color-card-foreground: hsl(var(--card-foreground));
--color-popover: hsl(var(--popover));
--color-popover-foreground: hsl(var(--popover-foreground));
--color-muted: hsl(var(--muted));
--color-muted-foreground: hsl(var(--muted-foreground));
--color-accent: hsl(var(--accent));
--color-accent-foreground: hsl(var(--accent-foreground));
--color-accent-hover: hsl(var(--accent-hover));
--color-accent-lighter: hsl(var(--accent-lighter));
--color-border: hsl(var(--border));
--color-input: hsl(var(--input));
--color-input-background: hsl(var(--input-background));
--color-ring: hsl(var(--ring));
--color-secondary: hsl(var(--secondary));
--color-secondary-desc: hsl(var(--secondary-desc));
--color-secondary-foreground: hsl(var(--secondary-foreground));
/* ===== Custom Semantic Colors ===== */
--color-header: hsl(var(--header));
--color-heavy: hsl(var(--heavy));
--color-heavy-foreground: hsl(var(--heavy-foreground));
--color-main: hsl(var(--main));
--color-overlay: hsl(var(--overlay));
--color-overlay-content: hsl(var(--overlay-content));
--color-sidebar: hsl(var(--sidebar));
--color-sidebar-deep: hsl(var(--sidebar-deep));
/* ===== Primary Palette ===== */
--color-primary: hsl(var(--primary));
--color-primary-foreground: hsl(var(--primary-foreground));
--color-primary-50: hsl(var(--primary-50));
--color-primary-100: hsl(var(--primary-100));
--color-primary-200: hsl(var(--primary-200));
--color-primary-300: hsl(var(--primary-300));
--color-primary-400: hsl(var(--primary-400));
--color-primary-500: hsl(var(--primary-500));
--color-primary-600: hsl(var(--primary-600));
--color-primary-700: hsl(var(--primary-700));
--color-primary-active: hsl(var(--primary-700));
--color-primary-background-light: hsl(var(--primary-200));
--color-primary-background-lighter: hsl(var(--primary-100));
--color-primary-background-lightest: hsl(var(--primary-50));
--color-primary-border: hsl(var(--primary-400));
--color-primary-border-light: hsl(var(--primary-300));
--color-primary-hover: hsl(var(--primary-600));
--color-primary-text: hsl(var(--primary-500));
--color-primary-text-active: hsl(var(--primary-700));
--color-primary-text-hover: hsl(var(--primary-600));
/* ===== Destructive Palette ===== */
--color-destructive: hsl(var(--destructive));
--color-destructive-foreground: hsl(var(--destructive-foreground));
--color-destructive-50: hsl(var(--destructive-50));
--color-destructive-100: hsl(var(--destructive-100));
--color-destructive-200: hsl(var(--destructive-200));
--color-destructive-300: hsl(var(--destructive-300));
--color-destructive-400: hsl(var(--destructive-400));
--color-destructive-500: hsl(var(--destructive-500));
--color-destructive-600: hsl(var(--destructive-600));
--color-destructive-700: hsl(var(--destructive-700));
--color-destructive-active: hsl(var(--destructive-700));
--color-destructive-background-light: hsl(var(--destructive-200));
--color-destructive-background-lighter: hsl(var(--destructive-100));
--color-destructive-background-lightest: hsl(var(--destructive-50));
--color-destructive-border: hsl(var(--destructive-400));
--color-destructive-border-light: hsl(var(--destructive-300));
--color-destructive-hover: hsl(var(--destructive-600));
--color-destructive-text: hsl(var(--destructive-500));
--color-destructive-text-active: hsl(var(--destructive-700));
--color-destructive-text-hover: hsl(var(--destructive-600));
/* ===== Success Palette ===== */
--color-success: hsl(var(--success));
--color-success-foreground: hsl(var(--success-foreground));
--color-success-50: hsl(var(--success-50));
--color-success-100: hsl(var(--success-100));
--color-success-200: hsl(var(--success-200));
--color-success-300: hsl(var(--success-300));
--color-success-400: hsl(var(--success-400));
--color-success-500: hsl(var(--success-500));
--color-success-600: hsl(var(--success-600));
--color-success-700: hsl(var(--success-700));
--color-success-active: hsl(var(--success-700));
--color-success-background-light: hsl(var(--success-200));
--color-success-background-lighter: hsl(var(--success-100));
--color-success-background-lightest: hsl(var(--success-50));
--color-success-border: hsl(var(--success-400));
--color-success-border-light: hsl(var(--success-300));
--color-success-hover: hsl(var(--success-600));
--color-success-text: hsl(var(--success-500));
--color-success-text-active: hsl(var(--success-700));
--color-success-text-hover: hsl(var(--success-600));
/* ===== Warning Palette ===== */
--color-warning: hsl(var(--warning));
--color-warning-foreground: hsl(var(--warning-foreground));
--color-warning-50: hsl(var(--warning-50));
--color-warning-100: hsl(var(--warning-100));
--color-warning-200: hsl(var(--warning-200));
--color-warning-300: hsl(var(--warning-300));
--color-warning-400: hsl(var(--warning-400));
--color-warning-500: hsl(var(--warning-500));
--color-warning-600: hsl(var(--warning-600));
--color-warning-700: hsl(var(--warning-700));
--color-warning-active: hsl(var(--warning-700));
--color-warning-background-light: hsl(var(--warning-200));
--color-warning-background-lighter: hsl(var(--warning-100));
--color-warning-background-lightest: hsl(var(--warning-50));
--color-warning-border: hsl(var(--warning-400));
--color-warning-border-light: hsl(var(--warning-300));
--color-warning-hover: hsl(var(--warning-600));
--color-warning-text: hsl(var(--warning-500));
--color-warning-text-active: hsl(var(--warning-700));
--color-warning-text-hover: hsl(var(--warning-600));
/* ===== Green Palette (alias for success shades) ===== */
--color-green-50: hsl(var(--green-50));
--color-green-100: hsl(var(--green-100));
--color-green-200: hsl(var(--green-200));
--color-green-300: hsl(var(--green-300));
--color-green-400: hsl(var(--green-400));
--color-green-500: hsl(var(--green-500));
--color-green-600: hsl(var(--green-600));
--color-green-700: hsl(var(--green-700));
--color-green-active: hsl(var(--green-700));
--color-green-background-light: hsl(var(--green-200));
--color-green-background-lighter: hsl(var(--green-100));
--color-green-background-lightest: hsl(var(--green-50));
--color-green-border: hsl(var(--green-400));
--color-green-border-light: hsl(var(--green-300));
--color-green-foreground: hsl(var(--success-foreground));
--color-green-hover: hsl(var(--green-600));
--color-green-text: hsl(var(--green-500));
--color-green-text-active: hsl(var(--green-700));
--color-green-text-hover: hsl(var(--green-600));
/* ===== Red Palette (alias for destructive shades) ===== */
--color-red-50: hsl(var(--red-50));
--color-red-100: hsl(var(--red-100));
--color-red-200: hsl(var(--red-200));
--color-red-300: hsl(var(--red-300));
--color-red-400: hsl(var(--red-400));
--color-red-500: hsl(var(--red-500));
--color-red-600: hsl(var(--red-600));
--color-red-700: hsl(var(--red-700));
--color-red-active: hsl(var(--red-700));
--color-red-background-light: hsl(var(--red-200));
--color-red-background-lighter: hsl(var(--red-100));
--color-red-background-lightest: hsl(var(--red-50));
--color-red-border: hsl(var(--red-400));
--color-red-border-light: hsl(var(--red-300));
--color-red-foreground: hsl(var(--destructive-foreground));
--color-red-hover: hsl(var(--red-600));
--color-red-text: hsl(var(--red-500));
--color-red-text-active: hsl(var(--red-700));
--color-red-text-hover: hsl(var(--red-600));
/* ===== Yellow Palette (alias for warning shades) ===== */
--color-yellow-50: hsl(var(--yellow-50));
--color-yellow-100: hsl(var(--yellow-100));
--color-yellow-200: hsl(var(--yellow-200));
--color-yellow-300: hsl(var(--yellow-300));
--color-yellow-400: hsl(var(--yellow-400));
--color-yellow-500: hsl(var(--yellow-500));
--color-yellow-600: hsl(var(--yellow-600));
--color-yellow-700: hsl(var(--yellow-700));
--color-yellow-active: hsl(var(--yellow-700));
--color-yellow-background-light: hsl(var(--yellow-200));
--color-yellow-background-lighter: hsl(var(--yellow-100));
--color-yellow-background-lightest: hsl(var(--yellow-50));
--color-yellow-border: hsl(var(--yellow-400));
--color-yellow-border-light: hsl(var(--yellow-300));
--color-yellow-foreground: hsl(var(--warning-foreground));
--color-yellow-hover: hsl(var(--yellow-600));
--color-yellow-text: hsl(var(--yellow-500));
--color-yellow-text-active: hsl(var(--yellow-700));
--color-yellow-text-hover: hsl(var(--yellow-600));
}
/* Keyframes */
@keyframes accordion-down {
from {
height: 0;
}
to {
height: var(--reka-accordion-content-height);
}
}
@keyframes accordion-up {
from {
height: var(--reka-accordion-content-height);
}
to {
height: 0;
}
}
@keyframes collapsible-down {
from {
height: 0;
}
to {
height: var(--reka-collapsible-content-height);
}
}
@keyframes collapsible-up {
from {
height: var(--reka-collapsible-content-height);
}
to {
height: 0;
}
}
@keyframes float {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-20px);
}
100% {
transform: translateY(0);
}
}
/* Base styles */
@layer base {
*,
::after,
::before {
@apply border-border outline-ring/50;
box-sizing: border-box;
border-style: solid;
border-width: 0;
}
html {
@apply text-foreground bg-background font-sans;
scroll-behavior: smooth;
font-size: var(--font-size-base, 16px);
font-variation-settings: normal;
font-synthesis-weight: none;
line-height: 1.15;
text-rendering: optimizelegibility;
text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
}
#app,
body,
html {
@apply size-full;
}
body {
min-height: 100vh;
}
a,
a:active,
a:hover,
a:link,
a:visited {
@apply no-underline;
}
::view-transition-new(root),
::view-transition-old(root) {
@apply animate-none mix-blend-normal;
}
::view-transition-old(root) {
@apply z-1;
}
::view-transition-new(root) {
@apply z-2147483646;
}
html.dark::view-transition-old(root) {
@apply z-2147483646;
}
html.dark::view-transition-new(root) {
@apply z-1;
}
input::placeholder,
textarea::placeholder {
@apply opacity-100;
}
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
@apply m-0 appearance-none;
}
/* Only adjust scrollbar for non-macOS */
html:not([data-platform='macOs']) {
::-webkit-scrollbar {
@apply h-2.5 w-2.5;
}
::-webkit-scrollbar-thumb {
@apply bg-border rounded-sm border-none;
}
::-webkit-scrollbar-track {
@apply rounded-sm border-none bg-transparent shadow-none;
}
::-webkit-scrollbar-button {
@apply hidden;
}
}
/* Tailwind v4 Preflight 不再为 button 默认设置 pointer;见官方升级说明:
* https://tailwindcss.com/docs/upgrade-guide#buttons-use-the-default-cursor */
button:not(:disabled),
[role='button']:not(:disabled) {
@apply cursor-pointer;
}
}
/* Custom utilities (v4 @utility syntax) */
@utility flex-center {
display: flex;
align-items: center;
justify-content: center;
}
@utility flex-col-center {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* Tailwind v4 的 utilities 在 @layer 内;组件样式若留在 layer 外,会按层叠规则压过 py-4 等工具类。
* 见:https://tailwindcss.com/docs/adding-custom-styles#using-css-and-layering */
@layer components {
.outline-box {
@apply outline-border relative cursor-pointer rounded-md p-1 outline-1;
}
.outline-box::after {
@apply absolute top-1/2 left-1/2 z-20 h-0 w-px rounded-sm opacity-0 outline-2 outline-transparent transition-all duration-300 content-[""];
}
.outline-box.outline-box-active {
@apply outline-primary outline-2;
}
.outline-box.outline-box-active::after {
display: none;
}
.outline-box:not(.outline-box-active):hover::after {
@apply outline-primary top-0 left-0 h-full w-full p-1 opacity-100;
}
.vben-link {
@apply text-primary hover:text-primary-hover active:text-primary-active cursor-pointer;
}
.card-box {
@apply bg-card text-card-foreground border-border rounded-xl border;
}
}
/* Enter animations (converted from enterAnimationPlugin) */
@keyframes enter-x-animation {
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes enter-y-animation {
to {
opacity: 1;
transform: translateY(0);
}
}
.enter-x:nth-child(1) {
opacity: 0;
transform: translateX(50px);
animation: enter-x-animation 0.3s ease-in-out 0.1s forwards;
}
.enter-x:nth-child(2) {
opacity: 0;
transform: translateX(50px);
animation: enter-x-animation 0.3s ease-in-out 0.2s forwards;
}
.enter-x:nth-child(3) {
opacity: 0;
transform: translateX(50px);
animation: enter-x-animation 0.3s ease-in-out 0.3s forwards;
}
.enter-x:nth-child(4) {
opacity: 0;
transform: translateX(50px);
animation: enter-x-animation 0.3s ease-in-out 0.4s forwards;
}
.enter-x:nth-child(5) {
opacity: 0;
transform: translateX(50px);
animation: enter-x-animation 0.3s ease-in-out 0.5s forwards;
}
.enter-y:nth-child(1) {
opacity: 0;
transform: translateY(50px);
animation: enter-y-animation 0.3s ease-in-out 0.1s forwards;
}
.enter-y:nth-child(2) {
opacity: 0;
transform: translateY(50px);
animation: enter-y-animation 0.3s ease-in-out 0.2s forwards;
}
.enter-y:nth-child(3) {
opacity: 0;
transform: translateY(50px);
animation: enter-y-animation 0.3s ease-in-out 0.3s forwards;
}
.enter-y:nth-child(4) {
opacity: 0;
transform: translateY(50px);
animation: enter-y-animation 0.3s ease-in-out 0.4s forwards;
}
.enter-y:nth-child(5) {
opacity: 0;
transform: translateY(50px);
animation: enter-y-animation 0.3s ease-in-out 0.5s forwards;
}
.-enter-x:nth-child(1) {
opacity: 0;
transform: translateX(-50px);
animation: enter-x-animation 0.3s ease-in-out 0.1s forwards;
}
.-enter-x:nth-child(2) {
opacity: 0;
transform: translateX(-50px);
animation: enter-x-animation 0.3s ease-in-out 0.2s forwards;
}
.-enter-x:nth-child(3) {
opacity: 0;
transform: translateX(-50px);
animation: enter-x-animation 0.3s ease-in-out 0.3s forwards;
}
.-enter-x:nth-child(4) {
opacity: 0;
transform: translateX(-50px);
animation: enter-x-animation 0.3s ease-in-out 0.4s forwards;
}
.-enter-x:nth-child(5) {
opacity: 0;
transform: translateX(-50px);
animation: enter-x-animation 0.3s ease-in-out 0.5s forwards;
}
.-enter-y:nth-child(1) {
opacity: 0;
transform: translateY(-50px);
animation: enter-y-animation 0.3s ease-in-out 0.1s forwards;
}
.-enter-y:nth-child(2) {
opacity: 0;
transform: translateY(-50px);
animation: enter-y-animation 0.3s ease-in-out 0.2s forwards;
}
.-enter-y:nth-child(3) {
opacity: 0;
transform: translateY(-50px);
animation: enter-y-animation 0.3s ease-in-out 0.3s forwards;
}
.-enter-y:nth-child(4) {
opacity: 0;
transform: translateY(-50px);
animation: enter-y-animation 0.3s ease-in-out 0.4s forwards;
}
.-enter-y:nth-child(5) {
opacity: 0;
transform: translateY(-50px);
animation: enter-y-animation 0.3s ease-in-out 0.5s forwards;
}
html.invert-mode {
@apply invert;
}
html.grayscale-mode {
@apply grayscale;
}
@@ -1,9 +1,6 @@
{ {
"$schema": "https://json.schemastore.org/tsconfig", "$schema": "https://json.schemastore.org/tsconfig",
"extends": "@vben/tsconfig/node.json", "extends": "@vben/tsconfig/web.json",
"compilerOptions": {
"moduleResolution": "bundler"
},
"include": ["src"], "include": ["src"],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }
+1
View File
@@ -5,6 +5,7 @@
"compilerOptions": { "compilerOptions": {
"composite": false, "composite": false,
"lib": ["ESNext"], "lib": ["ESNext"],
"moduleResolution": "bundler",
"types": ["node"], "types": ["node"],
"noImplicitAny": true "noImplicitAny": true
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@vben/tsconfig", "name": "@vben/tsconfig",
"version": "5.5.9", "version": "5.7.0",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
@@ -1,7 +0,0 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index'],
});
+7 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@vben/vite-config", "name": "@vben/vite-config",
"version": "5.5.9", "version": "5.7.0",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
@@ -12,7 +12,7 @@
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"scripts": { "scripts": {
"stub": "pnpm unbuild --stub" "stub": "pnpm exec tsdown"
}, },
"files": [ "files": [
"dist" "dist"
@@ -29,6 +29,8 @@
"dependencies": { "dependencies": {
"@intlify/unplugin-vue-i18n": "catalog:", "@intlify/unplugin-vue-i18n": "catalog:",
"@jspm/generator": "catalog:", "@jspm/generator": "catalog:",
"@tailwindcss/vite": "catalog:",
"@vben/node-utils": "workspace:*",
"archiver": "catalog:", "archiver": "catalog:",
"cheerio": "catalog:", "cheerio": "catalog:",
"get-port": "catalog:", "get-port": "catalog:",
@@ -42,18 +44,17 @@
"@pnpm/workspace.read-manifest": "catalog:", "@pnpm/workspace.read-manifest": "catalog:",
"@types/archiver": "catalog:", "@types/archiver": "catalog:",
"@types/html-minifier-terser": "catalog:", "@types/html-minifier-terser": "catalog:",
"@vben/node-utils": "workspace:*",
"@vitejs/plugin-vue": "catalog:", "@vitejs/plugin-vue": "catalog:",
"@vitejs/plugin-vue-jsx": "catalog:", "@vitejs/plugin-vue-jsx": "catalog:",
"dayjs": "catalog:", "dayjs": "catalog:",
"dotenv": "catalog:", "dotenv": "catalog:",
"rollup": "catalog:", "rolldown": "catalog:",
"rollup-plugin-visualizer": "catalog:", "rollup-plugin-visualizer": "catalog:",
"sass": "catalog:", "sass": "catalog:",
"sass-embedded": "catalog:",
"unplugin-dts": "catalog:",
"vite": "catalog:", "vite": "catalog:",
"vite-plugin-compression": "catalog:", "vite-plugin-compression": "catalog:",
"vite-plugin-dts": "catalog:",
"vite-plugin-html": "catalog:",
"vite-plugin-lazy-import": "catalog:" "vite-plugin-lazy-import": "catalog:"
} }
} }
@@ -6,7 +6,7 @@ import path, { relative } from 'node:path';
import { findMonorepoRoot } from '@vben/node-utils'; import { findMonorepoRoot } from '@vben/node-utils';
import { NodePackageImporter } from 'sass'; import { NodePackageImporter } from 'sass-embedded';
import { defineConfig, loadEnv, mergeConfig } from 'vite'; import { defineConfig, loadEnv, mergeConfig } from 'vite';
import { defaultImportmapOptions, getDefaultPwaOptions } from '../options'; import { defaultImportmapOptions, getDefaultPwaOptions } from '../options';
@@ -58,25 +58,23 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
const applicationConfig: UserConfig = { const applicationConfig: UserConfig = {
base, base,
build: { build: {
rollupOptions: { rolldownOptions: {
output: { output: {
assetFileNames: '[ext]/[name]-[hash].[ext]', assetFileNames: '[ext]/[name]-[hash].[ext]',
chunkFileNames: 'js/[name]-[hash].js', chunkFileNames: 'js/[name]-[hash].js',
entryFileNames: 'jse/index-[name]-[hash].js', entryFileNames: 'jse/index-[name]-[hash].js',
minify: isBuild
? {
compress: {
dropDebugger: true,
},
}
: false,
}, },
}, },
target: 'es2015', target: 'es2015',
}, },
css: createCssOptions(injectGlobalScss), css: createCssOptions(injectGlobalScss),
esbuild: {
drop: isBuild
? [
// 'console',
'debugger',
]
: [],
legalComments: 'none',
},
plugins, plugins,
server: { server: {
host: true, host: true,
@@ -114,7 +112,7 @@ function createCssOptions(injectGlobalScss = true): CSSOptions {
} }
return content; return content;
}, },
api: 'modern', // api: 'modern',
importers: [new NodePackageImporter()], importers: [new NodePackageImporter()],
}, },
} }

Some files were not shown because too many files have changed in this diff Show More