@configg/oxc
v0.1.9
Published
oxfmt and oxlint presets
Downloads
1,245
Maintainers
Readme
@configg/oxc
bun add -d @configg/oxc oxfmt oxlint oxlint-tsgolintFormatter
@configg/oxc/fmt exports configs, a record of plain config objects. Pass one to oxfmt's defineConfig().
// oxfmt.config.ts
import { defineConfig } from 'oxfmt'
import { configs } from '@configg/oxc/fmt'
export default defineConfig(configs.client)client: the shared base plus Tailwind class sorting (class,className,cx,createVariants) and import grouping (react, external,components,utils, relative).scripts: the shared base, for tooling and config files.server: the shared base.
Linter
@configg/oxc/lint exports configs. Pass one to oxlint's defineConfig().
// oxlint.config.ts
import { defineConfig } from 'oxlint'
import { configs } from '@configg/oxc/lint'
export default defineConfig(configs.client)client: browser env, type-aware, with rules relaxed for component code. Its**/*.spec.{ts,tsx}override enables the Vitest env and Testing Library rules, so it needseslint-plugin-testing-library.scripts: Node env, type-aware, for tooling and config files.
The Oxlint presets don't enable anti-slop. antiSlop from @configg/oxc/lint is an opt-in set with the plugin and all 18 rules as errors; unicorn/prefer-reflect-apply is off. See UPSTREAM.md for its source and update policy.
import { antiSlop, configs } from '@configg/oxc/lint'
export default defineConfig({
...configs.client,
jsPlugins: [...antiSlop.jsPlugins],
rules: { ...configs.client.rules, ...antiSlop.rules },
})If your config has its own jsPlugins, keep the anti-slop entry in that array. The plugin ships as TypeScript, so run oxlint under Bun (bunx --bun oxlint): Node refuses to strip types from files in node_modules.
Both presets allow up to two classes per file, allow reduce(), allow process.exit() (CLI scripts and
shutdown handlers exit with a status code on purpose) and allow short identifiers (eslint/id-length is off). They turn import/prefer-default-export off, since named
exports are the convention (it matters once a config adds the import plugin), and unicorn/number-literal-case
off, since oxfmt and Prettier write hex digits in lowercase. async/await is allowed (oxc/no-async-await is
off), continue is allowed (eslint/no-continue is off), and functions may run to 100 lines (blank lines and comments
not counted) and 30 statements. Template expressions
allow booleans, numbers, nullish values and never; other types follow Oxlint's defaults.
Peer dependencies
oxfmt, oxlint, oxlint-tsgolint and eslint-plugin-testing-library are all optional peers, so you install only the ones the presets you use need.
