lint-oxlint
A micro-frontend repo holds many apps written by different people, and a shared lint config is what keeps them consistent. This feature adds oxlint, which is fast enough to run on every save, with rules that use TypeScript's type information to catch async and unsafe-type mistakes.
What you get
You get one lint config and one Prettier config at the repo root, covering the shell and every remote. Three scripts run them: lint, format and format:check.
Add it
This is a default feature, so a new project already has it. To add it to a project that skipped it:
What changed, at the project root:
The new scripts are lint, format and format:check. These dev dependencies are added:
Use it
The lint script runs the command below, so a warning fails the run as an error would.
Use pnpm format:check in CI and pnpm format locally. For a case you cannot fix, disable one rule on one line and say why.
Configure it
There are no install options. The generated config extends the shared one and only adds ignores.
How it works
The shared config turns on three oxlint categories as errors: correctness, suspicious and perf. It also loads the TypeScript, unicorn, oxc, import, node, React and accessibility plugins.
On top of that it sets type-aware rules. Examples are no floating promises, no misused promises, exhaustive switch statements and the family of no-unsafe-* checks.
React hooks rules are errors, so the rules of hooks and exhaustive dependencies are enforced. The config also bans file extensions on imports, so you write ./client and not ./client.ts.
Side-effect imports are an error too. The exceptions are CSS files and two paths:
Type-aware rules run on oxlint-tsgolint, which works from your TypeScript setup, so lint and tsconfig stay in step.
Gotchas
-
Type-aware rules need a working tsconfig. If lint reports odd type errors, run
pnpm typecheckfirst. -
--deny-warningsis on, so a new warning from an oxlint upgrade can fail CI until you fix it or turn the rule off. -
Prettier ignores
pnpm-lock.yamlandCHANGELOG.md, so do not format them by hand. -
Files under
scripts/andbin/are allowed to use import extensions, because Node runs them directly.
Reference
- tsconfig
- git-hooks, which runs the typecheck before a push
- CI and budgets
- feature.json reference