Migrating to <template> tag

<template> tag lets us write template(s) in strict mode. Templates are more explicit and statically analyzable, so we can adopt more tools from the JavaScript ecosystem. There’s less work for Embroider to do, so we can expect app builds to be faster.

<template> tag has been around for a few years now. With the help of addons, in components and tests since 2020 and in routes since 2023.1 In short, it’s stable and you can likely use <template> tag in your projects today.

This post aims to accelerate adoption. I will show you step-by-step how to migrate an existing component, route, and test. Once you understand the idea, feel free to run my codemod to automate the steps.

Continue reading “Migrating to <template> tag”

Large-Scale Migrations with Codemods

In the last few months, I had the fortune to examine and improve code at Lighthouse. One great achievement to date is upgrading Ember from 5.12 to 6.6 a few months ahead of schedule. There are 2 reasons for why we (including you) can move fast even with a small team: (1) Ember’s conventions and (2) codemods.

Continue reading “Large-Scale Migrations with Codemods”

It’s Time to Separate: Own or Delegate?

It’s an art to know where to write our own code versus to use someone else’s. We don’t want to write too much code since we need to maintain them. We also don’t want to depend on others’ too much, especially given the recent supply chain attacks. Here are 3 examples that show how I struck the right balance.

Continue reading “It’s Time to Separate: Own or Delegate?”

It’s Time to Separate: Lint and Format

In the It’s Time to Separate series, I’ll show you how separating concerns helps us simplify code. And that separation can occur in many places.

Little advertised news from January: Ember CLI removed eslint-plugin-prettier and stylelint-prettier from its blueprints, adding instead two scripts to run prettier. I was skeptical when the RFC had come out. Why change things when these plugins have worked well for years? Isn’t it, for people who maintain many projects like me, huge effort, little reward?

Then I realized last week, separating formatting from linting is indeed a good thing. Not just cause of the performance gain that’s usually cited. But because it helps us reexamine past approaches and come up with simpler ones that will stand the test of time.

Continue reading “It’s Time to Separate: Lint and Format”