systomic

Prefer Temporal over libraries

Temporal covers parsing, time zones, date math and formatting. The library you import for that is code your users download for nothing.

  • RuleIn recommended.json: breaking it breaks the design-system contract.
  • WarningShows in the editor and in CI output, but doesn't fail the run (unless you pass --deny-warnings).

See the difference

Before
import { addDays, format } from "date-fns";

format(addDays(date, 7), "PP")
ResultDec 9, 2026
Shipped to the browser≈ 6 kB date-fns, gzipped
import { addDays, format } from "date-fns"
After
// Built in, nothing to import

date.add({ days: 7 }).toLocaleString()
ResultDec 9, 2026
Shipped to the browser0 kB a small polyfill until Safari ships it
date.add({ days: 7 }).toLocaleString()

What doesn't work

2 findings

What works

No findings

Details

Reports imports of date libraries, since Temporal covers parsing, time zones, math and formatting. Companion of prefer-temporal, split out so it can be switched off or narrowed down on its own during a migration.

Reported: import (also subpaths like date-fns/locale, dayjs/plugin/utc), export … from, import() and require(). Type-only imports are fine.

Default libraries: moment, moment-timezone, dayjs, date-fns, date-fns-tz, @date-fns/*, luxon, spacetime, timeago.js. The message names what Temporal offers instead of the library.

Option Default
libraries the list above (replaces it; * globs)
allow []: libraries to keep for now
ignore []: file globs relative to the nearest package.json; see monorepos
Esc