typescript

The State of JavaScript Testing Frameworks 2024

11 minute read

This week, I am adding a test framework to my ESM module template. I use a testing framework for both unit testing and integration testing. Like everything, test frameworks have evolved, and no test framework is suitable for all situations. However, it is one of those things you have to do if your project is destined to be long-lived. You should get into the habit of adding tests even if your...

Enforcing code style with eslint, prettier, and husky

14 minute read

You may have noticed that I am developing a new project from my last couple of articles: TypeScript, ES Modules, and root-relative imports Building TypeScript projects with the swc compiler The project is a command line tool written in TypeScript and will be distributed on npmjs.org eventually. I’m still working on the application, so it will be a while before it’s released. Today, I’m ...

Building TypeScript projects with the swc compiler

5 minute read

In my last article, I set up a small project that I’m going to use for TypeScript development using ES modules that are “root-relative” - i.e. I don’t have to provide a relative path. I can use a path like #root/relative/path.js instead so that the code doesn’t change if I decide to move the source file I’m working on. I want to use swc so that I can switch to importing “.ts” modules instead ...

TypeScript, ES Modules, and root-relative imports

5 minute read

As you might have gathered from my last article, I’m currently working in the TypeScript world. My experience with converting from CommonJS to ES Modules got me thinking - what is state of the art right now? So I delved in. I want to build a CLI tool using TypeScript and ES Modules but I want to use non-relative roots. What are non-relative roots? Well, if you want to import a module withi...

Converting a TypeScript project from CommonJS to ESM

6 minute read

I haven’t made much progress on my own projects recently because of a project at work. Specifically, I am currently maintaining a CLI tool written in TypeScript about five years ago. It hasn’t really been looked after on a consistent basis, but some of the libraries that it uses (specifically, update-notifier and wait-on) have some security issues. Now, this is a development CLI tool, so the...