What rules you are lacking for? #47
Replies: 5 comments
-
Hey! Really excited to start in on Lingui and glad you're working on ESLint support. There are a few tokens like |
Beta Was this translation helpful? Give feedback.
-
My proposition: Rule blocking all global usages of lingui i18n instance. What i mean: t`Hello` // ❌ Error!
plural({...}) // ❌ error!
t(i18n)`Hello` // ✅ Ok!
t(i18n)`I have ${plural({one: '# hat', other: "# hats"})}` // ✅ Ok! Rationally: It seems lingui was developed when SPA application was the most popular way to use React. In such applications everything executed in the browser and having global singletons is quite fine because you don't need to worry about concurrency. Currently MPA applications with SSR attracting more and more people and become a default way to make a React applications. Using "globals" in them is harmful. You will get issues right away or withih some period of time. So to help developers to avoid this, i propose to block these usages at all. PS I'm thinking for the v5 path, and removing the globals from the lib could be a good candidate for it. This concept is outdated and very confusing. |
Beta Was this translation helpful? Give feedback.
-
I would love to see a rule that forces consistent use of explicit message id or no explicit message ids. If developers mix one or the other it should be discouraged. |
Beta Was this translation helpful? Give feedback.
-
@TylerR909 super late to the party, but I just started integrating with Lingui and I'm using no-restricted-imports to help ensure I'm not using the runtime version of Trans. If truly desired, then the dev is to add an explicit disable in the places that need it. "no-restricted-imports": [
"error",
{
paths: [
{
name: "@lingui/react",
importNames: ["Trans"],
message: "Please use Trans from @lingui/macro.",
},
],
},
], |
Beta Was this translation helpful? Give feedback.
-
I recently had following nested translation not detected:
Was a bit of a PIA to find manually |
Beta Was this translation helpful? Give feedback.
-
Let's collect here rules which might be helpful.
Beta Was this translation helpful? Give feedback.
All reactions