@oxlint-flat-config/composer
v0.3.1
Published
Change shared Oxlint flat configs with a chainable API.
Maintainers
Readme
@oxlint-flat-config/composer
Change shared Oxlint flat configs with a chainable API.
When a config comes from a shared preset, you often want to change part of it without copying the whole thing. This package lets you do that with a chain of steps that find config objects by name. It builds on oxlint-flat-config.
Install
pnpm add -D oxlint-flat-config @oxlint-flat-config/composeroxlint-flat-config is a peer dependency, so the composer uses your project's own copy and there is only ever one oxlint-flat-config.
Usage
import { composer } from '@oxlint-flat-config/composer'
import preset from 'some-preset'
export default await composer(preset)
// Merge into one object of the preset.
.override('preset/typescript', { rules: { 'typescript/no-explicit-any': 'off' } })
// Drop objects or rules you don't want.
.remove('preset/stylistic')
.removeRules('no-alert')
// Add your own objects at the end, or next to a named one.
.insertAfter('preset/base', { files: ['*.js'], rules: { 'no-process-exit': 'off' } })
.append({ files: ['**/*.test.ts'], rules: { 'no-console': 'off' } })composer() accepts the same inputs as defineConfig, plus promises. The steps run in order when you await it, and the result is the same Oxlint config defineConfig would build. Every method returns a new composer, so a preset can export a composer and each project can keep chaining on it.
See Composer for every method.
Credits
This package is basically an Oxlint version of eslint-flat-config-utils by Anthony Fu.
