filename-mismatch
How a file's name follows what it exports.
Deterministic checkAdvises by default
The rule
Agents read this text as written when they write and review code.
Name a file exactly as its export, casing included: buildVersionedLabel.ts, UserProfile.ts. A file with a union and its member types takes the union's name.
A file named like its export is found by searching for the export.
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
srcbilling
export const getChargeLabel = ({ amount }: { amount: number }): string => `${amount}`;
Correct
srcbillingconfigsync
{"name": "filename-mismatch-pass-fixture","private": true}
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": {"filename-mismatch": "advisory"}}