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:
@@ -182,11 +182,15 @@ export function FeedSourceCardLoaded({
|
||||
return (
|
||||
<Link
|
||||
testID={`feed-${feed.displayName}`}
|
||||
label={_(
|
||||
label={
|
||||
feed.type === 'feed'
|
||||
? msg`${feed.displayName}, a feed by ${sanitizeHandle(feed.creatorHandle, '@')}, liked by ${feed.likeCount || 0}`
|
||||
: msg`${feed.displayName}, a list by ${sanitizeHandle(feed.creatorHandle, '@')}`,
|
||||
)}
|
||||
? _(
|
||||
msg`${feed.displayName}, a feed by ${sanitizeHandle(feed.creatorHandle, '@')}, liked by ${feed.likeCount || 0}`,
|
||||
)
|
||||
: _(
|
||||
msg`${feed.displayName}, a list by ${sanitizeHandle(feed.creatorHandle, '@')}`,
|
||||
)
|
||||
}
|
||||
to={{
|
||||
screen: feed.type === 'feed' ? 'ProfileFeed' : 'ProfileList',
|
||||
params: {name: feed.creatorDid, rkey: new AtUri(feed.uri).rkey},
|
||||
|
||||
Reference in New Issue
Block a user