Keep the duty draft exports inside the knip baseline
Why: the settings page only needs the draft operations the views call. Extra aliases and unused helpers pushed the unused-export count over the baseline. Evidence: SELF node scripts/check-knip.mjs reported 43 <= 43, and duty-draft vitest passed. Impact: chapter-review command aliases are gone from the settings gate. The draft behavior is unchanged. Refs: modules/frontend/knip-baseline.json Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+4
-11
@@ -1,7 +1,7 @@
|
||||
// 文档职责草稿的唯一存储。三个视图只投影这份数据;单元格值由三权反推。
|
||||
export type CellDuty = 'none' | 'author' | 'reviewer' | 'approver'
|
||||
|
||||
export interface DutyRoles {
|
||||
interface DutyRoles {
|
||||
author: string
|
||||
reviewers: string[]
|
||||
approver: string
|
||||
@@ -28,7 +28,7 @@ export interface DutyMember {
|
||||
canApprove: boolean
|
||||
}
|
||||
|
||||
export interface DutySaveItem {
|
||||
interface DutySaveItem {
|
||||
docId: string
|
||||
author: string
|
||||
reviewers: string[]
|
||||
@@ -80,7 +80,7 @@ export function replacementNote(roles: DutyRoles, owner: string, duty: CellDuty)
|
||||
return ''
|
||||
}
|
||||
|
||||
export function dutyConflicts(roles: DutyRoles): number {
|
||||
function dutyConflicts(roles: DutyRoles): number {
|
||||
const seen = new Map<string, number>()
|
||||
const mark = (owner: string) => {
|
||||
if (!owner) return
|
||||
@@ -112,11 +112,7 @@ export function saveIssues(roles: DutyRoles): string[] {
|
||||
return issues
|
||||
}
|
||||
|
||||
export function sameRoles(a: DutyRoles, b: DutyRoles): boolean {
|
||||
return a.author === b.author && a.approver === b.approver && a.reviewers.join('\0') === b.reviewers.join('\0')
|
||||
}
|
||||
|
||||
export function rolesFromCells(docId: string, cells: { docId: string; owner: string; duty: string }[]): DutyRoles {
|
||||
function rolesFromCells(docId: string, cells: { docId: string; owner: string; duty: string }[]): DutyRoles {
|
||||
const roles: DutyRoles = { author: '', reviewers: [], approver: '' }
|
||||
for (const cell of cells) {
|
||||
if (cell.docId !== docId) continue
|
||||
@@ -198,6 +194,3 @@ export function savePayload(docs: DutyDocDraft[], confirmInvalidation: boolean):
|
||||
}
|
||||
}
|
||||
|
||||
export function needsInvalidationConfirm(docs: DutyDocDraft[]): boolean {
|
||||
return dirtyDocs(docs).some(doc => doc.activeRound > 0)
|
||||
}
|
||||
|
||||
@@ -63,9 +63,6 @@ export const RDM_DUTY_COMMANDS = [
|
||||
'rdm.review.assign.doc.batch',
|
||||
] as const
|
||||
|
||||
/** @deprecated 设置页已改用 RDM_DUTY_COMMANDS。保留导出名,避免旧调用点仍指向审签命令。 */
|
||||
export const RDM_DOC_REVIEW_COMMANDS = RDM_DUTY_COMMANDS
|
||||
|
||||
export type CommandListItem = { id?: string; enabled?: boolean } | null | undefined
|
||||
|
||||
function ready(cmds: CommandListItem[] | null | undefined, need: readonly string[]): boolean {
|
||||
@@ -85,9 +82,6 @@ export const rdmMembersReady = (cmds: CommandListItem[] | null | undefined) =>
|
||||
export const rdmDutyReady = (cmds: CommandListItem[] | null | undefined) =>
|
||||
ready(cmds, RDM_DUTY_COMMANDS)
|
||||
|
||||
/** @deprecated 使用 rdmDutyReady。 */
|
||||
export const rdmDocReviewReady = rdmDutyReady
|
||||
|
||||
/** 项目权限矩阵页是否就绪。 */
|
||||
export const rdmPermMatrixReady = (cmds: CommandListItem[] | null | undefined) =>
|
||||
ready(cmds, RDM_PERM_MATRIX_COMMANDS)
|
||||
|
||||
Reference in New Issue
Block a user