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

Add terminating semicolons to harden syntax #209

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MichaIng
Copy link

@MichaIng MichaIng commented May 14, 2021

Semicolons were omitted where optional with a trailing line break. This can cause issues when e.g. minimising the script. This change consequently adds trailing semicolons to terminate statements and hence hardens the wider use of the script.

I know it is the task of minifiers to add semicolons where required, when removing line breaks. It could be also seen as the task of minifiers to remove optional semicolons, instead of having this done in the formatted source file already. We just faced issues when this was used in Wordfence and a common plugin with a bad JavaScript minifier removed line breaks without adding then mandatory semicolons. Having them in the original source file makes the scripts more robust against such issues, while of course the minifier is to blame here, or that admin who uses it without checking the outcome 😄.

For reference: WordPress/WordPress#540

Semicolons were omitted where optional with a trailing line break. This can cause issues when e.g. minimising the script. This change consequently adds trailing semicolons to terminate statements and hence hardens the wider use of the script.

Signed-off-by: MichaIng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant