-
Notifications
You must be signed in to change notification settings - Fork 842
codesniffer: Add Jetpack.Functions.EscJs sniff
#46243
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
Conversation
WordPress's `esc_js()` function is a legacy of pre-PHP-5.2 days which does some odd things to the input. In modern code, it will be better to use `esc_attr()` and/or `wp_json_encode()`. Now that most existing uses are cleaned up, add a sniff to discourage future use. A few files with remaining uses are added to `tools/phpcs-excludelist.json`.
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage Summary1 file is newly checked for coverage.
|
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Closes MONOREP-285
Proposed changes:
WordPress's
esc_js()function is a legacy of pre-PHP-5.2 days which does some odd things to the input. In modern code, it will be better to useesc_attr()and/orwp_json_encode().Now that most existing uses are cleaned up, add a sniff to discourage future use. A few files with remaining uses are added to
tools/phpcs-excludelist.json.Other information:
Jetpack product discussion
Followup to #46229
Does this pull request change what data or activity we track or use?
No
Testing instructions:
esc_js(). Are they caught?