Leon's Microblog – Posts tagged "Javascript"

I think there's only only other platform that has a "batteries included" approach to features… and it's the web browser DOM, which has to have basically every non-trivial application feature built in, AND every previous version of that feature, for perpetuity.
Some of you may wonder how difficult it is to port an aging late-00s Javascript codebase to the new, minty-fresh 2020's class syntax. Fortunately, it's pleasantly simple.
The Javascript of the 90s': hundreds of function() statements loaded by <script> tag The Javascript of the 20's: hundreds of function() statements but this time they have "export" in front and the <script> tag says "module" instead of "text/javascript"
ESLint, in contrast to previous linters, is designed for the sort of programmer who REALLY wants to make putting a space between a function name and the parentheses to be a syntax error, because they "don't like it" – and for that level of self-servingness, it works very well.
Greatest ESLint Options of Some Time
Converting the files was pretty straightforward, too. Did the conversion take 2 hours and force me to open 60 browser tabs? Yes, but - and this is important - I've already made my peace and moved on with my life. And in the end, is that not what all manual upgrades strive to be?
Bad news, everyone. I'm actually the exact use-case that benefits from the ESLint config format change. My project has 3 different kinds of Javascript in it (TypeScript source, in-browser Javascript tests, Node scripts) and having one file that covers all of them works for me.
The Javascript Switch Statement Flowchart: 1) Notice this next block involves matching on a single variable 2) Start writing a switch block 3) Realise I have to write 'break' before every single freaking case minus 1 because this isn't Rust 4) GO-GO-GADGET ELSEIF CHAIN 5) END
I love Javascript.
The unthinkable has happened… I've become what I never thought possible… I switched to no-semicolons Javascript and let VS Code wrangle the edge-cases for me. All my lines of code have nude rear ends… *My notifications shoot up to 99 from people telling me to stop calling it t
Still think it's funny how they couldn't backwards-compatibly add actual array methods to various legacy Javascript types like NodeList or Arguments, but /were/ able to add iteration, so you can do `foo(...elem.childNodes)` or `for (let a of arguments)` and it'll just work.
All original content on this site, except where noted, is property of Leon, all rights reserved.