refactor(web): extract allocation multi-drag session
This commit is contained in:
@@ -251,6 +251,17 @@ export const rules = [
|
||||
],
|
||||
forbidden: [],
|
||||
},
|
||||
{
|
||||
file: "apps/web/src/hooks/timelineAllocationMultiDragSession.ts",
|
||||
maxLines: 90,
|
||||
required: [
|
||||
{
|
||||
pattern: /\bexport function beginAllocationMultiDragSession\b/,
|
||||
message: "timeline allocation multi-drag session helpers must keep document drag lifecycle centralized",
|
||||
},
|
||||
],
|
||||
forbidden: [],
|
||||
},
|
||||
{
|
||||
file: "apps/web/src/hooks/timelineAllocationActions.ts",
|
||||
maxLines: 90,
|
||||
@@ -410,6 +421,10 @@ export const rules = [
|
||||
pattern: /from "\.\/timelineAllocationMultiDrag\.js"/,
|
||||
message: "timeline drag must keep allocation multi-drag rules delegated to the extracted helper module",
|
||||
},
|
||||
{
|
||||
pattern: /from "\.\/timelineAllocationMultiDragSession\.js"/,
|
||||
message: "timeline drag must keep allocation multi-drag document session wiring delegated to the extracted helper module",
|
||||
},
|
||||
{
|
||||
pattern: /from "\.\/timelineAllocationDragState\.js"/,
|
||||
message: "timeline drag must keep allocation drag bootstrap delegated to the extracted helper module",
|
||||
@@ -460,6 +475,10 @@ export const rules = [
|
||||
pattern: /\bfunction (?:isAllocationMultiSelected|startAllocationMultiDrag|updateAllocationMultiDrag|finalizeAllocationMultiDrag)\b/,
|
||||
message: "timeline drag must not re-inline extracted allocation multi-drag helper implementations",
|
||||
},
|
||||
{
|
||||
pattern: /\bfunction handleMulti(?:Move|Up)\b/,
|
||||
message: "timeline drag must not re-inline extracted allocation multi-drag session handlers",
|
||||
},
|
||||
{
|
||||
pattern: /\bfunction createAllocationDragState\b/,
|
||||
message: "timeline drag must not re-inline extracted allocation drag bootstrap helpers",
|
||||
|
||||
@@ -79,6 +79,9 @@ describe("architecture guardrails", () => {
|
||||
const optimisticRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineOptimisticAllocations.ts");
|
||||
const allocationFinalizeRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineAllocationFinalize.ts");
|
||||
const allocationMultiDragRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineAllocationMultiDrag.ts");
|
||||
const allocationMultiDragSessionRule = rules.find(
|
||||
(rule) => rule.file === "apps/web/src/hooks/timelineAllocationMultiDragSession.ts",
|
||||
);
|
||||
const allocationActionsRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineAllocationActions.ts");
|
||||
const allocationReleaseRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineAllocationRelease.ts");
|
||||
const cleanupRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineDragCleanup.ts");
|
||||
@@ -98,6 +101,7 @@ describe("architecture guardrails", () => {
|
||||
assert.ok(optimisticRule);
|
||||
assert.ok(allocationFinalizeRule);
|
||||
assert.ok(allocationMultiDragRule);
|
||||
assert.ok(allocationMultiDragSessionRule);
|
||||
assert.ok(allocationActionsRule);
|
||||
assert.ok(allocationReleaseRule);
|
||||
assert.ok(cleanupRule);
|
||||
@@ -121,6 +125,7 @@ describe("architecture guardrails", () => {
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep project and allocation drag position derivation delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep document mouse listener lifecycle delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep allocation multi-drag rules delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep allocation multi-drag document session wiring delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep allocation drag bootstrap delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep project drag bootstrap and mutation gating delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep project drag document session wiring delegated to the extracted helper module",
|
||||
@@ -170,6 +175,10 @@ describe("architecture guardrails", () => {
|
||||
"apps/web/src/hooks/timelineAllocationMultiDrag.ts: missing guardrail anchor: timeline allocation multi-drag helpers must keep reset-on-release behavior centralized",
|
||||
]);
|
||||
|
||||
assert.deepEqual(evaluateRule(allocationMultiDragSessionRule, ""), [
|
||||
"apps/web/src/hooks/timelineAllocationMultiDragSession.ts: missing guardrail anchor: timeline allocation multi-drag session helpers must keep document drag lifecycle centralized",
|
||||
]);
|
||||
|
||||
assert.deepEqual(evaluateRule(allocationActionsRule, "export function buildAllocationBlockClickInfo() {}\n"), [
|
||||
"apps/web/src/hooks/timelineAllocationActions.ts: missing guardrail anchor: timeline allocation action helpers must keep mutation plan derivation centralized",
|
||||
]);
|
||||
@@ -221,6 +230,7 @@ describe("architecture guardrails", () => {
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep project and allocation drag position derivation delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep document mouse listener lifecycle delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep allocation multi-drag rules delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep allocation multi-drag document session wiring delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep allocation drag bootstrap delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep project drag bootstrap and mutation gating delegated to the extracted helper module",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep project drag document session wiring delegated to the extracted helper module",
|
||||
|
||||
Reference in New Issue
Block a user