Add terminating semicolons to harden syntax#209
Open
MichaIng wants to merge 1 commit intoalexei:masterfrom
Open
Add terminating semicolons to harden syntax#209MichaIng wants to merge 1 commit intoalexei:masterfrom
MichaIng wants to merge 1 commit intoalexei:masterfrom
Conversation
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 <micha@dietpi.com>
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.
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