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

Defensive semicolon #49

Closed
tauren opened this issue Mar 25, 2012 · 1 comment
Closed

Defensive semicolon #49

tauren opened this issue Mar 25, 2012 · 1 comment

Comments

@tauren
Copy link
Contributor

tauren commented Mar 25, 2012

Apologies in advance for nit-picking, but is there a specific scenario where the defensive semicolon at the beginning of plates.js is necessary?

;var Plates = (typeof process !== 'undefined' && typeof process.title !== 'undefined') ? exports : {};

My understanding is a defensive defensive semicolon is needed before a line that starts with an open parenthesis, such as an immediately executed anonymous function:

;(function() {})(); 

But I don't see why it would be needed before var. I'm asking because currently there is no way for plates.js to pass jshint without removing the semicolon. I requested a jshint option to be more lenient on defensive semicolons, but @antonkovalyov didn't see the reasoning either and it was understandably rejected:
jshint/jshint#487

If there is a good reason for it, let me know, and I'll reopen the jshint issue.

@heapwolf
Copy link
Contributor

its defensive in consideration of concatenation. but im not as compassionate as i once was about this. I would accept a pull request which removes it.

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

No branches or pull requests

2 participants