circular-dependencies
Modules that depend on each other.
Deterministic checkAdvises by default
The rule
Agents read this text as written when they write and review code.
Never let two modules import each other. Move the piece they share, usually a type, into a third module both import, or move code as file-placement says.
A cycle makes load order fragile and breaks tree-shaking.
Examples
The check flags the incorrect code and passes the correct code. 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
srccustomersorders
import { getOrderTotal } from '../orders/getOrderTotal';export const getCustomerTier = ({ customerId }: { customerId: string }): string =>getOrderTotal({ amount: 100, customerId }) > 90 ? 'standard' : 'gold';
Correct
srccommontypescustomersorders
export type CustomerTier = 'gold' | 'standard';
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-rule-settings": {"circular-dependencies": "advisory"}}