-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend valid-sprintf ESLint rule to catch placeholders that sh… (#20574)
* Add new ESLint rule to validate text domains * Enforce `@wordpress/valid-text-domain` rule for Gutenberg code base * Use messageId and make fixable * Add new no-missing-translator-comments rule * Enforce `@wordpress/no-missing-translator-comments` rule for Gutenberg code base * Add docs * Implement feedback from code review * Rename rule names * Simplify getting previousArg * Extract and document utils * Combine comments * Derive allowDefault from allowedTextDomains * Break early for line number mismatches Co-Authored-By: Andrew Duthie <[email protected]> * Support `i18n.*` usage in new rules * Add new i18n-no-variables rule * Add new i18n-ellipsis rule * Add new i18n-no-placeholders-only rule * Add new i18n-no-collapsible-whitespace rule * Use messageId in valid-sprintf rule * Fix code base after change * Catch mix of ordered and non-ordered placeholders in valid-sprintf rule * Mark as breaking change in the readme * Support `i18n.*` usage in `valid-sprintf` rule * Disable i18n-no-collapsible-whitespace rule for now * Remove unneded capture group * Use Set for list of translation functions * Move const to top scope * Coding standards in code examples * Refactor utils to make code more DRY * Coding standards in test code * Remove now unneeded no-restricted-syntax config * Add i18n rules to new i18n config * Mark new ruleset as breaking change * Update docs * Fix tests * Rename argument to allowedTextDomain and allow strings and arrays * Fix case when using object spread * Apply changes from code review * Rename messageId to make it more clear * Update regex to properly allow named arguments which are supported * Update i18n-no-placeholders-only rule Co-authored-by: Andrew Duthie <[email protected]>
- Loading branch information
1 parent
9a6da4a
commit 969bbe9
Showing
10 changed files
with
219 additions
and
94 deletions.
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
Oops, something went wrong.