Skip to main content

oxlint-config

Build npm version

@rnx-kit/oxlint-config is a set of configurations that can be used as is, or extended in your own oxlint config.

Install

yarn add @rnx-kit/oxlint-config --dev

or if you're using npm:

npm add --save-dev @rnx-kit/oxlint-config

Usage

Several configurations are exported by this package. For instance, to use the recommended configuration, you can re-export it in your config like so:

export { default } from "@rnx-kit/oxlint-config";

Alternatively, if you want to add customizations:

import recommended from "@rnx-kit/oxlint-config";
import { defineConfig } from "oxlint";

export default defineConfig({
extends: [recommended],
plugins: ["import"],
rules: {
"import/no-default-export": "error",
"no-unneeded-ternary": "error",
},
});

Additionally, we also export the following configurations to ease the migration from ESLint:

Supported Rules

  • ✓: Enabled with @rnx-kit/oxlint-config/recommended
  • 🔧: Fixable with --fix
🔧RuleDescription
@rnx-kit/no-const-enumdisallow const enum (why is it bad?)
🔧@rnx-kit/no-export-alldisallow export * (why is it bad?)
@rnx-kit/no-foreach-with-captured-variablesdisallow forEach with outside variables; JavaScript is not efficient when it comes to using variables defined outside of its scope, and repeatedly calling that function can lead to performance issues. By using a for...of loop, you can avoid these performance pitfalls and also it is easier to debug.
@rnx-kit/type-definitions-onlydisallow anything but type definitions; useful for types only files or packages