Skip to content

Add terminating semicolons to harden syntax#209

Open
MichaIng wants to merge 1 commit intoalexei:masterfrom
MichaIng:patch-1
Open

Add terminating semicolons to harden syntax#209
MichaIng wants to merge 1 commit intoalexei:masterfrom
MichaIng:patch-1

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 <micha@dietpi.com>
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