Neither Javascript nor Typescript require semicolon, it is entirely a stylistic choice except in very rare circumstances that do not come up in normal code.
Not wrong, but funnily enough, it’s a linting rule win. I’d go nuts if I didn’t have my type checks and my linters. My current L, though, is setting up the projects initially and dealing with the configuration files if I raw dog it, but that’s a problem with ESLint configs and the ecosystem as a whole having to deal with those headaches. So in the end, the JS devs got clever and shifted the blame to the tooling. 😅
That’s good to know. Don’t know how I didn’t know this. Been writing JS since 2000. Always just used them I guess. Ecmascripts look funny to me without them
That’s TypeScript. I can tell by the pixels defining a type above.
Was looking at it and could not figure out why their weren’t any semicolon’s.
Neither Javascript nor Typescript require semicolon, it is entirely a stylistic choice except in very rare circumstances that do not come up in normal code.
Explanation for nerds
The reason is the JS compiler removes whitespace and introduces semicolons only “where necessary”.
So writing
Is not the same as
Because the compiler will see that and make it:
You big ol’ nerd. Tee-hee.
That’s terrifying, especially in JS where no type system will fuck you up for returning nothing when you should’ve returned a boolean.
Common JavaScript L
Not wrong, but funnily enough, it’s a linting rule win. I’d go nuts if I didn’t have my type checks and my linters. My current L, though, is setting up the projects initially and dealing with the configuration files if I raw dog it, but that’s a problem with ESLint configs and the ecosystem as a whole having to deal with those headaches. So in the end, the JS devs got clever and shifted the blame to the tooling. 😅
Hmm, a webdev colleague said he’d normally prefer without semicolons, but used them anyways for better compile errors.
That’s good to know. Don’t know how I didn’t know this. Been writing JS since 2000. Always just used them I guess. Ecmascripts look funny to me without them
Same here. My brain interprets them as one long run-on sentence and throws a parsing error.