Lint rules
duplicate-id
errorFlags a message ID that more than one messages folder defines. Only applies when messages.path lists multiple folders.
Why this is bad
Folders merge into a single catalog, so a repeated ID resolves to whichever folder is listed last and the message defined in the other one never reaches a screen.
Examples
Given a messages.path that lists two folders:
app/messages(which already definessave)packages/ui/messages
Examples of incorrect code for this rule:
packages/ui/messages/en.json
{"save": "Save"}
Examples of correct code for this rule:
packages/ui/messages/en.json
{"ui": {"save": "Save"}}
How to fix it
There are two ways to keep IDs unique across folders:
- Nest each folder’s messages under a namespace of its own, as in the correct example above.
- Let each file act as a namespace, via a
{namespace}placeholder inmessages.path:
.eloqnt/config.ts
import {defineConfig} from '@eloqnt/cli';export default defineConfig({messages: {path: './locales/{locale}/{namespace}'// ...}});
This way, save in ./locales/en/ui.json is read as ui.save.