@wearemothership/oxc-config
v1.0.0
Published
Shareable oxlint configuration for TypeScript and React (type-aware, stylistic formatting via jsPlugins)
Readme
@wearemothership/oxc-config
Shareable oxlint configuration for TypeScript and React projects.
Formatting stays on @stylistic/eslint-plugin via oxlint JS plugins (keeps Stroustrup braces). Oxfmt is deferred until it supports a brace-style option — oxfmt always emits 1TBS today.
Features
- Type-aware TypeScript via
oxlint-tsgolint(options.typeAware: true) — requires TypeScript 7+ (see below) - Native plugins for core, TypeScript, promise, React (hooks / refresh), jsx-a11y, and import
- Stylistic formatting through
@stylisticrecommended plus project overrides (tabs, 150 columns, double quotes, semis, no trailing commas, Stroustrup) - Composable
base,react,importConfig, andstorybooklayers - Storybook opt-in via
eslint-plugin-storybookJS plugin
Installation
npm install --save-dev @wearemothership/oxc-config oxlint oxlint-tsgolint typescript @stylistic/eslint-pluginFor Storybook projects, also install eslint-plugin-storybook.
Peer dependencies are listed in package.json.
Why TypeScript 7?
This config enables type-aware linting by default (options.typeAware: true). That path runs through oxlint-tsgolint, which embeds typescript-go (TypeScript 7) — it does not load your installed typescript package. Oxlint still documents TypeScript 7.0+ as required for type-aware mode (tsconfig / language semantics must match what the engine understands).
The typescript: ^7 peer keeps the project’s tsc and type-aware lint on the same major so diagnostics and supported tsconfig options stay aligned. Staying on TypeScript 5 while using this config is unsupported for type-aware runs.
Usage
Oxlint’s extends only merges rules, plugins, and overrides — not jsPlugins, options, env, or ignorePatterns. Prefer passing a composed config object as the root export (or use the exported compose helper).
React app (default)
import config from "@wearemothership/oxc-config";
import { defineConfig } from "oxlint";
export default defineConfig(config);With Storybook
import config, { compose, storybook } from "@wearemothership/oxc-config";
import { defineConfig } from "oxlint";
export default defineConfig(compose(config, storybook));With import rules
import config, { compose, importConfig } from "@wearemothership/oxc-config";
import { defineConfig } from "oxlint";
export default defineConfig(compose(config, importConfig));Unresolved imports are not checked by oxlint (import/no-unresolved does not exist). Use tsc / type-aware lint for TypeScript, and the bundler or runtime for plain JavaScript.
Non-React package
import { base } from "@wearemothership/oxc-config";
import { defineConfig } from "oxlint";
export default defineConfig(base);Formatting
Run autofixes (includes stylistic):
oxlint --fixSuggested scripts:
{
"scripts": {
"lint": "oxlint",
"lint:fix": "oxlint --fix"
}
}Rule coverage vs the old ESLint config
Native oxlint plugins have no configs.recommended to spread. Enabling a plugin makes its rules available; only the correctness category runs by default. This package:
- Spreads
@stylisticrecommended (JS plugin) then applies project overrides - Lists promise recommended rules that are not correctness (plus the previous overrides)
- Enables
react/rules-of-hooksexplicitly (pedantic in oxlint) - Relies on correctness for most of
eslint/typescript/jsx-a11yrecommended coverage
That is narrower than the old js / typescript-eslint recommended spreads. Consumers can opt into more with e.g. categories: { suspicious: "warn" } in their own config.
Exports
| Export | Contents |
|--------|----------|
| default | base + react |
| base | Ignores, browser env, type-aware options, promise, TypeScript, stylistic |
| react | Native react + jsx-a11y |
| importConfig | Native import rules (no unresolved-import check) |
| storybook | eslint-plugin-storybook recommended (jsPlugins) |
| compose | Merge layers (plugins / jsPlugins / rules / overrides / options / …) |
Subpath imports: @wearemothership/oxc-config/base, /react, /import, /storybook.
Style rules
Enforced via @stylistic (same intent as the previous ESLint config):
- Indentation: tabs
- Line length: 150
- Quotes: double
- Semicolons: always
- Trailing commas: never
- Brace style: Stroustrup
- Arrow parens: always
Ignored paths
dist/public/
Development
npm test # lint this package with its own config, fixture smoke tests, and typecheckRun npm test before publishing.
Oxfmt
Not included. Oxfmt cannot disable 1TBS brace layout; adopting it would fight Stroustrup. Revisit when oxfmt gains a brace-style option.
