chore: 强化代码质量与风格检查体系
ESLint 升级到 recommended-type-checked + stylistic-type-checked, 引入 perfectionist 导入排序和 import 插件导入验证。 Prettier 显式声明全部格式化参数,消除跨环境差异。 TypeScript 启用 noUnusedLocals 和 noPropertyAccessFromIndexSignature。 完善 ignore 列表,排除 .agents/、bun.lock、data/ 等。 引入 husky + lint-staged(pre-commit)+ commitlint(commit-msg)。 更新 DEVELOPMENT.md 代码质量章节。 修复所有新增规则检测到的类型和风格违规。
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { truncateActual, mismatchFailure, errorFailure } from "../../../../../src/server/checker/runner/shared/failure";
|
||||
|
||||
import { errorFailure, mismatchFailure, truncateActual } from "../../../../../src/server/checker/runner/shared/failure";
|
||||
|
||||
describe("truncateActual", () => {
|
||||
test("短字符串不截断", () => {
|
||||
@@ -43,12 +44,12 @@ describe("mismatchFailure", () => {
|
||||
test("返回正确的 mismatch 结构", () => {
|
||||
const f = mismatchFailure("status", "status", [200], 500, "status mismatch");
|
||||
expect(f).toEqual({
|
||||
kind: "mismatch",
|
||||
phase: "status",
|
||||
path: "status",
|
||||
expected: [200],
|
||||
actual: 500,
|
||||
expected: [200],
|
||||
kind: "mismatch",
|
||||
message: "status mismatch",
|
||||
path: "status",
|
||||
phase: "status",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -65,9 +66,9 @@ describe("errorFailure", () => {
|
||||
const f = errorFailure("body", "body[0].json($.x)", "body is not valid JSON");
|
||||
expect(f).toEqual({
|
||||
kind: "error",
|
||||
phase: "body",
|
||||
path: "body[0].json($.x)",
|
||||
message: "body is not valid JSON",
|
||||
path: "body[0].json($.x)",
|
||||
phase: "body",
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user