-
Notifications
You must be signed in to change notification settings - Fork 13
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
[no-unlocalized-strings]
Tracking issue for the rule improvements.
#50
Comments
Not sure if this is a good place to share input, but we noticed that Might be an anti-pattern on our end, but we have occasionally used such syntax for copy text, which the linter did not help us catch. |
Yes, this excluded by default. The capital letters in the variable names mostly used to define constants, so they are excluded. I think it could be a good idea to revisit the defaults, and make them configurable or overridable. |
Any chance that regex patterns will be supported in |
@nyadav810 |
I went through the issues with this rule and tried to address them all. It seems like we need a big change in how the rule is set up. There’s no way to make it work perfectly for everyone and every project. So, I’ve decided to remove all the built-in settings and made them fully customizable. For example, if a user doesn’t want:
they can simply remove the related regex from their options. Let me know what you think, and feel free to share any other feedback you have on this rule. |
I think the defaults so far have been very sane, and only small caveats such as the above have been slight nuissences. As long as it is easy to reproduce the existing default experience, I think that sounds good! |
@nyadav810 FYI #77 |
Guys, I would appreciate if you review and left your feedback on this PR #78 Also while working on it, i've noticed that in a real life sceanario we probably don't need separate settings for /* eslint lingui/no-unlocalized-strings: ["error", {"ignoreAttribute": ["className"]}] */
export const MyComponent() {
return <div className="classes string">Ola!</>
} /* eslint lingui/no-unlocalized-strings: ["error", {"ignoreVariable": ["className"]}] */
export const MyComponent() {
const className = "doing some magic";
return <div className={className}>Ola!</>
} /* eslint lingui/no-unlocalized-strings: ["error", {"ignoreProperty": ["className"]}] */
const variants = {
variantA: {
className: "classes string"
},
variantB: {
className: "classes string"
}
]
export const MyComponent({variant}) {
return <div className={variants[variant].className}>Ola!</>
} |
Thanks for the improvements @timofei-iatsenko !!! Another quirk I found - when called as a function, Example:
(I'm having to add |
@nyadav810 thanks for the report. Also noticed it when worked on the #78. It's fixed there. |
I created this issue to collect all problems / improvements for
no-unlocalized-strings
rule.ignoreAttribute
ignoreProperty
ignoreFunction
how to ignore property by pattern? #40ignoreProperty
no-unlocalized-strings
ignoreProperty
option should extend to ignoring string values in subkeys #39obj["key with space”]
no-unlocalized-strings
should ignore string keys for dereferencing object values #38Map
,Set
, etcno-unlocalized-strings
should ignore string keys for dereferencing object values #38ignoreProperty
should work forClassDeclaration -> PropertyDefinition
,ObjectExpression -> Property
,MemberExpression.property
ignoreProperty does not work as expected #37lingui/no-unlocalized-strings
#30The text was updated successfully, but these errors were encountered: