Files
twenty/packages/twenty-oxlint-rules/rules/enforce-module-boundaries.spec.ts
T
Raphaël Bosi 9c9c34fccf Remove twenty-ui-deprecated and migrate frontend to twenty-ui (#21596)
Migrates `twenty-front`, `twenty-sdk`, and
`twenty-front-component-renderer` from `twenty-ui-deprecated` to
`twenty-ui` (mechanical import swap — the packages have API parity) and
deletes the deprecated package along with its workspace/CI/config
wiring.

Also adds `@linaria/react`/`@linaria/core` as direct deps of
`twenty-front` (it used them transitively via the deprecated package).

Note: move the required status check from `ci-ui-status-check` to
`ci-new-ui-status-check`.

Argos: the Storybook box-model/button-reset baseline shift (the bulk of
the visual diffs) is isolated in #21665 — Storybook now loads
twenty-ui's global `reset.scss`, which the production app already ships.
Once #21665 merges and this branch is rebased, the remaining Argos diffs
are component-level visual-parity items only.
2026-06-17 09:41:11 +00:00

82 lines
2.4 KiB
TypeScript

import { RuleTester } from 'oxlint/plugins-dev';
import { rule, RULE_NAME } from './enforce-module-boundaries';
const depConstraints = [
{
sourceTag: 'scope:frontend',
onlyDependOnLibsWithTags: ['scope:shared', 'scope:frontend'],
},
{
sourceTag: 'scope:backend',
onlyDependOnLibsWithTags: ['scope:shared', 'scope:backend'],
},
{
sourceTag: 'scope:shared',
onlyDependOnLibsWithTags: ['scope:shared'],
},
];
const ruleTester = new RuleTester();
ruleTester.run(RULE_NAME, rule, {
valid: [
{
code: "import { isDefined } from 'twenty-shared';",
options: [{ depConstraints }],
filename: '/project/packages/twenty-front/src/utils.ts',
},
{
code: "import { Button } from 'twenty-ui';",
options: [{ depConstraints }],
filename: '/project/packages/twenty-front/src/components.tsx',
},
{
code: "import { isDefined } from 'twenty-shared';",
options: [{ depConstraints }],
filename: '/project/packages/twenty-server/src/utils.ts',
},
{
code: "import { helper } from './local';",
options: [{ depConstraints }],
filename: '/project/packages/twenty-front/src/utils.ts',
},
{
code: "import lodash from 'lodash';",
options: [{ depConstraints }],
filename: '/project/packages/twenty-front/src/utils.ts',
},
{
code: "import { isDefined } from 'twenty-shared';",
options: [{ depConstraints: [] }],
filename: '/project/packages/twenty-front/src/utils.ts',
},
],
invalid: [
{
code: "import { ServerService } from 'twenty-server';",
options: [{ depConstraints }],
filename: '/project/packages/twenty-front/src/bad-import.ts',
errors: [{ messageId: 'moduleBoundaryViolation' }],
},
{
code: "import { Component } from 'twenty-front';",
options: [{ depConstraints }],
filename: '/project/packages/twenty-server/src/bad-import.ts',
errors: [{ messageId: 'moduleBoundaryViolation' }],
},
{
code: "import { Component } from 'twenty-front';",
options: [{ depConstraints }],
filename: '/project/packages/twenty-shared/src/bad-import.ts',
errors: [{ messageId: 'moduleBoundaryViolation' }],
},
{
code: "import { ServerThing } from 'twenty-server';",
options: [{ depConstraints }],
filename: '/project/packages/twenty-shared/src/bad-import.ts',
errors: [{ messageId: 'moduleBoundaryViolation' }],
},
],
});