lightsoutAlpha

duplicate-export-name

Exports in different places that share one name.

Deterministic checkAdvises by default

The rule

Agents read this text as written when they write and review code.

Within a package, give every export a name no other export has. Before you add an export, search the package for that name.

  • The same thing written twice: keep one, and move it where file-placement says.
  • Two different things: rename one, so each name says what it is.

Then a search by name finds the one place a concept lives.

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

srcbillinginvoices
src/billing/formatAmount.ts
export const formatAmount = ({ cents }: { cents: number }): string => `$${(cents / 100).toFixed(2)}`;

Correct

srccommonutilsinvoices
src/common/utils/formatAmount.ts
export const formatAmount = ({ cents }: { cents: number }): string => `$${(cents / 100).toFixed(2)}`;

Configure

  • Block"blocking"Stops a run when a file the run changed breaks the rule.
  • Advise"advisory"Reports it and hands it to the refactor agent. Never stops a run.
    Default
  • 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.

lightsout.config.json
{
"standards-rule-settings": {
"duplicate-export-name": "advisory"
}
}

Packs that select it