-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
i18n ESlint rules do not correctly default text-domain #21920
Comments
Good timing, I was thinking about a fix for it. I had to workaround it in WordPress/gutenberg-examples this way: However, we need to find a more robust solution that works for all projects out of the box. |
I think the easiest solution would be to remove the default text domain:
So when the text domain is not explicitly specified ( Thoughts? cc @aduth |
@swissspidy, I tried what you shared in #21928. It works but I guess it can be simplified :) |
I'd be motivated toward anything which ensures the default configuration can be used out-of-the-box without additional action required. I guess #21920 (comment) can be a solution toward that, but it's unclear to me: Is there any difference between removing this default value, and simply removing the rule from the configuration altogether? If the rule isn't doing anything in its default state, then I don't think it should run at all. |
@aduth The rule also checks whether the text domain is a valid string literal and not a variable, for example. That's still valuable. |
Okay, in that case, it seems sensible then. |
Describe the bug
When using @wordpress/eslint-plugin if no text domain is configured in eslintrc, 'default' should be the chosen text domain and there should be no text-domain linting errors with a supplied domain string or empty param.
To reproduce
Steps to reproduce the behavior:
__( )
function in a javascript file with a text domain (e.f.__( 'some string', 'some domain' )
@wordpress/i18n-text-domain: Invalid text domain 'some domain'
Expected behavior
Giving no preferred text domain in the eslintrc should allow any string text domain. OR Text domain rule should be outlined as required in the eslint plugin documentation.
Additional context
The text was updated successfully, but these errors were encountered: