"use strict" without a semicolon
See original GitHub issueIs it ok to use "use strict"
without a semicolon at the end?
I’ve looked around the web, and everywhere there is an example with "use strict";
Issue Analytics
- State:
- Created 12 years ago
- Reactions:3
- Comments:20 (3 by maintainers)
Top Results From Across the Web
JavaScript and semicolon - node.js - Stack Overflow
"use strict"[1,2,3,4]... and notes that this is valid javascript. Therefore a semicolon is not inserted since no "offending token" is found ...
Read more >Strict mode - JavaScript - MDN Web Docs
JavaScript's strict mode is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
Read more >"use real strict" mode? - Ideas - TC39
I'm proposing a new feature where one could use "use real strict" instead of ... Many people (myself included) choose to code without...
Read more >Syntax • JavaScript for impatient programmers (ES2022 edition)
7.8 Semicolons: best practices; 7.9 Strict mode vs. sloppy mode ... to avoid it – why is explained in §13.4.3 “Recommendation: always use...
Read more >Semicolons in JavaScript - Flavio Copes
I personally like avoiding using semicolons in my code, but many people prefer them. ... Some prefer to use them always, no matter...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m sorry you think bootstrap’s javascript promotes poor coding practices. That’s definitely not my intention.
I don’t think i’ve said “because i said so” - or at least i hope i haven’t.
And as always, i’m definitely up for discussion around every part of this project, which is why it’s open source to begin with.
My current rationale is that the bootstrap plugins are simple enough, that * unnecessary* semicolons are unwarranted. I have a pretty good understanding of ASI (according to some test @sayrer tried to troll me with a long while back) and I prefer the ascetic of the code this way. The only problems I’ve heard people bring up from the lack of semicolons are:
I’m sympathetic to the latter - which is why we used to have a semicolon at the end of all the files (incase the minifer you were using was truly awful).
However i was under the impression that people didn’t care anymore after we added the custom downloader which offers the minified concatenated version. If this isn’t the case - i’m happy to add the semicolons back to the end of the file.
I’m less concerned with the spec - where because a semicolon is automatically inserted after the line, I believe it is still being satisfied (clearly this is the case as warnings are correctly thrown in chrome). Also, remember, this is only present as something to help us as developers… if it works in chrome and firefox, which is presumably where we are developing, so it works 😃
That all said, I don’t hate semicolons. In fact i use them in several of my other projects (hogan.js for example). It just doesn’t make sense for me here. If you disagree - let me know why? thanks!
Please add semicolons, javascript already has some bad parts, don’t add even more.