refactor(web): extract project drag session
This commit is contained in:
@@ -329,6 +329,17 @@ export const rules = [
|
||||
],
|
||||
forbidden: [],
|
||||
},
|
||||
{
|
||||
file: "apps/web/src/hooks/timelineProjectDragSession.ts",
|
||||
maxLines: 70,
|
||||
required: [
|
||||
{
|
||||
pattern: /\bexport function beginProjectDragSession\b/,
|
||||
message: "timeline project drag session helpers must keep document drag lifecycle centralized",
|
||||
},
|
||||
],
|
||||
forbidden: [],
|
||||
},
|
||||
{
|
||||
file: "apps/web/src/hooks/useTimelineDrag.ts",
|
||||
required: [
|
||||
@@ -388,6 +399,10 @@ export const rules = [
|
||||
pattern: /from "\.\/timelineProjectDrag\.js"/,
|
||||
message: "timeline drag must keep project drag bootstrap and mutation gating delegated to the extracted helper module",
|
||||
},
|
||||
{
|
||||
pattern: /from "\.\/timelineProjectDragSession\.js"/,
|
||||
message: "timeline drag must keep project drag document session wiring delegated to the extracted helper module",
|
||||
},
|
||||
],
|
||||
forbidden: [
|
||||
{
|
||||
|
||||
@@ -85,6 +85,7 @@ describe("architecture guardrails", () => {
|
||||
const documentDragRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineDocumentDrag.ts");
|
||||
const allocationDragStateRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineAllocationDragState.ts");
|
||||
const projectDragRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineProjectDrag.ts");
|
||||
const projectDragSessionRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineProjectDragSession.ts");
|
||||
|
||||
assert.ok(dragRule);
|
||||
assert.ok(livePreviewRule);
|
||||
@@ -102,6 +103,7 @@ describe("architecture guardrails", () => {
|
||||
assert.ok(documentDragRule);
|
||||
assert.ok(allocationDragStateRule);
|
||||
assert.ok(projectDragRule);
|
||||
assert.ok(projectDragSessionRule);
|
||||
|
||||
assert.deepEqual(evaluateRule(dragRule, "function clearLivePreview() {}\n"), [
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep live preview behavior delegated to the extracted helper module",
|
||||
@@ -118,6 +120,7 @@ describe("architecture guardrails", () => {
|
||||
"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 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",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: forbidden pattern matched: timeline drag must not re-inline live preview helper implementations",
|
||||
]);
|
||||
|
||||
@@ -189,6 +192,10 @@ describe("architecture guardrails", () => {
|
||||
"apps/web/src/hooks/timelineProjectDrag.ts: missing guardrail anchor: timeline project drag helpers must keep no-op project-shift mutation gating centralized",
|
||||
]);
|
||||
|
||||
assert.deepEqual(evaluateRule(projectDragSessionRule, ""), [
|
||||
"apps/web/src/hooks/timelineProjectDragSession.ts: missing guardrail anchor: timeline project drag session helpers must keep document drag lifecycle centralized",
|
||||
]);
|
||||
|
||||
assert.deepEqual(
|
||||
evaluateRule(
|
||||
dragRule,
|
||||
@@ -208,6 +215,7 @@ describe("architecture guardrails", () => {
|
||||
"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 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",
|
||||
"apps/web/src/hooks/useTimelineDrag.ts: forbidden pattern matched: timeline drag must not re-inline synthetic touch pointer adapters",
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user