Linters and formatters: Biome in TaskKit
Add Biome to TaskKit as its linter and formatter, find a forgotten await that npm run check lets through, and lay every file out one way so a pull request shows only the real change.
Add Biome to TaskKit as its linter and formatter, find a forgotten await that npm run check lets through, and lay every file out one way so a pull request shows only the real change.
Tested with TypeScript 7.x · Node.js LTS
Your friend sends her first pull request to TaskKit. She wants the
holiday warning to say "day off" instead of "public holiday": a small
change. On the Files changed tab, index.ts shows 27 lines removed
and 27 added. Her editor rewrites each file she saves in its own
layout, and it turned each double quote in index.ts into a single
one. Her small change is in there somewhere, and you have to read all
54 lines to find it.
Lesson 11.5 left you a second worry. A try around a call with no await let
an error slip past it, and npm run check (npm, the Node package manager)
found nothing wrong. TypeScript checks types, and neither mistake is about
types. By the end of this lesson TaskKit has Biome, a tool that does two
other jobs: npm run lint finds the forgotten await, and npm run format
lays out every file the same way, so your friend's next pull request shows
only the line she meant to change.
TypeScript asks one question of every line: do the types fit? A call
to an async function that nobody waits for passes that question. In
lesson 11.3, TypeScript asked Did you forget to use 'await'?, but
only because the code then used the promise as if it were the value.
When nothing uses the promise at all, every type is right, so
TypeScript is silent. And quotes and spaces have nothing to do with
types.
Two more kinds of tool read your code for what TypeScript leaves out:
Think of a letter before it is sent. TypeScript is the spell checker: every word must be a real word. The linter is the friend who reads it and says "you asked a question and never waited for the answer". The formatter is the template that puts every letter in the same font and margins.
Here are three changes to index.ts, each of a different kind, on
their way to a pull request. Switch between them, and press Next
step to follow each one, or let it play:
All 3 steps shown.
All 5 steps shown.
All 7 steps shown.
Many JavaScript projects use two tools for these two jobs, ESLint
for the linter and Prettier for the formatter, and the next lesson
shows them. TaskKit takes Biome, one program that does both jobs
with one settings file: one tool is less to learn than two, and Biome
installs beside TypeScript 7 as it is, which ESLint's TypeScript
plugin does not yet do. Its rule for a promise nobody waits for is
called noFloatingPromises.
A new tool is a change like any other, so it gets its own branch, as
in lesson A2.1. In taskkit, on main, after git pull:
git switch -c add-biome
npm install --save-dev --save-exact @biomejs/biomeadded 2 packages, and audited 27 packages in 622msnpm audits the packages it installs, checking them for known security problems, and the line says how many it checked.
Biome is a dev dependency, a tool for you rather than for TaskKit's
users (lesson 9.2). --save-exact pins its version, as in lesson 14.2:
a newer Biome may lay out code a little differently, and you want
everyone's npm run format to agree. The two packages are Biome and
the program built for your system; your number of packages and the
time will differ.
Now let Biome write its settings file:
npx biome init i Welcome to Biome! Let's get you started...
Files created
- biome.jsonbiome.json holds Biome's settings, and four things in the one
init wrote need changing for TaskKit. First, it lays out code with
tabs, while every TaskKit file is indented with two spaces. Second,
it ends every line the way macOS and Linux do, while Git for Windows,
as it installs by default, hands you files whose lines end the Windows
way; either would make the first format rewrite every file. Third,
the rule for a forgotten await is not on yet: Biome keeps its newest
rules in a group called nursery, off until you name them. Fourth,
two folders, if you have them, must stay out. Replace everything under
the first line with this, and keep that line as init wrote it:
{
"$schema": "https://biomejs.dev/schemas/2.6.9/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"includes": ["**", "!taskkit-today", "!mobile"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"lineEnding": "auto"
},
"linter": {
"enabled": true,
"rules": {
"preset": "recommended",
"nursery": {
"noFloatingPromises": "error"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
}
}The first line, $schema, tells your editor where Biome's list of
settings is; its number is the Biome version init found, 2.6.9 on
26 November 2026, and yours may be newer. The vcs lines, short for
version control system, make Biome read Git's .gitignore and skip
what it names, such as node_modules. Line 9 lists the files to read:
** means every file, and ! takes one out.
If you skipped Part 1 of this module, !taskkit-today and !mobile
do nothing. If not, taskkit-today is the Worker project of lesson
A1.7 and mobile the Expo app of lesson A1.5: a tool made each of
them, with its own layout, so Biome leaves them alone.
Line 13 indents with spaces, two of them, Biome's default width, and
line 14, "auto", ends lines the way your system does.
"recommended" turns on the rules Biome thinks every project wants,
line 21 adds the nursery rule to them, and "error" makes a broken
rule fail the command. The last lines, which init wrote, keep double
quotes, the layout TaskKit already uses, so the single quotes your
friend's editor writes become double ones again. Two of init's
settings are gone: ignoreUnknown, which changes nothing for TaskKit,
and the assist block that sorts imports, which neither biome lint
nor biome format uses.
noFloatingPromises is a nursery rule in Biome 2.6.9, checked on 26
November 2026. Nursery rules move to other groups or go, so if Biome
says it does not know nursery/noFloatingPromises, look the rule up
on Biome's rules page.
Last, give the two jobs a name each in package.json, beside start,
test and check (and backup, if you did Part 1):
"scripts": {
"lint": "biome lint .",
"format": "biome format --write ."
}biome lint . reads every file in the folder, ., against the rules.
biome format --write . lays them out, and --write saves the
result; without it, Biome shows what it would change, saves nothing,
and fails (the common mistake below). Try the linter:
npm run lint> lint
> biome lint .
Checked 23 files in 50ms. No fixes applied.No rule broken: TaskKit's code was already careful. The count is
higher if your taskkit has Part 1's folders, here and in the format
runs below (31 files if you followed all of Part 1), and the number of
files Biome fixes stays 4. Commit the tool on its own:
git add package.json package-lock.json biome.json
git commit -m "Add Biome to check and format the code"Now let the formatter tidy TaskKit once, all of it:
npm run format> format
> biome format --write .
Formatted 23 files in 3ms. Fixed 4 files.git diff --stat lists each changed file with a count of its changed
lines, and its last line adds them up:
git diff --stat holidays.ts | 5 ++---
print.ts | 4 +---
tasks.test.ts | 5 ++++-
tasks.ts | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)In two files Biome joined lines that fit on one line within its width
of 80 characters. In a test it laid out one call over several lines,
one argument to a line, and it put a comma after the last parameter of
a function whose parameters stand one per line. Nothing TaskKit does
has changed: run npm test, and it still passes. Commit it on its
own, with nothing else in it:
git commit -am "Format every file with Biome"-a adds every changed file Git already tracks, so no git add is
needed first; -m is the message, as before.
A commit that only lays out code is easy to read: anyone can skip it, knowing no behaviour changed. Mixed into a real change, it buries that change, which is exactly your friend's pull request.
Once this branch is merged, at the end of the next section, your
friend runs git pull on main, then npm install, which installs
Biome from the new package.json. From then on she runs npm run format before each commit. Her editor may still write single quotes;
the formatter puts them back before Git sees them. Biome's extension
for VS Code (Visual Studio Code, your editor) can also do it every
time she saves, reading the same biome.json: open the Extensions
view with these keys, search Biome, install it, and turn on
Format On Save in VS Code's settings (Code → Settings… →
Settings on macOS, File → Preferences → Settings on Windows and
Linux).
Her change, made again that way:
TaskKit's code breaks no rule today. To see what the rule is for, make
the mistake on purpose. In index.ts, in the add command, delete the
await in front of warnIfHoliday:
await warnIfHoliday(options.due);
warnIfHoliday(options.due);Start with an empty list (delete tasks.json), and add a task due on
a holiday:
npm start -- add --due 2026-12-25 "go to the bank"Added: Go to the bank
1 task added, room for 4 more
List 20% full
Your list, by due date:
#1 [todo] Go to the bank, due: Fri 25 Dec, in 56 days
Fri 25 Dec is a public holiday: Christmas DayThe holiday line comes last, under the list, instead of right after
Added. Without await, add does not wait for the holiday question:
TaskKit prints the summary and the list while the question is still on
its way, and the answer arrives after them. Your days left will
differ. Now ask TypeScript, then the linter:
npm run check
npm run lint> check
> tsc> lint
> biome lint .
index.ts:78:7 lint/nursery/noFloatingPromises FIXABLE ━━━━━━━━━━━━━
× A "floating" Promise was found, meaning it is not properly handled
and could lead to ignored errors or unexpected behavior.
76 │ await store.save();
77 │ if (options.due !== undefined) {
> 78 │ warnIfHoliday(options.due);
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
79 │ }
80 │ });
i This happens when a Promise is not awaited, lacks a `.catch` or
`.then` rejection handler, or is not explicitly ignored using the
`void` operator.
i This rule belongs to the nursery group, which means it is not yet
stable and may change in the future. Visit
https://biomejs.dev/linter/#nursery for more information.
i Unsafe fix: Add await operator.
78 │ ······await·warnIfHoliday(options.due);
│ ++++++
Checked 23 files in 70ms. No fixes applied.
Found 1 error.
lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Some errors were emitted while running checks.Three long lines are broken here to fit; in your terminal each is one
line, and the rows of ━ reach its edge. Your line numbers may differ
by one or two. The first line names the place, index.ts, line 78,
column 7, and the rule. Then Biome shows the line with ^ under the
call, says why it matters, and suggests the fix: the + signs mark
the await it would add. The FIXABLE label at the top and Unsafe
fix mean Biome knows a fix but will not make this one by itself,
since it changes what the code does; you make it.
A floating promise is one nobody waits for and nobody catches, as
in lesson 11.5. A promise with .catch, as in TaskKit's remind
command (lesson 11.6), is handled, so the rule leaves it alone. The
void it mentions is not the return type of lesson 5.6: written in front of a
call, it says you skip the wait on purpose. TaskKit never needs it.
This is where TypeScript helps the linter. Biome knows the call gives
back a promise because warnIfHoliday says so in its type,
Promise<void>. Without that type, Biome could not tell this call
from a call to console.log.
Put the await back, and run the linter again:
npm run lint> lint
> biome lint .
Checked 23 files in 32ms. No fixes applied.The branch is ready. Push it and open its pull request with gh, the
GitHub CLI (command-line interface) of lessons 15.2 and A2.1; each
command prints what it printed there:
git push -u origin add-biome
gh pr create --fill
gh pr view --webOn the page, the Commits tab lists the two commits, the one that adds Biome and the one that only lays out code, and Files changed shows every line they change (GitHub's names on 26 November 2026). Then merge it, as in lesson A2.1:
gh pr merge --merge --delete-branchFrom now on, run npm run check, npm run lint, npm run format
and npm test before you commit. The full list of rules,
each with a short example of what it finds, is on
Biome's rules page.
Both functions in this file are async, and the file is in a folder
with TaskKit's biome.json.
Predict
Which line number does npm run lint report?
async function save(): Promise<void> {
console.log("Saved");
}
async function remind(task: string): Promise<void> {
console.log("Reminder:", task);
}
await save();
remind("Pay rent").catch((error: unknown) => {
console.log(error);
});
remind("Call mom");
await remind("Book the dentist");The --write in the format script is easy to leave out when you
type the line yourself, and then the script saves nothing, however
often you run it.
Common mistake
A format script that saves nothing
Picture the first format of TaskKit with the script written this way (if you try it now, TaskKit is already formatted, so Biome has nothing to show):
"format": "biome format ."npm run formatChecked 23 files in 14ms. No fixes applied.
Found 4 errors.
format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Some errors were emitted while running checks.Above those lines, Biome shows each of the four files, headed
Formatter would have printed the following content:, with the
changes it would make. It saved none of them: git diff --stat prints
nothing, and the command ends with exit code 1 (the number a command
hands back when it ends: 0 means it worked), so a commit made now
holds no formatting at all.
× Some errors were emitted while running checks.
The fix
Put --write back, and the same command saves the layout:
"format": "biome format --write ."Formatted 23 files in 3ms. Fixed 4 files.No fixes applied with errors after it means Biome only looked. When
a format seems to change nothing, read the last lines first, then run
git diff --stat to see whether any file changed.
Pass all four tasks to complete the lesson with practice. Reach the end without them and it counts as read only.
The page cannot run Biome or npm, so the setup is written as
console.log lines, and one exercise runs real code with a floating
promise in it.
Biome in TaskKit, in order
This program prints the commands that add Biome to TaskKit on a branch
of its own, but in an order that would not work. Change the order of
the lines, without changing any line itself, so the commands work from
top to bottom: the branch first, then the tool committed on it, then
the formatting in a commit of its own. Editing biome.json and package.json
happens between init and git add, and is not a command here.
Loading the editor…
Wait for the holiday question
This is TaskKit's add in a few lines. It should print Added, then
the holiday line, then the summary, but the holiday line comes last.
Fix it so the three lines come in that order. The page cannot wait for
a real holiday service, so Promise. stands in
for it: a promise that already holds its value.
Loading the editor…
Without the nursery lines
A teammate deletes the "nursery" lines from TaskKit's biome.json,
and keeps everything else. Then someone forgets an await in front of
warnIfHoliday. What does npm run lint say?
Why a commit of its own
Why does the first npm run format go into a commit with nothing else
in it?
Recap · 3 questions
Check yourself
Why does npm run check pass a call nobody awaits?
Check yourself
What does npm run format change in TaskKit?
Check yourself
Why does npm run format end with Found 4 errors?
0 of 0 answered.
Cheat sheet
Linters and formatters: Biome in TaskKit
What things are
| Word | What it means |
|---|---|
| Linter | Reads code for likely mistakes, rule by rule |
| Rule | One thing a linter looks for, by name |
| Formatter | Rewrites the layout; never what the code does |
| Floating promise | A promise nobody awaits and nobody catches |
| Biome | One tool for both jobs, set in biome.json |
| Nursery | Biome's newest rules, off until you name them |
Commands and settings
| Write | To |
|---|---|
@biomejs/biome | Add it pinned: npm install --save-dev --save-exact |
npx biome init | Write a first biome.json |
"indentStyle": "space" | Indent with spaces, as TaskKit does |
"noFloatingPromises" | Set it to "error", under "nursery" |
"!mobile" | Leave a folder out, in "includes" |
"lint": "biome lint ." | Check every file against the rules |
biome format --write . | Lay out every file and save it |
git diff --stat | Count the changed lines, file by file |
git commit -am "…" | Add every tracked change and commit it |
Rules
| Rule | What it means |
|---|---|
| Four commands before a commit | check, lint, format and test |
| Formatting on its own | One commit that only lays out code |
--write | Without it, Biome only shows the changes, and fails |
You can now add a linter and a formatter to a project, read what the
linter reports, and say why a forgotten await passes TypeScript but
not noFloatingPromises.
Next is typescript-eslint and Prettier: the tools other projects
use: the two tools you will find in many projects you join, how to
run them, and what npm says when you install typescript-eslint beside
TypeScript 7.
Before you move on, ask your friend to make her pull request again on
top of the new main, with npm run format before her commit. Read
it on the Files changed tab: one line out, one line in.