Commit b82902b
Use word boundary for formatMessage in i18n pre-filter regex !! (elastic#268098)
## Summary
Follow-up to elastic#265954 ([review
comment](elastic#265954 (comment))).
Changes `.formatMessage(` to `\bformatMessage(` in the
`I18N_CALL_PATTERN` regex so the pre-filter also catches destructured
standalone `formatMessage()` calls (e.g. `const { formatMessage } =
intl; formatMessage(...)`), matching the same word-boundary pattern
already used for `\btranslate(`.
The dot-prefix worked today because no code in the repo destructures
`formatMessage`, but `\b` is strictly more defensive — false positives
(extra files processed) are harmless, while false negatives (missing
translations) are not.
Adds a unit test for the destructured `formatMessage` pattern.
## Test plan
- `node scripts/jest src/dev/i18n_tools/constants.test.ts` — all 12
tests pass
- CI passes (i18n check step)
Made with [Cursor](https://cursor.com)
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent a35ceae commit b82902b
2 files changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
0 commit comments