-
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
First pass at I18N-specific ESLint rules #20555
Merged
Merged
Changes from 6 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
e8656b9
Add new ESLint rule to validate text domains
swissspidy 80f6b8b
Enforce `@wordpress/valid-text-domain` rule for Gutenberg code base
swissspidy 656ec12
Use messageId and make fixable
swissspidy 6beedd1
Add new no-missing-translator-comments rule
swissspidy d366d59
Enforce `@wordpress/no-missing-translator-comments` rule for Gutenber…
swissspidy 6c4e07c
Add docs
swissspidy f1b325b
Merge master branch and rename rules
swissspidy 05ee583
Implement feedback from code review
swissspidy 3af1fb5
Rename rule names
swissspidy 82c956d
Simplify getting previousArg
swissspidy d611c85
Extract and document utils
swissspidy 8194ffa
Combine comments
swissspidy be5a596
Merge branch 'master' into add/i18n-eslint-rules
swissspidy 6125f28
Derive allowDefault from allowedTextDomains
swissspidy 797053d
Merge branch 'master' into add/i18n-eslint-rules
swissspidy 02e30c4
Break early for line number mismatches
swissspidy 225c09d
Merge branch 'master' into add/i18n-eslint-rules
swissspidy 11569f3
Support `i18n.*` usage in new rules
swissspidy d1b2fec
Merge branch 'master' into add/i18n-eslint-rules
swissspidy c48aa0a
Merge branch 'master' into add/i18n-eslint-rules
swissspidy 9e535ce
Add new i18n-no-variables rule
swissspidy 811c951
Add new i18n-ellipsis rule
swissspidy 210759d
Add new i18n-no-placeholders-only rule
swissspidy 4511fd2
Add new i18n-no-collapsible-whitespace rule
swissspidy bee529e
Disable i18n-no-collapsible-whitespace rule for now
swissspidy b2fcda3
Merge branch 'master' into add/i18n-eslint-rules
swissspidy d388f13
Remove unneded capture group
swissspidy 67e38e5
Use Set for list of translation functions
swissspidy 545790b
Move const to top scope
swissspidy 05a8920
Coding standards in code examples
swissspidy f845bae
Refactor utils to make code more DRY
swissspidy 63c8606
Coding standards in test code
swissspidy 63fd381
Remove now unneeded no-restricted-syntax config
swissspidy e6fe285
Add i18n rules to new i18n config
swissspidy 5ceb0c7
Mark new ruleset as breaking change
swissspidy a2e16d5
Update docs
swissspidy 4c2d632
Merge branch 'master' into add/i18n-eslint-rules
swissspidy 5bcac71
Fix tests
swissspidy 3c05054
Merge branch 'master' into add/i18n-eslint-rules
swissspidy e7187a0
Rename argument to allowedTextDomain and allow strings and arrays
swissspidy 887ed2d
Merge branch 'master' into add/i18n-eslint-rules
swissspidy 071e9b8
Apply suggestions from code review
swissspidy a9c2301
Merge branch 'master' into add/i18n-eslint-rules
swissspidy 948f22a
Turn on i18n-no-collapsible-whitespace rule by default
swissspidy 684cc2d
Merge branch 'master' into add/i18n-eslint-rules
swissspidy dc94c94
Fix format after applying suggested change
swissspidy 6153feb
Reset lastIndex after using test() on a regex with global flag
swissspidy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you consider there to be any meaningful difference between:
...and:
In other words, do we need an option, if the intent is to exempt the project from the behavior this rule otherwise enforces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
'@wordpress/i18n-text-domain': 'off'
you would not catch cases like using a variable as a text domain, or using text domain'gutenberg'
when in fact it should be the default text domain.