feature-folders
What a feature is, and which folders it holds.
The rule
Agents read this text as written when they write and review code.
Put every piece of the product in a feature, src/features/<name>/, named for what the user does there: issues/, billing/. A feature holds only these folders, each present only while it has files:
screens/— the components its routes render, one file each. A not-found or error screen for those routes sits here too.components/— the components its screens compose.hooks/— its hooks.utils/— its plain functions.types/— its types.constants/— its constants, a value built by a call included.- The folders the framework's rules add.
Nothing sits directly under a feature's root, no feature holds another, and every folder in a feature is flat, apart from the component folders component-folder allows.
Then everything about one area of the product is in one folder, and inside it a reader looks by kind.
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
interface Params {title: string;}// Incorrect: ui/ is not a folder a feature holds, so a reader looking for the// feature's components has to guess the name.export const IssueRow = ({ title }: Params) => <li>{title}</li>;
Correct
interface Params {title: string;}// Correct: a component the screen composes, in the feature's components/.export const IssueRow = ({ title }: Params) => <li>{title}</li>;
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": {"feature-folders": "advisory"}}