Skip to content
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

ESLint: Improve regex for valid-sprintf rule #52787

Open
swissspidy opened this issue Jul 20, 2023 · 2 comments · May be fixed by #68270
Open

ESLint: Improve regex for valid-sprintf rule #52787

swissspidy opened this issue Jul 20, 2023 · 2 comments · May be fixed by #68270
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.

Comments

@swissspidy
Copy link
Member

What problem does this address?

Code like sprintf( 'Rotated at %d%% degrees', 90 ) is totally fine, yet the valid-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.

@swissspidy swissspidy added Internationalization (i18n) Issues or PRs related to internationalization efforts [Tool] ESLint plugin /packages/eslint-plugin labels Jul 20, 2023
@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Jul 26, 2023
@colorful-tones
Copy link
Member

@swissspidy could this be a duplicate of this? #47794

@swissspidy
Copy link
Member Author

No relation at all!

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants