A (send) beacon of hope

27 February 2021

tl;dr: If you want to use navigator.sendBeacon() to asynchronously POST data to a web server, be aware of the restricted content type. You probably want to use a Blob in the payload. Read more

Jesting for sport

27 December 2020

tl;dr: When testing frontend web applications (e.g a Next.js project) in a Node environment such as Jest, you need to use transformers to import non-JS assets like CSS modules. Read more

JS project template

7 August 2020

tl;dr: A GitHub template for JavaScript projects with Husky hooks pre-configured; Jest for testing (pre-push), Babel, ESLint and Prettier for syntax and formatting (pre-commit) and Commitlint for commit messages (commit-msg). Read more

The Curious Case of PropTypes

15 July 2020

tl;dr: PropTypes is installed as a dependency and declarations end up in production bundles, yet are only helpful during development. To remove from production bundles use babel-plugin-transform-react-remove-prop-types. Read more

Linting with CSS Modules

22 June 2020

tl;dr: When using CSS Modules, having a CSS syntax linter such as stylelint isn't enough - you also need to use a JavaScript linter such as ESLint with functionality to lint the CSS Module being imported (e.g. eslint-plugin-css-modules). Read more