Skip to content

Quickstart

This page shows the recommended setup for Oxlint and the most common workflows, with copy-paste commands.

Install

Install oxlint as a dev dependency:

sh
$ npm add -D oxlint
sh
$ pnpm add -D oxlint
sh
$ yarn add -D oxlint
sh
$ bun add -D oxlint

Add lint commands to package.json:

package.json
json
{
  "scripts": {
    "lint": "oxlint",
    "lint:fix": "oxlint --fix"
  }
}

Run it:

sh
pnpm run lint

Apply fixes:

sh
pnpm run lint:fix

Usage

For the complete list of options, see the CLI reference.

sh
oxlint [OPTIONS] [PATH]...

If PATH is omitted, Oxlint lints the current working directory.

Common workflows

Pre-commit with lint-staged

package.json
json
{
  "lint-staged": {
    "*.{js,jsx,ts,tsx,mjs,cjs}": "pnpm run lint"
  }
}

Create a config file

Initialize the .oxlintrc.json config with default values:

sh
oxlint --init

Then run Oxlint:

sh
oxlint

TIP

If you are migrating from ESLint, see the "Migrate from ESLint" page for detailed guidance on migrating.

Fix problems

Apply safe fixes:

sh
oxlint --fix

Apply suggestions (may change program behavior):

sh
oxlint --fix-suggestions

Apply dangerous fixes and suggestions:

sh
oxlint --fix-dangerously

See Automatic fixes for guidance on when to use each mode.

Ignore files

Use an explicit ignore file:

sh
oxlint --ignore-path .oxlintignore

Add ignore patterns from the command line:

sh
oxlint --ignore-pattern "dist/**" --ignore-pattern "*.min.js"

Disable ignore handling:

sh
oxlint --no-ignore

See Ignore files.

Fail CI reliably

Only report errors:

sh
oxlint --quiet

Fail if any warnings are found:

sh
oxlint --deny-warnings

Fail if warnings exceed a threshold:

sh
oxlint --max-warnings 0

See CI setup.

Use machine-readable output

Select an output format:

sh
oxlint -f json

Available formats include: default, json, unix, checkstyle, github, gitlab, junit, stylish.

Inspect the effective configuration

Print the configuration that would be used for a file:

sh
oxlint --print-config path/to/file.ts

List available rules

List registered rules, including those enabled by your current oxlint config:

sh
oxlint --rules

The full list is in the Rules reference.

Next steps