module-file-to-folder
When a module should stay one file, and when it should become a folder.
Deterministic checkAdvises by default
The rule
Agents read this text as written when they write and review code.
Keep a module in one file until it needs files of its own. When a module folder holds only its main file, turn it back into a file.
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
srcbillingRateLimiter
// Incorrect: the folder holds nothing but its main file. It belongs at// src/billing/RateLimiter.ts.export class RateLimiter {isAllowed({ count }: { count: number }): boolean {return count < 10;}}
Correct
srcbillingRetryPolicy
// Correct: a module with no files of its own is one file.export class RateLimiter {isAllowed({ count }: { count: number }): boolean {return count < 10;}}
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": {"module-file-to-folder": "advisory"}}