Lint rules
superfluous-key
errorFlags a key that a target locale defines but the source locale doesn't.
Why this is bad
The source locale is the contract, so a key only a translation carries is usually a leftover from a message you renamed or deleted.
In rarer cases, the source locale is missing a message that your code actually uses. In that case, the raw key name is typically rendered for this locale.
Examples
Given a source locale that defines only save.
Examples of incorrect code for this rule:
messages/es.json
{"save": "Guardar","discard": "Descartar"}
Examples of correct code for this rule:
messages/es.json
{"save": "Guardar"}
How to fix it
First, check why your source locale doesn't have the key:
- The key was renamed in the source locale: Rename the key in every target locale too, so its translations are kept.
- The key was removed in the source locale: Delete the key from all target locales too.
- The key is missing in the source locale: If the key is still referenced in source code, add it to your source locale too.
To be sure, it's worth checking your hypothesis against the accompanying source code.