Lint rules
orphan-message
errorFlags a message in your source locale that is not referenced by source code.
This rule is detected by scanning srcPath (currently limited to next-intl), or from formats that track this state themselves, like the stale entries of Apple String Catalogs.
Why this is bad
A message nothing references becomes dead code and should be removed.
Examples
Given source code that only ever calls t('save').
Examples of incorrect code for this rule:
messages/en.json
{"save": "Save","discard": "Discard"}
Examples of correct code for this rule:
messages/en.json
{"save": "Save"}
False positives
The orphan-message rule depends on your app being statically analyzable.
For example, this call site can not track which messages you actually reference:
import navigationItems from './navigationItems';function Navigation() {const t = useTranslations();return (<nav aria-label={t('navigation.label')}>{navigationItems.map((item) => (// ❌ Not statically analyzable<a key={item.key} href={item.href}>{t(item.key)}</a>))}</nav>);}
When adopting eloqnt/cli later on in a project, it can be time-consuming to restructure your app to follow these rules. At first, you might get a number of violations here if the corresponding call sites can't be found.
While it's suggested to restructure your code to avoid the violations, you can alternatively turn the rule off in general via lint.rules, or disable it granularly via lint.overrides:
.eloqnt/config.ts
import {defineConfig} from '@eloqnt/cli';export default defineConfig({lint: {overrides: [{// Keys under `navigation.items` come from a data filekeys: 'navigation.items.*',rules: {'orphan-message': 'off'}}]}// ...});
Note however, that this also degrades the available context that is available for eloqnt translate.