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

Rules name refinement #1

Open
thekip opened this issue Aug 18, 2023 · 8 comments
Open

Rules name refinement #1

thekip opened this issue Aug 18, 2023 · 8 comments

Comments

@thekip
Copy link
Collaborator

thekip commented Aug 18, 2023

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 namespace lingui/, so should not be duplicated.
    • Proposition: unmarked-string
    • Proposition: unwrapped-string
  • i18n-only-identifiers - i don't like the i18n in the name because it may confuse people that this rule is applicable to i18n instance calls. But in fact it works for t macro only.
    • Proposition: only-identifiers

Offer better naming for this rules, i don't really happy with what i'm came up.

@vonovak
Copy link

vonovak commented Aug 18, 2023

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! 🙂

@thekip
Copy link
Collaborator Author

thekip commented Aug 18, 2023

@vonovak #6 check the readme updates here

@thekip
Copy link
Collaborator Author

thekip commented Aug 18, 2023

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

@vonovak
Copy link

vonovak commented Aug 18, 2023

no-expression-in-message sounds best imho! 👍

@thekip
Copy link
Collaborator Author

thekip commented Aug 22, 2023

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

@igorDolzh
Copy link
Collaborator

@vonovak I like your suggestion for rule names

  1. missing-lingui-transformation -> no-unlocalized-strings 👍
  2. About this (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.
  3. About this 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.
  4. 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

What do you think?

@thekip
Copy link
Collaborator Author

thekip commented Aug 24, 2023

@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.

@vonovak
Copy link

vonovak commented Aug 24, 2023

how about renaming no-single-variables-to-translate to no-single-variable-to-translate? The singular here sounds a little better imho.

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

No branches or pull requests

3 participants