Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: respect lazy translation tags in no-single-variables-to-translate #34

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

IanKrieger
Copy link
Contributor

Resolves #33

Copy link

codecov bot commented Feb 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cb0e1d5) 96.23% compared to head (6be9640) 96.24%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
+ Coverage   96.23%   96.24%   +0.01%     
==========================================
  Files          10       10              
  Lines         451      453       +2     
  Branches      144      145       +1     
==========================================
+ Hits          434      436       +2     
  Misses         17       17              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@andrii-bodnar andrii-bodnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IanKrieger thank you!

@andrii-bodnar andrii-bodnar merged commit 3cb7b6a into lingui:main Feb 9, 2024
4 checks passed
@andrii-bodnar
Copy link
Contributor

Available in https://github.com/lingui/eslint-plugin/releases/tag/0.3.0

@timofei-iatsenko
Copy link
Collaborator

Thanks, appreciate the effort, but solution is a bit naive and to specific.

I think the eslint should not complain at all when a variable passed into the id. This rule should be triggered only when a TplLiteral with one variable is passed, or JSX content with only one variable interpolation.

// Trans from @lingui/react
<Trans id={messageId}> // should be no issue, since it's common pattern from the docs
<Trans id={`${messageId}`}>  // should be issue
// Trans from @lingui/macro
<Trans>{variable}</Trans> // should be issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lingui/no-single-variables-to-translate does not respect lazy translations
3 participants