原来只有 Prettier,没有任何 lint。根目录加 `bun run lint`(oxlint,覆盖后端、前端、
契约,--deny-warnings:有一条就算失败),CLAUDE.md 常用检查里加上。
现存 19 条顺手清掉:
- 11 处未使用的 import / catch 参数 / 回调参数
- oj/store/problem.ts:`...problem.value?.languages` 展开可能是 undefined
(外层 if 已经保证非空,去掉 ?.)
- admin/problem/detail.vue:`contestId = contestId` 自赋值,删掉
- judge/sql/engine.ts:注释里的 `/*x*/` 示例原来靠零宽空格防止提前闭合注释,
改成 `*\/`
- 其余:多余的 !!、new Array(n)、展开里多余的 `|| {}`
两边类型检查、前端构建、后端单二进制编译都过。
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
83b9d23c68
commit
f8b04af4ea
20 files changed
+61
-23
No files matched your search
@@ -755,7 +755,7 @@ export const problemTag = pgTable(
|
||||
id: serial().primaryKey().notNull(),
|
||||
name: text().notNull(),
|
||||
},
|
||||
(table) => [
|
||||
() => [
|
||||
uniqueIndex("problem_tag_name_ci_unique").using("btree", sql`lower(name)`),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -159,7 +159,7 @@ function iterate(db: Database, script: string): Iterable<PreparedStatement> {
|
||||
|
||||
/**
|
||||
* 取语句的首关键字。优先用 sqlite3_normalized_sql —— 归一化由 SQLite 自己做,
|
||||
* 注释、大小写、空白都已抹平(`/*x*/ pragma Query_Only = 0` → `PRAGMA query_only=?`),
|
||||
* 注释、大小写、空白都已抹平(`/*x*\/ pragma Query_Only = 0` → `PRAGMA query_only=?`),
|
||||
* 比在原文上自己做词法猜测可靠得多。
|
||||
*/
|
||||
function leadingKeyword(statement: PreparedStatement) {
|
||||
|
||||
@@ -2,7 +2,6 @@ import { randomBytes } from "node:crypto"
|
||||
import { resolve } from "node:path"
|
||||
|
||||
import {
|
||||
rankProfileSchema,
|
||||
registerRequestSchema,
|
||||
STUDENT_ROLES,
|
||||
updateProfileRequestSchema,
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { AuthUser } from "../../auth/session"
|
||||
import { db, schema } from "../../db"
|
||||
import { failure, parseBody, success } from "../../http"
|
||||
import { contestStatus } from "../../services/contest"
|
||||
import { objectValue, queryInteger, sampleUser } from "../helpers"
|
||||
import { queryInteger, sampleUser } from "../helpers"
|
||||
|
||||
export const adminContestRoutes = new Hono<AppEnv>()
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
createMessageRequestSchema,
|
||||
embeddedSubmissionSchema,
|
||||
exerciseAttemptRequestSchema,
|
||||
reactionKeySchema,
|
||||
setReactionRequestSchema,
|
||||
|
||||
@@ -147,7 +147,7 @@ flowchartRoutes.post("/flowcharts", requireAuth, async (c) => {
|
||||
})
|
||||
try {
|
||||
await flowchartQueue.add("evaluate", { submissionId: id }, { jobId: id })
|
||||
} catch (error) {
|
||||
} catch {
|
||||
await db
|
||||
.update(schema.flowchartSubmission)
|
||||
.set({ status: 3 })
|
||||
@@ -642,7 +642,7 @@ flowchartRoutes.post("/flowcharts/:id/retry", requireAuth, async (c) => {
|
||||
{ submissionId: row.flowchart.id },
|
||||
{ jobId: `${row.flowchart.id}:retry:${Date.now()}` },
|
||||
)
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// 入队失败就落 FAILED,别把提交丢在 PENDING 上 —— 和 POST /flowcharts 同一处理
|
||||
await db
|
||||
.update(schema.flowchartSubmission)
|
||||
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
import { Hono } from "hono"
|
||||
|
||||
import { optionalAuth, requireTeacher } from "../auth/middleware"
|
||||
import type { AuthUser } from "../auth/session"
|
||||
import { db, schema } from "../db"
|
||||
import { failure, success } from "../http"
|
||||
import {
|
||||
|
||||
Reference in new issue
Block a user