common-folder-layout
What the inside of a common folder looks like.
Deterministic checkAdvises by default
The rule
Agents read this text as written when they write and review code.
Inside common/:
- A function or class sits directly in
common/. - A type goes in
common/types/, a constant incommon/constants/. A value not written as a function or class is a constant, one built by a call included.
Then where a shared file goes is never a choice, and a reader knows where to look.
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
srcbillingcommon
// Incorrect: a type sitting directly in common/. It belongs in common/types/.export interface Rate {value: number;}
Correct
srcbillingcommonconstantstypes
// Correct: a type, so it goes in common/types/.export interface Rate {value: number;}
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": {"common-folder-layout": "advisory"}}