Skip to content

Repository files navigation

@oxlint-types/define-config

CI NPM VERSION NPM DOWNLOADS LICENSE

📦 Strong typed defineConfig function support for oxlint.

Caution

This package is work in progress.

Install

npm install @oxlint-types/define-config
yarn add @oxlint-types/define-config
pnpm add @oxlint-types/define-config

Usage

import { defineConfig } from '@oxlint-types/define-config'

export default defineConfig({
  plugins: ['react', 'typescript', 'import'],
  rules: {
    eqeqeq: 'warn',
    'import/no-cycle': 'error',
    'react/self-closing-comp': ['error', { html: false }],
    '@typescript-eslint/no-explicit-any': 'off',
  },
})

rules keys are generated from oxlint --rules, so built-in rules have autocompletion and typo checks. Rule options are parsed from Oxc Rust rule sources (declare_oxc_lint!(..., config = ...)) and generated into BuiltinRuleOptionsByName, then merged with your RuleOptionsPatch overrides.

Regenerate Rules

pnpm rules:generate

This command updates plugin-level generated files under src/plugins:

It also writes a compatibility re-export in src/rules/generated.ts. The generator script is scripts/generate-rules.ts.

Patch Rule Types (Persistent Across Updates)

To customize options for specific rules, augment RuleOptionsPatch:

declare module '@oxlint-types/define-config' {
  interface RuleOptionsPatch {
    'react/self-closing-comp': {
      html?: boolean
      component?: boolean
    }
    'custom/my-rule': {
      enabled: boolean
    }
  }
}

The patch type lives in src/rules/patch.ts, and is never auto-generated. When you run pnpm rules:generate later, your patch interfaces still apply.

When both generated and patched option types exist for a rule key, patch type takes precedence.

Credits

License

MIT License © 2026-PRESENT ntnyq

About

📦 Strong typed `defineConfig` function support for oxlint.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages