Add ESLint rule to enforce Lingui msg usage (#9789)
* Add ESLint rule to enforce Lingui msg usage
Adds a custom ESLint rule 'lingui-msg-rule' that ensures the Lingui _()
function is called with msg`` template literals or plural/select macros,
preventing accidental misuse like _('string') which bypasses i18n.
https://claude.ai/code/session_01JMXXPUgAHiSBGmfGwUojKy
* Support msg({...}) descriptor form and add auto-fix
- Allow msg() function call form: _(msg({message: 'Hello'}))
- Add auto-fix for string literals: _('Bad') -> _(msg`Bad`)
- Add auto-fix for untagged templates: _(`Bad`) -> _(msg`Bad`)
- No auto-fix for variables/function calls (not safely fixable)
https://claude.ai/code/session_01JMXXPUgAHiSBGmfGwUojKy
* fix complex cases
* run autofix HELL YEAH
---------
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -39,8 +39,10 @@ import {
|
||||
HomeOpen_Filled_Corner0_Rounded as HomeFilled,
|
||||
HomeOpen_Stoke2_Corner0_Rounded as Home,
|
||||
} from '#/components/icons/HomeOpen'
|
||||
import {MagnifyingGlass_Filled_Stroke2_Corner0_Rounded as MagnifyingGlassFilled} from '#/components/icons/MagnifyingGlass'
|
||||
import {MagnifyingGlass_Stroke2_Corner0_Rounded as MagnifyingGlass} from '#/components/icons/MagnifyingGlass'
|
||||
import {
|
||||
MagnifyingGlass_Filled_Stroke2_Corner0_Rounded as MagnifyingGlassFilled,
|
||||
MagnifyingGlass_Stroke2_Corner0_Rounded as MagnifyingGlass,
|
||||
} from '#/components/icons/MagnifyingGlass'
|
||||
import {
|
||||
Message_Stroke2_Corner0_Rounded as Message,
|
||||
Message_Stroke2_Corner0_Rounded_Filled as MessageFilled,
|
||||
@@ -495,10 +497,10 @@ let NotificationsMenuItem = ({
|
||||
numUnreadNotifications === ''
|
||||
? ''
|
||||
: _(
|
||||
msg`${plural(numUnreadNotifications ?? 0, {
|
||||
plural(numUnreadNotifications ?? 0, {
|
||||
one: '# unread item',
|
||||
other: '# unread items',
|
||||
})}` || '',
|
||||
}),
|
||||
)
|
||||
}
|
||||
count={numUnreadNotifications}
|
||||
|
||||
@@ -219,10 +219,10 @@ export function BottomBar({navigation}: BottomTabBarProps) {
|
||||
accessibilityHint={
|
||||
numUnreadMessages.count > 0
|
||||
? _(
|
||||
msg`${plural(numUnreadMessages.numUnread ?? 0, {
|
||||
plural(numUnreadMessages.numUnread ?? 0, {
|
||||
one: '# unread item',
|
||||
other: '# unread items',
|
||||
})}` || '',
|
||||
}),
|
||||
)
|
||||
: ''
|
||||
}
|
||||
@@ -251,10 +251,10 @@ export function BottomBar({navigation}: BottomTabBarProps) {
|
||||
numUnreadNotifications === ''
|
||||
? ''
|
||||
: _(
|
||||
msg`${plural(numUnreadNotifications ?? 0, {
|
||||
plural(numUnreadNotifications ?? 0, {
|
||||
one: '# unread item',
|
||||
other: '# unread items',
|
||||
})}` || '',
|
||||
}),
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user