ESLint: Improve regex for valid-sprintf
rule
#52787
Labels
Internationalization (i18n)
Issues or PRs related to internationalization efforts
[Status] In Progress
Tracking issues with work in progress
[Tool] ESLint plugin
/packages/eslint-plugin
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
Code like
sprintf( 'Rotated at %d%% degrees', 90 )
is totally fine, yet thevalid-sprintf
rule currently flags this.The PHP counterpart does not flag this as it uses a different regex, see https://github.com/WordPress/WordPress-Coding-Standards/blob/1767f3a1169407d84f1d17e4cd9d80844d693e9e/WordPress/Sniffs/WP/I18nSniff.php#L45-L68
What is your proposed solution?
Improve the regex so that cases like
%d%%
or%d %%
are not flagged as multiple unordered placeholders.The text was updated successfully, but these errors were encountered: