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
pnpm add -D oxlint

Add lint commands to 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

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

Use a config file explicitly:

sh
oxlint -c ./oxlintrc.json
# or
oxlint --config ./oxlintrc.json

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 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

Follow symlinks (Oxlint ignores symlinks by default):

sh
oxlint --symlinks

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, 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:

sh
oxlint --rules

The full list is in the Rules reference.

Next steps

Released under the MIT License.