Fix broken example, severity of warning#1570
Fix broken example, severity of warning#1570ljharb merged 1 commit intoairbnb:masterfrom thepeoplesbourgeois:master
Conversation
ljharb
left a comment
There was a problem hiding this comment.
It is indeed as bad; things that crash your app are actually less bad then things that might silently do the wrong thing, like omitting a semicolon.
|
|
||
| ```javascript | ||
| // bad | ||
| const bar = [...foo].map(bar); |
There was a problem hiding this comment.
why do these need to change?
There was a problem hiding this comment.
You're declaring bar. If you're declaring it here, how can it be what you pass in to map?
There was a problem hiding this comment.
If this line of code works as it's written, I am more terrified of JavaScript than ever before
|
And what misbehavior arises from a missing semicolon, exactly? |
|
I keep hearing nebulous fears from semicolon stalwarts that "bad things could happen", but I've yet to hear of any examples of such things. If they exist, surely, it should be easy enough to convince me of the character's utility |
|
I don't really have time to go into all the ways that ASI can and has caused numerous production bugs, but I think it's a bit presumptive to believe that something the majority of JS devs avoid isn't actually bad :-) |
README.md
Outdated
| [1, 2, 3].map(x => x + 1); | ||
|
|
||
| // bad | ||
| // very bad - error bad - no returned value means `memo` becomes undefined after the first iteration |
There was a problem hiding this comment.
i think just "bad" here, with your english explanation, is sufficient
There was a problem hiding this comment.
That's fair. I've taken it back down just to "bad"
|
I believe the logical fallacy you've just hit upon is "popularity confirmation bias", no? I don't need "all the ways". If you can just tell the last time it's been a gotcha for you, I will concede the point. |
|
@thepeoplesbourgeois no, that would be if i claimed that it was true because lots of people do it. I'm claiming that someone who's new and/or uninformed should assume by default that if it's popular it's true, instead of assuming by default that it's some kind of unsubstantiated groupthink. |
ljharb
left a comment
There was a problem hiding this comment.
Thanks! Would you mind rebasing this down to a single commit, and prefixing the message with [guide] ? If not I can take care of it.
|
Well... how new do you believe I am to Javascript? :) |
|
lol, fair point, i apologize that i took your questions as implied newness. |
|
It happens 😁 I'll make the updates to the branch, but it'll be in a little while. I've been doing these edits in the online editor, so I need to find a moment to clone the repo and perform the terminal commands. Thank you for being my first approved open-source contrib! |
|
oh no worries then; i'll take care of the rebase for you :-) Thanks for the contribution! |
The problem with linting rules sometimes is that they can imply that not having a semicolon somewhere in thousands of lines of code (that runs perfectly fine without them) is equally as bad as accidentally writing a loop that crashes your application.