Enforce that <Trans>, <Plural>, <SelectOrdinal>, <Select> components and Lingui macro function calls (t, msg, defineMessage) have an explicit id.
Providing an explicit id gives translators a stable, human-readable key and prevents auto-generated IDs from changing unexpectedly when the default message is updated. See Benefits of Explicit IDs in the Lingui docs for more details.
Tagged template literals (t`Hello`) don't support id — use the function call form instead.
⚠️ Conflicts: This rule directly conflicts withrequire-implicit-id. Do not enable both rules at the same time — they are mutually exclusive.
// nope ⛔️
<Trans>Read the docs for more info.</Trans>
<Plural value={count} one="# book" other="# books" />
t`Hello`
t({ message: "Hello" })
// ok ✅
<Trans id="msg.docs">Read the docs for more info.</Trans>
<Plural id="msg.books" value={count} one="# book" other="# books" />
t({ id: "msg.hello", message: "Hello" })Type: string[] (array of regex patterns)
Default: none
When provided, the rule additionally validates that the id value matches at least one of the given regular expressions. If the option is omitted, any id value is accepted.
Non-string id values (e.g. JSX expressions like id={someVar} or id: someVar) are silently ignored during pattern validation.
Type: string (regex flags, e.g. "i" for case-insensitive)
Default: none
Optional flags passed to the RegExp constructor together with each pattern.
// nope ⛔️
<Trans id="hello">Hello</Trans>
t({ id: "hello", message: "Hello" })
// ok ✅
<Trans id="msg.hello">Hello</Trans>
t({ id: "msg.hello", message: "Hello" })