-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Remove duplicated semicolon #1784
Conversation
It seems that in this file the very first `;` isn't a must, because we've used a selfexecuted function. It should be enough.
i think it's useful. i used to wrote this way years ago. ;(function (){
'use strict';
// xxx
})(); |
@willin:Is it a habit or some special thing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's defensive coding. If a previous JS file does not end with a semicolon and this one is concatenated after it, then the start of this file could have unintended consequences. It's a good practice and should be left as is IMO. (We're not concatenating this file as far as I can tell, but we probably should consider concatenating files if we're not, and we should probably keep all our files concatenation-ready.)
@Trott:But we can avoid this from happening……And in fact, when I run |
The value of leaving the semicolon is small but non-zero while the value of removing it is zero. The cost of leaving the semicolon is zero while the cost of removing it is small but non-zero. Therefore, it should be left IMO. |
I don't actually feel that strongly about this
it's excessive. many eslint rules are excessive. just a good habit. |
I dismissed my review because I don't feel so strongly as to block this, but I think leaving the semicolon is preferable to removing it. |
I can't believe we're having a variation on the "semicolon or no semicolon" argument. I need to find a new hobby. 😃(Yes, I know this is not the usual "semicolon or no semicolon" argument. It's just a joke.) |
Can we add a semicolon at the end though? |
@AyushG3112:This just depends because considering everyone has diff ideas on this, but according to real situation IMO:I don't think it needs here. Because we have codes controllable, and we cannot write codes that will miss See this: Line 86 in 58c055d
|
it's just a semicolon. let it there. |
@Maledong, read this post for more information: https://hackernoon.com/an-open-letter-to-javascript-leaders-regarding-no-semicolons-82cec422d67d |
@pierreneter:Thanks but I cannot open your given link. |
It seems that in this file the very first
;
isn't a must, because we've used a self-executed function. It should be enough.