Merged
Conversation
nerrad
approved these changes
Feb 8, 2019
Contributor
There was a problem hiding this comment.
oh, so an example of something that got picked up by the new rule ;) nice.
Member
Author
There was a problem hiding this comment.
The pull request started as a very roundabout way of addressing this specific issue 😆
7abe8bb to
afe9838
Compare
This was referenced Feb 18, 2019
youknowriad
pushed a commit
that referenced
this pull request
Mar 6, 2019
* Blocks: Embed: Avoid unneccessary sprintf * ESLint Plugin: Add rule valid-sprintf * i18n: Disable valid-sprintf for intentional error test case
youknowriad
pushed a commit
that referenced
this pull request
Mar 6, 2019
* Blocks: Embed: Avoid unneccessary sprintf * ESLint Plugin: Add rule valid-sprintf * i18n: Disable valid-sprintf for intentional error test case
aduth
commented
Mar 27, 2019
| ---|--- | ||
| [no-unused-vars-before-return](/packages/eslint-plugin/docs/rules/no-unused-vars-before-return.md)|Disallow assigning variable values if unused before a return | ||
| [dependency-group](/packages/eslint-plugin/docs/rules/dependency-group.md)|Enforce dependencies docblocks formatting | ||
| [valid-sprintf](/packages/eslint-plugin/docs/rules/valid-sprintf.md)|Disallow assigning variable values if unused before a return |
This was referenced Apr 30, 2020
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related: #6624 (comment)
This pull request seeks to introduce a new ESLint rule to help protect against invalid use of
sprintf.Specifically, it enforces:
_nor_nx) contain an identical number of placeholders (a common error is forming a string likesprintf( _n( 'One cat', '%d cats', num ) ))It does not (yet) enforce:
sprintf( '%1$s %1$s', '1' )is valid)Testing instructions:
Verify that the description for the Embed block shows as expected:
Ensure tests pass: