Skip to content

linter: Oxlint panics when lint target is passed as an absolute path #22269

@yoshi-taka

Description

@yoshi-taka

What version of Oxlint are you using?

1.63.0

What command did you run?

No response

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

No response

What happened?

Summary

oxlint@1.63.0 panics when it is run from a different working directory while -c points to a config file inside the lint target repository.

Reproduction

tmp=$(mktemp -d)
git clone --depth 1 https://github.com/oven-sh/bun.git "$tmp/bun"
ctrl=$(mktemp -d)
cd "$ctrl"
npm init -y >/dev/null
npm install oxlint@1.63.0 --no-save >/dev/null
cd "$tmp/bun"
node "$ctrl/node_modules/oxlint/dist/cli.js" -c oxlint.json "$tmp/bun"

# thread 'tokio-rt-worker' (...) panicked at .../ignore-0.4.25/src/gitignore.rs:232:9:
# path is expected to be under the root
# note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
# ok
cd "$tmp/bun"
node "$ctrl/node_modules/oxlint/dist/cli.js" -c oxlint.json .

Expected behavior

Oxlint should either lint the target repository successfully, or fail gracefully with a normal diagnostic message.

It should not panic.

Additional note:

This does not panic if the working directory is changed to the repository root first:

sh cd "$tmp/bun" node "$ctrl/node_modules/oxlint/dist/cli.js" \ -c oxlint.json \ -f unix \ --no-error-on-unmatched-pattern \ --disable-nested-config \ .

So the issue appears to depend on using an absolute path for the lint target.

In summary:

  • passing the repository root as an absolute path causes oxlint to panic
  • using . from inside the repository does not panic

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions