circular-dependencies
Flags two modules that import each other.
Agent checkAdvises by default
Why this rule
Module A importing B importing A creates fragile load order and breaks tree-shaking. Fix by extracting the shared piece (usually a type) into a third module both import, or restructure per the placement hierarchy.
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
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-checks": {"circular-dependencies": "advisory"}}