@slango.configs/oxlint
v0.1.2
Published
Slango oxlint configs
Readme
Slango oxlint Configs (@slango.configs/oxlint)
This package exposes oxlint configurations for easy setup, replacing the deprecated @slango.configs/eslint for projects on
TypeScript 7, where typescript-eslint can no longer run. Type-aware rules are provided by
tsgolint (built on TypeScript 7), everything
oxlint has no native port for (perfectionist, regexp) is loaded through oxlint's JS plugin
bridge from this package, so consumers need no extra plugin dependencies.
| Name | Description | Includes |
| ----------------------- | ---------------------------------------------------------------------------- | -------------------------------- |
| javascript-node | Tooling javascript files (eg: lint-staged.config.js, prettier.config.js) | - |
| typescript | Typescript based projects and libraries | javascript-node |
| typescript-node | Typescript based node projects and libraries | javascript-node + typescript |
| typescript-browser | Typescript based browser projects and libraries | javascript-node + typescript |
| typescript-isomorphic | Typescript libraries targeting node and browsers | javascript-node + typescript |
| typescript-react | Typescript based react projects (Vite, WXT, ...) | typescript-browser |
| typescript-next | Typescript based next.js applications | typescript-react |
Included rules
Presets enable oxlint's own recommended set, the correctness category ("code that is
definitely wrong or useless"), for oxlint's default plugins (eslint, typescript, unicorn,
oxc) plus import, node and promise. React presets add the react and jsx-a11y plugins,
the Next preset adds nextjs. With --type-aware, the category also covers tsgolint's typed
rules (no-floating-promises, await-thenable, unbound-method, ...).
On top of the category:
| Source | Available in preset | How |
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| eslint-plugin-regexp recommended | all | JS plugin, rule list read from the plugin |
| eslint-plugin-perfectionist (tiered) | all | JS plugin, see options |
| no-unused-vars (ignoreRestSiblings), import/first, import/no-anonymous-default-export | all | explicit |
| react/rules-of-hooks | typescript-react, -next | explicit (oxlint files it under pedantic) |
| jsx-a11y/prefer-tag-over-role off | typescript-react, -next | not in jsx-a11y recommended/strict; rejects ARIA composite widgets |
| react/only-export-components | typescript-react (eslint-plugin-react-refresh vite options), typescript-next (next options) | explicit |
Other categories (suspicious, pedantic, perf, style, restriction, nursery) are off.
Enable them in your own config if wanted, e.g. categories: { suspicious: 'warn' }. Note that
oxlint files typescript-eslint's no-unsafe-*, no-misused-promises and require-await under
pedantic, so unlike @slango.configs/eslint they are not on by default.
Intentionally not carried over from @slango.configs/eslint:
eslint-plugin-prettier: run prettier directly (lint-staged already does).eslint-plugin-eslint-comments: useoxlint --report-unused-disable-directives.
Usage
The package is written in TypeScript and ships dist with declarations, so oxlint.config.ts
files are fully typed against oxlint's OxlintConfig.
Add @slango.configs/oxlint, oxlint and oxlint-tsgolint as dev dependencies, then create
an oxlint.config.ts in the package (only .ts / .mts config files are auto-discovered):
// oxlint.config.ts
export { default } from '@slango.configs/oxlint/typescript-node.js';// package.json
{
"scripts": {
"lint": "oxlint --type-aware --max-warnings 0 .",
"lint:fix": "oxlint --type-aware --fix --max-warnings 0 .",
},
}To customise, extend the preset with defineConfig (ignore patterns are resolved relative to
the config file, later entries win):
// oxlint.config.ts
import { defineConfig } from 'oxlint';
import { createTypescriptNodeConfig } from '@slango.configs/oxlint/typescript-node.js';
export default defineConfig({
extends: [createTypescriptNodeConfig({ perfectionist: 'moderate' })],
ignorePatterns: ['src/generated/**'],
overrides: [{ files: ['**/*.ts'], rules: { 'typescript/require-await': 'off' } }],
});Options
| Option | Values | Default | Presets |
| --------------- | ---------------------------------------------- | ----------- | ------- |
| perfectionist | 'off' \| 'relaxed' \| 'moderate' \| 'strict' | 'relaxed' | all |
perfectionist tiers are the same as in @slango.configs/eslint.
Migrating from @slango.configs/eslint
- Swap
eslint.config.jsforoxlint.config.tsand thelintscripts as above; deleteeslint,@slango.configs/eslintand anyeslint-plugin-*dev dependencies. // eslint-disablecomments keep working; prefer// oxlint-disable.- Type-aware linting needs TypeScript 7 semantics (tsgolint bundles its own compiler): a
tsconfig.jsonper package, files outside itsincludeshould be ignored. - JS plugin fixes are single-pass:
oxlint --fixmay need a second run to fully sort imports and named imports. - Rule selection follows oxlint's
correctnesscategory, not typescript-eslint'srecommendedTypeChecked: expect a few newunicorn/*andoxc/*findings, and nono-unsafe-*findings unless you enablepedanticrules yourself. - Expect new findings the ESLint presets missed before
@slango.configs/eslint1.3:import/first(silently off for TypeScript files) and thereact/*hooks and React Compiler rules (the plugins were registered without rules).
