eloqnt/studiov0.6
Navigation

Lint rules

duplicate-id

error

Flags 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.

How to fix it

Nest each folder's messages under a namespace of its own. IDs stay unique however many folders you add, and the namespace says where a message comes from.

Examples

Given a messages.path that lists two folders:

  • app/messages (which already defines save)
  • 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"
}
}