@lumirelle/oxlint-config
v0.2.2
Published
Lumirelle's opinionated OXLint config
Readme
Lumirelle's OxLint Config
Lumirelle's opinionated OxLint config for JavaScript / TypeScript / Vue projects, generated based on @antfu/eslint-config.
Configuration
There are now only JSON (static) configs, one for JavaScript / TypeScript projects and one for Vue projects.
[!Note]
In the future, we may support dynamic configs (e.g. JavaScript / TypeScript configs) to allow more flexible configurations, in order to migrate from ESLint +
@antfu/eslint-configto OxLint +@lumirelle/oxlint-configmore smoothly.
@lumirelle/oxlint-config/ts
For JavaScript / TypeScript projects, it uses plugins below:
Plugins
Description
eslint
Used by JavaScript rules. These rules are generated based on @antfu/eslint-config's JavaScript rules with default options.
oxc
Used by Oxc rules. These rules are configured in this package.
unicorn
Used by Unicorn rules. These rules are generated based on @antfu/eslint-config's Unicorn rules with default options.
import
Used by Imports (Don't forget the "s") rules. These rules are generated based on @antfu/eslint-config's Imports rules with default options.
Because of the differences between plugin implementations (OxLint's built-in import plugin are compatible with eslint-plugin-import, but @antfu/eslint-config uses eslint-plugin-import-lite), there are some transformations when generating rules.
promise
Used by Promise rules. These rules are configured in this package.
node
Used by Node rules. These rules are generated based on @antfu/eslint-config's Node rules with default options.
jsdoc
Used by JSDoc rules. These rules are generated based on @antfu/eslint-config's JSDoc rules with default options.
typescript
Used by TypeScript rules. These rules are generated based on @antfu/eslint-config's TypeScript rules with default options.
@lumirelle/oxlint-config/vue
For Vue projects, it extends the @lumirelle/oxlint-config/ts preset, uses the additional vue plugin.
Plugin
Description
vue
Used by Vue rules, which are generated based on @antfu/eslint-config's Vue rules with default options.
Usage
Install the package with OxLint,
oxlint-tsgolintis required for type-aware rules:# @antfu/ni ni -D @lumirelle/oxlint-config oxlint oxlint-tsgolint # Bun bun add -d @lumirelle/oxlint-config oxlint oxlint-tsgolint # NPM npm install -D @lumirelle/oxlint-config oxlint oxlint-tsgolint # ...Extend the config in your
.oxlintrc:For TypeScript projects:
{ "$schema": "./node_modules/oxlint/configuration_schema.json", // What a pity that OxLint doesn't support scope packages in "extends" field now, so we have to use the full path to the config file. // See https://github.com/oxc-project/oxc/issues/15538 // "extends": ["@lumirelle/oxlint-config/ts"], "extends": ["./node_modules/@lumirelle/oxlint-config/.oxlintrc. ts.json"], // Enable type-aware rules. "options": { "typeAware": true }, // Must specify the environment by youself, because "extends" does not apply to "env". // Custom as your need. "env": { "builtin": true, "es2026": true, "browser": true, "node": true } }For vue projects:
{ "$schema": "./node_modules/oxlint/configuration_schema.json", // what a pity that oxlint doesn't support scope packages in "extends" field now, so we have to use the full path to the config file. // see https://github.com/oxc-project/oxc/issues/15538 // "extends": ["@lumirelle/oxlint-config/vue"], "extends": ["./node_modules/@lumirelle/oxlint-config/.oxlintrc.vue.json"], // enable type-aware rules. "options": { "typeaware": true }, // must specify the environment by youself, because "extends" does not apply to "env". // custom as your need. "env": { "builtin": true, "es2026": true, "browser": true, "node": true } }Run oxlint cli:
# with bunx bunx oxlint --type-aware --type-check # with npx npx oxlint --type-aware --type-check # ...(Optional) Add lint scripts to
package.json:{ "scripts": { "lint": "oxlint", "lint:fix": "oxlint --fix" } }And run them with:
# with bun bun run lint # with npm npm run lint # ...
Work with ESLint
If you want to migrate an existing project from totally ESLint to OxLint first & ESLint least, you can use eslint-plugin-oxlint as below in your ESLint config:
import oxlint from 'eslint-plugin-oxlint'
export default [
// ...
...oxlint.buildFromOxlintConfigFile('.oxlintrc.json'),
]Please refer to the ESLint config of this repository for more details.
