lingui / lingui/eslint-plugin

couldn't translate just a variable, remove t`` or add some text inside

Open
#72 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
TypeScript
Stars
33
Forks
25
Avg merge
1d 16h
Merged PRs (30d)
9

Description

I tried the code:

```typescript
const count = 0;

const messages = {
'testPlural': msg`${plural(count, {
one: '# friend',
other: '# friends',
})}`
}
```

However I got the linting error:
`You couldn't translate just a variable, remove t`` or add some text insideeslint[lingui/no-single-variables-to-translate](https://github.com/lingui/eslint-plugin/blob/main/docs/rules/no-single-variables-to-translate.md)`

I report the issue, following @timofei-iatsenko 's recommendation [https://github.com/lingui/js-lingui/issues/2074#issuecomment-2446988265](https://github.com/lingui/js-lingui/issues/2074#issuecomment-2446988265)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the no-single-variables-to-translate rule documentation linked in the report and reproduce the TypeScript example using msg and plural. Determine whether the rule should accept this message or require text outside the variable, then verify the chosen behavior against the reported lint error.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, typescript
Domain
localization, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.