realitista@lemmy.world to Programmer Humor@lemmy.ml · 11 months agoPure Evillemmy.worldimagemessage-square14fedilinkarrow-up1199arrow-down179cross-posted to: programmer_humor@programming.dev
arrow-up1120arrow-down1imagePure Evillemmy.worldrealitista@lemmy.world to Programmer Humor@lemmy.ml · 11 months agomessage-square14fedilinkcross-posted to: programmer_humor@programming.dev
minus-squaredoomkernel@sopuli.xyzlinkfedilinkarrow-up42·11 months agoWouldn’t the IDE pointed it out?
minus-squarejoneskind@lemmy.worldlinkfedilinkarrow-up17·11 months agoYes. Besides, Javascript doesn’t need semicolon since 2016.
minus-squarejoneskind@lemmy.worldlinkfedilinkarrow-up7·11 months agoWait, did you just made a meme of my comment? Awesome!
minus-squareangel@iusearchlinux.fyilinkfedilinkEnglisharrow-up19arrow-down1·edit-211 months agoAutomatic Semicolon Insertion (ASI) has (sadly) been a part of JavaScript longer than 2016. I’m not sure exactly when it was introduced, but this document from 2009 already contains it: https://web.archive.org/web/20120418215856/https://ecma262-5.com/ELS5_Section_7.htm#Section_7.9 IMO it’s bad practice to rely on ASI since the semicolons may not get inserted where you expected them to. The following snippet const x = 0 const y = x [1, 2, 3].forEach(console.log) is interpreted as const x = 0; const y = x[1, 2, 3].forEach(console.log); which raises a TypeError. There are more examples of ASI not doing the right thing on the web, so I don’t agree with “Javascript doesn’t need semicolon”.
minus-squarekinttach@lemm.eelinkfedilinkEnglisharrow-up5·11 months agoAs Mark Twain said, “Never discuss politics, semicolons, tabs, or religion in polite company.”
minus-squareflying_sheep@lemmy.mllinkfedilinkarrow-up2·11 months agoUse an autoformatter for all code (both in the editor on save/type and as CI check). There is no problem anymore.
minus-squareSkull giver@popplesburger.hilciferous.nllinkfedilinkarrow-up3·edit-29 months ago[This comment has been deleted by an automated system]
minus-squareAwkwardparticle@artemis.camplinkfedilinkarrow-up7·11 months agoOnly someone who is really into mental torture would not use a linter.
minus-squareMyNameIsRichard@lemmy.mllinkfedilinkarrow-up1·11 months agoObviously, you patch the IDE so it doesn’t
Wouldn’t the IDE pointed it out?
Yes.
Besides, Javascript doesn’t need semicolon since 2016.
Wait, did you just made a meme of my comment?
Awesome!
Glad you take it like a champ :)
Automatic Semicolon Insertion (ASI) has (sadly) been a part of JavaScript longer than 2016. I’m not sure exactly when it was introduced, but this document from 2009 already contains it: https://web.archive.org/web/20120418215856/https://ecma262-5.com/ELS5_Section_7.htm#Section_7.9
IMO it’s bad practice to rely on ASI since the semicolons may not get inserted where you expected them to. The following snippet
const x = 0 const y = x [1, 2, 3].forEach(console.log)
is interpreted as
const x = 0; const y = x[1, 2, 3].forEach(console.log);
which raises a
TypeError
.There are more examples of ASI not doing the right thing on the web, so I don’t agree with “Javascript doesn’t need semicolon”.
As Mark Twain said, “Never discuss politics, semicolons, tabs, or religion in polite company.”
Use an autoformatter for all code (both in the editor on save/type and as CI check).
There is no problem anymore.
[This comment has been deleted by an automated system]
Only someone who is really into mental torture would not use a linter.
Obviously, you patch the IDE so it doesn’t