Skip to content

About the author of Daydream Drift

Tomasz Niezgoda (LinkedIn/tomaszniezgoda & GitHub/tniezg) is the author of this blog. It contains original content written with care.

Please link back to this website when referencing any of the materials.

Author:

Babel Transforms Syntax Expansion

Published

Anyone can create a Babel extension adding support for experimental syntax and many developers have. One of the outstanding uses for this feature is adding functional capabilities to JavaScript.

Things like the pipe operator, pattern matching, function bind and currying. That's a lot, but I'm coming fresh form programming in ReasonML, so I particularly like those. These additions make writing functional code easier and encourage being functional. But there's a big problem with using these I came across.

While Babel can properly understand JavaScript with extra syntax added by extensions, code editors cannot. Using extra syntax is a big hassle when the editor can't properly highlight it. Not only that, tools like Prettier and ESLint usually can't handle it either. You end up with working Babel and that's it. I don't think introducing extra syntax for convenience is worth such a significant inconvenience. It's a poor trade. So, I decided to stick with JavaScript and TypeScript for now. They're supported everywhere and easier to learn and adjust to as a developer.

This is one of the many confirmations that using standard and established tools is the optimal option when trying to actually get something done.