release: v0.5.0 — 覆盖率96.42%达标、lint零警告、覆盖率门禁、CI强化、发布自动化

- 覆盖率 96.42%(行):新增 59 测试共 385 个,覆盖 DOM 交互事件、对话框按钮交互、Intl/localStorage 异常路径、React 渲染生命周期
- 测试环境重构:SSR 分支用 defineProperty 真正覆盖 document/window;新增 tests/dom.test.ts、tests/setup.ts
- jest 覆盖率门禁 lines >= 95%;CI lint 改必过;新增 publish.yml(v* tag 自动发布到 Gitea registry)
- 修复:Toast.off 空数组残留、Toast.on 取消函数 this 绑定、action close:false 冒泡关闭、use() 重复注册钩子、i18n catch 引用错误
- 删除死代码 autoApplySystemTheme;lint 零警告(no-console 策略 + caughtErrorsIgnorePattern)
This commit is contained in:
tianhao
2026-08-08 15:02:51 +08:00
parent bbff631f4f
commit 1f718c4ef8
41 changed files with 1146 additions and 281 deletions
+7 -7
View File
@@ -1,7 +1,7 @@
/**
* MetonaToast i18n — 国际化管理
* @module i18n
* @version 0.4.0
* @version 0.5.0
*/
import { LOCALES } from './constants.js';
@@ -405,7 +405,7 @@ export const clearLocaleListeners = (): void => {
export const formatNumber = (number: number, options: Intl.NumberFormatOptions = {}): string => {
try {
return new Intl.NumberFormat(currentLocale, options).format(number);
} catch (e) {
} catch {
return number.toString();
}
};
@@ -420,7 +420,7 @@ export const formatCurrency = (amount: number, currency = 'USD', options: Intl.N
currency,
...options,
}).format(amount);
} catch (e) {
} catch {
return amount.toString();
}
};
@@ -436,7 +436,7 @@ export const formatPercent = (value: number, options: Intl.NumberFormatOptions =
maximumFractionDigits: 2,
...options,
}).format(value / 100);
} catch (e) {
} catch {
return `${value}%`;
}
};
@@ -448,7 +448,7 @@ export const formatDate = (date: Date | number | string, options: Intl.DateTimeF
try {
const dateObj = date instanceof Date ? date : new Date(date);
return new Intl.DateTimeFormat(currentLocale, options).format(dateObj);
} catch (e) {
} catch {
return String(date);
}
};
@@ -497,7 +497,7 @@ export const formatRelativeTime = (date: Date | number | string, options: Intl.R
}
return String(date);
} catch (e) {
} catch {
return String(date);
}
};
@@ -524,7 +524,7 @@ export const formatList = (list: string[], _options: Record<string, unknown> = {
export const formatPlural = (count: number, options: Intl.PluralRulesOptions = {}): string => {
try {
return new Intl.PluralRules(currentLocale, options).select(count);
} catch (e) {
} catch {
return count === 1 ? 'one' : 'other';
}
};