cross-package-sharing
Flags code two packages need duplicated per package instead of moved to the shared one.
Agent checkAdvises by default
Why this rule
Cross-Package Sharing (packages/shared/)
Code needed by 2+ packages belongs in a shared package — not duplicated per-package.
A pure-contracts/shared package — one where everything is public by design —
is a common/-like space: its src/ holds domain folders, not modules.
The companion test decides this per folder: a folder whose every file is
something its users call directly is a domain folder.
Examples
The agent flags code like the incorrect example and accepts code like the correct one. Each example is a small repo, because this rule looks across files. It opens on the file that matters; the other files are the repo around it.
Incorrect
packagesapisrcpermissionsutilsfrontendsrcpermissionsutils
export const hasPermission = () => true;
Correct
packagesapisrcauthsharedsrcpermissionsutils
import { hasPermission } from '@scope/shared/permissions/utils/hasPermission';export const getAuth = hasPermission;
Configure
- Block
"blocking"Stops a run when a file the run changed breaks the rule. - AdviseDefault
"advisory"Reports it and hands it to the refactor agent. Never stops a run. - Off
"off"Not checked. Use it when your own linter already enforces the rule.
Add this to your lightsout.config.json, then change the value.
{"standards-checks": {"cross-package-sharing": "advisory"}}