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 <amp@ampcode.com>
This commit is contained in:
DrJKL
2026-05-14 11:45:07 -07:00
parent 3c99b75312
commit a7e88c7bc0
2 changed files with 14 additions and 1 deletions

View File

@@ -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.'
}
]
}

View File

@@ -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'