Pure Evil

130 points · 13 comments · view on lemmy.world

13 Comments

doomkernel@sopuli.xyz · 42 pts · 3y (10 replies)

Wouldn't the IDE pointed it out?

joneskind@lemmy.world · 17 pts · 3y (7 replies)

Yes.

Besides, Javascript doesn't need semicolon since 2016.

Downcount@lemmy.world · 32 pts · 3y (2 replies)

joneskind@lemmy.world · 8 pts · 3y (1 reply)

Wait, did you just made a meme of my comment?

Awesome!

Downcount@lemmy.world · 4 pts · 3y

Glad you take it like a champ :)

angel@iusearchlinux.fyi · 18 pts · 3y (2 replies)

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".

kinttach@lemm.ee · 6 pts · 3y

As Mark Twain said, “Never discuss politics, semicolons, tabs, or religion in polite company.”

flying_sheep@lemmy.ml · 2 pts · 3y

Use an autoformatter for all code (both in the editor on save/type and as CI check).

There is no problem anymore.

skullgiver@popplesburger.hilciferous.nl · 3 pts · 3y
[ removed ]
Awkwardparticle@artemis.camp · 7 pts · 3y

Only someone who is really into mental torture would not use a linter.

MyNameIsRichard@lemmy.ml · 1 pts · 3y

Obviously, you patch the IDE so it doesn't

dandroid@dandroid.app · 22 pts · 3y (1 reply)

The IDE will tell you and fix it for you.

admin@sh.itjust.works · 5 pts · 3y

Not if they use GNU nano or that shitty windows notepad.

c3zth@lemm.ee · 5 pts · 3y

Jokes on them I don’t use semicolons in JavaScript