Open thekip opened 11 months ago
Hello! very exciting to have this eslint plugin!
I read the docs and TBH I'm not sure I understood what all the rules are about because the descriptions are sometimes quite short. It would be nice to explain in the readme (and also in the error messages), what the right approach is.
anyways, here are some suggestions for naming:
missing-lingui-transformation
- no-raw-strings
, no-unlocalized-strings
, no-hardcoded-text
t-call-in-function
- no-constant-translation
, no-stale-translation
i18n-only-identifiers
- prefer-named-constants
, prefer-constants-in-interpolation
, prefer-constants-in-text
(as far as I can tell, t`hello ${func()}!`
is valid but will be extracted as hello {0}
which is harder to translate.
no-single-varibles-to-translate
- missing-localizable-content
, no-lonely-variable
, nothing-to-translate
thank you! 🙂
@vonovak https://github.com/igorDolzh/eslint-plugin-lingui/pull/6 check the readme updates here
I like missing-lingui-transformation
-> no-unlocalized-strings
really self-explanatory!
i18n-only-identifiers - prefer-named-constants, prefer-constants-in-interpolation, prefer-constants-in-text
i think constant
here is confusing
let userName = user.name;
t`Hello {userName}`;
I think identifier is more right word, or turn this upside-down no-expression-in-message
no-expression-in-message
sounds best imho! 👍
Created a PR, changed named of rules which are have no doubts.
Didn't change no-single-varibles-to-translate
because not sure about the options
@vonovak I like your suggestion for rule names
missing-lingui-transformation
-> no-unlocalized-strings
👍 t-call-in-function
- no-constant-translation
, no-stale-translation
) I'm not sure, since this rule is for t
only. Following the pattern no-${something}
it could be renamed to no-t-outside-of-function
something like that.i18n-only-identifiers
. Something like no-complex-interpolation
maybe? I believe it is better to avoid having prefer
since the level of severity of the rule could be adjusted outside of the rule name.no-single-varibles-to-translate
at the moment, seems fine. If theoretically to consider to expand the rule to keep track that there is something to translate between Trans
or t
. I like missing-localisable-content
or no-keys-without-text
What do you think?
@igorDolzh you a bit late 😃 We already merged renaming for
missing-lingui-transformation
-> no-unlocalized-strings
i18n-only-identifiers
-> no-expression-in-message
it could be renamed to no-t-outside-of-function
I like this one. Sounds pretty self-describing.
About no-single-varibles-to-translate at the moment, seems fine. If theoretically to consider to expand the rule to keep track that there is something to translate between Trans or t. I like missing-localisable-content or no-keys-without-text
I like missing-localisable-content
but this naming is not consistent with other no-{something}
rules. Not sure it should...
no-single-varibles-to-translate
sounds quite well, actually. Because t`${one}${two}`
is already something to translate (the translator could change the order in diffrent language if needed), and the rule should not complain here. So highlighting that there should not be a single variable is right thing.
how about renaming no-single-variables-to-translate
to no-single-variable-to-translate
? The singular here sounds a little better imho.
This issue for ongoing discussion for better name of the rules before it goes live.
missing-lingui-transformation
- i think "transformation" is not the right word. Also "lingui" is already in the rule id (as plugin namespacelingui/
, so should not be duplicated.unmarked-string
unwrapped-string
i18n-only-identifiers
- i don't like thei18n
in the name because it may confuse people that this rule is applicable toi18n
instance calls. But in fact it works fort
macro only.only-identifiers
Offer better naming for this rules, i don't really happy with what i'm came up.