From a7e88c7bc046ce2a4e7291d8088fa657dea9211b Mon Sep 17 00:00:00 2001 From: DrJKL Date: Thu, 14 May 2026 11:45:07 -0700 Subject: [PATCH] chore(eslint): forbid litegraph imports in src/world/ Adds a no-restricted-paths zone enforcing that src/world/ cannot import from src/lib/litegraph/. The world layer owns canonical entity identity (WidgetEntityId, value store I/O) and must not depend on litegraph types or values; this rule prevents accidental coupling. Two existing imports in entityIds.ts (`NodeId`, `UUID`) are temporarily suppressed with eslint-disable-next-line + TODO comments: - NodeId will become a branded EntityId owned by src/world/. - UUID is a primitive string brand and should move to src/utils/. Amp-Thread-ID: https://ampcode.com/threads/T-019e2561-ca22-76fa-8356-0c6f92548f8d Co-authored-by: Amp --- eslint.config.ts | 9 ++++++++- src/world/entityIds.ts | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/eslint.config.ts b/eslint.config.ts index b5f36864b7..2b0b67ec40 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -374,7 +374,8 @@ export default defineConfig([ files: [ 'src/base/**/*.{ts,vue}', 'src/platform/**/*.{ts,vue}', - 'src/workbench/**/*.{ts,vue}' + 'src/workbench/**/*.{ts,vue}', + 'src/world/**/*.{ts,vue}' ], rules: { 'import-x/no-restricted-paths': [ @@ -402,6 +403,12 @@ export default defineConfig([ from: './src/renderer/**', message: 'workbench/ cannot import from renderer/ (violates layer architecture: base → platform → workbench → renderer)' + }, + { + target: './src/world/**', + from: './src/lib/litegraph/**', + message: + 'src/world/ must remain free of litegraph dependencies. The world layer owns canonical entity identity and must not depend on litegraph types or values.' } ] } diff --git a/src/world/entityIds.ts b/src/world/entityIds.ts index c3f031d022..cb9c2ed945 100644 --- a/src/world/entityIds.ts +++ b/src/world/entityIds.ts @@ -1,4 +1,10 @@ +// TODO: NodeId will become a branded EntityId owned by src/world/. Once that +// migration lands, drop this disable. +// eslint-disable-next-line import-x/no-restricted-paths import type { NodeId } from '@/lib/litegraph/src/LGraphNode' +// TODO: Move UUID to src/utils/ (or src/world/) — it's a primitive string +// brand with no litegraph coupling. Once moved, drop this disable. +// eslint-disable-next-line import-x/no-restricted-paths import type { UUID } from '@/lib/litegraph/src/utils/uuid' import type { Brand } from './brand'