Skip to content

refactor(datagrid-web): layout 4/4: boundary lint rule - #2578

Open
iobuhov wants to merge 1 commit into
datagrid-layout-4-tokensfrom
datagrid-layout-5-boundaries
Open

iobuhov wants to merge 1 commit into
datagrid-layout-4-tokensfrom
datagrid-layout-5-boundaries

Conversation

@iobuhov

@iobuhov iobuhov commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Part 4/4 of the datagrid-web restructure. Config only. No source files change.

This PR adds import-x/no-restricted-paths to datagrid-web/eslint.config.mjs. The shared config already ships eslint-plugin-import-x, so there is no new dependency. The rule needs a resolver that knows .ts/.tsx, so the config sets import-x/resolver: { node: { extensions } } for src. Without it the rule silently skips every relative import. There is no allow-list.

Boundaries

Allowed:

  • The composition (src/*.ts(x), src/editor/, src/__tests__/) may import anything. editor/ is the Studio Pro preview composition, so it counts as root.
  • Any feature may import features/core.
  • A feature may import another feature's tokens.ts.

Forbidden:

  • features/core importing any other feature.
  • ui/ importing features or the composition.
  • A feature importing another feature's internals.
  • A feature importing the composition.

There is one exception. Specs under __tests__/ may import the composition, because feature specs use src/__tests__/test-utils.tsx and createDatagridContainer. Specs still may not import another feature's internals.

Crossings resolved earlier in the stack

was resolution
columns/GridHeader -> selection/CheckboxColumnHeader, pagination hooks lays out several features' pieces -> src root (#2579)
datasource/loader/RowSkeletonLoader -> columns/SelectorCell lays out several features' pieces, only importer is GridBody -> src root (#2579)
selection/CheckboxCell -> row-interaction hooks hooks now live in row-interaction/tokens.ts (#2577)
columns/HeaderSkeletonLoader -> datasource/loader/SkeletonLoader not moved to columns, stays with the loaders (#2579)
columns/grid.model -> pagination/GridSize.store type-only, via pagination/tokens.ts (#2577)
data-export/useDataExport (+ spec), datasource/DerivedLoaderController -> columns/ColumnGroupStore type-only, via columns/tokens.ts (#2577)
datasource/DatasourceParamsController -> columns/GridColumn type-only, via columns/tokens.ts (#2577)
personalization/* -> columns/{ColumnGroupStore,GridColumn,column-settings} type-only, via columns/tokens.ts (#2577)

I checked that the rule fires by adding temporary imports for each forbidden direction. Each one was reported, and the allowed ones (another feature's tokens.ts, features/core) were not. The forbidden imports I tried:

  • core to a feature, and core to another feature's tokens
  • ui to a feature, to features/core, to the src root and to editor/
  • a feature to the src root, to editor/ and to src/__tests__
  • a feature to another feature's component and to its internal types
  • a spec to another feature's internals

Chain

  1. personalization: refactor(datagrid-web): structure 2/12: personalization #2560
  2. move src to the feature layout (move only): refactor(datagrid-web): move src to feature layout #2579
  3. tokens, bindings and hooks per feature: refactor(datagrid-web): layout 3/4: tokens.ts as each feature's public surface #2577
  4. boundary lint rule: refactor(datagrid-web): layout 4/4: boundary lint rule #2578

Checks

Verified locally at this commit in packages/pluggableWidgets/datagrid-web: tsc --noEmit, pnpm run lint (0 errors, the same 10 warnings as the base), pnpm run test (22 suites, 263 tests pass) and pnpm turbo build. A dependency-graph check over src finds no import cycles. No changelog entry, because there is no user-facing change.

🤖 Generated with Claude Code

@github-actions

This comment has been minimized.

@iobuhov
iobuhov force-pushed the datagrid-layout-4-tokens branch from 422b4dd to 1a933fd Compare November 24, 2026 15:26
@iobuhov
iobuhov force-pushed the datagrid-layout-5-boundaries branch from 01d7065 to 03cf39c Compare November 24, 2026 15:27
@github-actions

This comment has been minimized.

@iobuhov
iobuhov force-pushed the datagrid-layout-4-tokens branch from 1a933fd to 711dd6e Compare November 24, 2026 15:35
@iobuhov
iobuhov force-pushed the datagrid-layout-5-boundaries branch from 03cf39c to dd0b53d Compare November 24, 2026 15:35
@iobuhov iobuhov changed the title refactor(datagrid-web): layout 5/5: boundary lint rule refactor(datagrid-web): layout 4/4: boundary lint rule Nov 24, 2026
@github-actions

This comment has been minimized.

- a feature imports another feature only through its tokens.ts
- features/core imports no other feature
- ui imports no feature and nothing from the composition root
- features import nothing from the composition root (src/*, editor/,
  src/__tests__), except from tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iobuhov
iobuhov force-pushed the datagrid-layout-4-tokens branch from 711dd6e to 07011b1 Compare November 24, 2026 15:40
@iobuhov
iobuhov force-pushed the datagrid-layout-5-boundaries branch from dd0b53d to 6ef9141 Compare November 24, 2026 15:40
@github-actions

Copy link
Copy Markdown
Contributor

AI Code Review

✅ Approved — no issues found


What was reviewed

File Change
packages/pluggableWidgets/datagrid-web/eslint.config.mjs Adds import-x/no-restricted-paths zones for the features/core, ui/, feature-to-feature and feature-to-root boundaries. Adds a node resolver that knows .ts/.tsx. Adds a __tests__ override that lets specs import the composition root.

Skipped (out of scope): dist/, pnpm-lock.yaml

CI: pending: triage · unrelated failures: security/snyk (dependency scan on a config-only change)


Positives

  • The change is config only, with no source or runtime change. A changelog entry is correctly omitted.
  • The boundaries are explicit and generated from one features list. The tokens.ts and features/core exceptions are encoded with except. The spec override reuses the same zone builder, so the rules can't drift apart.
  • The PR description lists each forbidden direction that was tried, and says the rule reported it. It also says the resolver setting is needed, because without it the rule silently skips relative imports.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant