Skip to content

ADR-003: Shared Lint Configuration

  • Status: Proposed
  • Date: 29th October 2026
  • Participants: Ian Lovell

This ADR covers how Releaf repositories are linted: the tool, how configuration is shared between repositories, and how much each repository may vary.

This ADR covers:

  • Choice of linter
  • Distribution of shared configuration
  • The default rule set and what is configurable
  • Custom, Releaf-specific rules
  • Adoption path for existing repositories

This ADR does not define:

  • Formatting. No formatter is configured, and this decision does not add one.
  • Type-aware linting, which oxlint supports separately and which we are not enabling yet.

Nothing was enforced. platform had two ESLint configs — packages/analytics and apps/analytics-example — that disagreed with each other, and no other project defined a lint target at all. CI ran nx affected -t lint on every pull request, which passed without checking anything in most projects. Conventions the repository documents as mandatory, in particular the explicit .js import extension that ESM with NodeNext resolution requires, were enforced only by review.

The same conventions apply across platform, design-system and the application repositories, and each has drifted on its own. Fixing this one repository at a time reproduces the problem.

  • It is fast enough that linting is not a reason to skip the check — the full @releafuk/analytics package lints in well under a second.
  • A single binary replaces ESLint plus a parser plus four plugins. apps/analytics-example alone carried seven ESLint dev dependencies.
  • It is config-compatible enough with ESLint v8’s format that the rules being replaced carried over directly.
  • It supports custom rules through a JavaScript plugin API that is deliberately identical to ESLint’s.

The main cost is maturity. The JS plugin API is alpha, and some rules present in the ESLint ecosystem have no oxlint equivalent yet.

A shared package, @releafuk/lint, exports a factory function. Repositories consume it from an oxlint.config.ts:

import { createLint } from "@releafuk/lint";
export default createLint({ preset: "react" });

oxlint’s extends field resolves file paths only, not package names, so {"extends": ["@releafuk/lint"]} in an .oxlintrc.json does not work. A factory function imported from a TypeScript config is the supported route. It is also better: the shared config becomes a function of explicit options rather than a file to copy and diverge from.

The consequence is that every repository must use oxlint.config.ts, which requires the Node-based oxlint package and a Node runtime that can execute TypeScript. We pin Node 24, so this is not a constraint in practice.

Four options, deliberately few:

| Option | Purpose | |---|---| | preset | "base" for libraries and Node services, "react" for anything rendering JSX. | | severity | "warn" or "error" for the opinionated layer. The migration lever. | | ignores | Extra ignore patterns, appended to the defaults. | | rules | Raw rule overrides, merged last. |

Which rules make up the baseline is not configurable — that is the point of sharing it. rules exists as the pressure valve, because a shared config with no escape hatch gets forked instead of extended.

correctness is pinned to "error" regardless of severity. That category is for code that is outright wrong, and there is no useful state in which it is a warning. Accessibility rules are pinned the same way, because WCAG 2.1 AA is the baseline in the definition of done and a repository mid-migration should still not be able to ship a new violation.

Categories correctness, suspicious and perf are on; pedantic, style, restriction and nursery are off. The off categories are not close calls — style alone reports over 1,300 findings on @releafuk/analytics, and restriction over 700. nursery rules change between releases, which would make an oxlint upgrade break builds.

On top of the categories sits a small named-rule layer, most of which encodes conventions this repository already documented but never enforced — import/extensions most importantly.

Two rules enabled by the categories are explicitly turned off, both discovered by running the config against real code rather than by reading rule lists:

  • eslint/no-underscore-dangle — every finding was a vendor-mandated global or method (window._uxa, window._tfa, client._isIdentified()). Those names are not ours to change.
  • vitest/require-mock-type-parameters — an opinion about how mocks are typed, firing on almost every vi.fn() already written.

Releaf-specific rules ship in the same package as an oxlint JS plugin, loaded automatically by createLint. The first is releaf/no-jsx-logical-and, which disallows && for conditional rendering in JSX children: {count && <Badge />} renders the string 0 when count is 0. oxlint has no equivalent of ESLint’s react/jsx-no-leaked-render, so this fills a real gap rather than reimplementing an upstream rule. It checks JSX children only — && in an attribute value is idiomatic and is left alone.

Repositories adopt at severity: "warn", clear the backlog, then remove the option. @releafuk/analytics starts at warn with 71 findings; @releafuk/sanity is already clean at error.

In platform, the packages under packages/ adopt this now. The apps do not: they are consumers rather than published surfaces, and apps/analytics-example keeps the ESLint config it already had. Opting an app in later is three lines — a config file, a lint script, and two dev dependencies — and nothing in this decision blocks it.

  • nx affected -t lint in CI now checks something. A green build means more than it did.
  • The ESLint stack is removed from packages/analytics — four dev dependencies. apps/analytics-example keeps its own, so ESLint has not left the repository entirely, and the two configs that disagreed are now one shared config plus one app-local holdout.
  • A rule change in @releafuk/lint affects every consuming repository at their next version bump. Rules need to clear a higher bar than one team’s preference, and the package’s AGENTS.md sets that bar.
  • We take on an alpha dependency. If the JS plugin API breaks on an oxlint upgrade, linting breaks everywhere at once. @oxlint/plugins is pinned to an exact version in lockstep with oxlint, and upgrades are deliberate rather than automatic.
  • Repositories can still diverge through rules. That is intended, but a project config accumulating overrides is a signal the shared default is wrong, not that the project is special.
  • Linting is not formatting. Nothing here stops two files disagreeing about quotes or trailing commas; if that matters, it is a separate decision.