Skip to content

linter: parent ~/.cursor/.gitignore causes 0-file walks in Cursor worktrees #21727

Description

@wadefletch

What version of Oxlint are you using?

1.60.0

What command did you run?

The raw oxlint CLI reproduces it:

oxlint .
oxlint src
oxlint --no-ignore src

In the affected environment, explicit file paths work:

oxlint src/lib/durable-chat/agent-core-bridge.ts

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

Not using one for the raw repro.

This also reproduces without Vite+ in the loop, and --no-ignore still reports 0 files.

What happened?

I think this is another instance of parent .gitignore bleed across the repo's own .git boundary, but with a very common modern path layout: Cursor worktrees under ~/.cursor/worktrees/....

My repo lives at a path like:

/home/ec2-user/.cursor/worktrees/pr88-lints-3e7a1c5d/indicator-flow-e20202d68d13

and the ancestor directory /home/ec2-user/.cursor/.gitignore contains:

# Ignore everything in .cursor
*
# ...allowlist only a few subtrees like projects/, plugins/, skills/, etc.

Notably, it does not allowlist worktrees/.

Repro

  1. Put a git repo (or git worktree) under a parent directory that has a .gitignore above the repo root.
  2. Make that parent .gitignore ignore everything by default, e.g.:
*
  1. Ensure the repo itself has its own .git boundary.
  2. Run:
oxlint .
# or
oxlint src

Observed behavior

Oxlint reports 0 matched files:

No files found to lint. Please check your paths and ignore patterns.
Finished in 8ms on 0 files with 93 rules using 4 threads.

But in the exact same checkout:

  • explicit file paths work
  • shell-expanded file lists work
  • the same repo copied outside ~/.cursor/... works

I verified all three locally:

  • oxlint /home/ec2-user/.cursor/worktrees/.../apps/web/src -> 0 files
  • oxlint /home/ec2-user/.cursor/worktrees/.../apps/web/src/lib/durable-chat/agent-core-bridge.ts -> works
  • oxlint /home/ec2-user/indicator-flow/apps/web/src -> works

--no-ignore did not fix it in this environment.

Why I think this is the same root cause family as the nested-repo / home-.gitignore bugs

I traced this from Vite+ down to raw oxlint, and it looks consistent with these existing reports / PRs:

In particular, current apps/oxlint/src/walk.rs on main still shows:

.git_ignore(true)
.hidden(false)
.require_git(false)

and the nearby test comment says:

// Without .git_ignore(true) and .require_git(false), both files would be found

That seems consistent with Oxlint still reading ignore files above the repo's own .git boundary.

Why this matters

This breaks oxlint . / oxlint src in Cursor worktrees even though the worktree itself is a normal git checkout. Cursor stores those worktrees under ~/.cursor/worktrees/..., and its top-level .cursor/.gitignore ignores almost everything there.

Because explicit file paths still work, this looks like a directory walker / parent ignore discovery problem rather than a parsing or config-loading problem.

If helpful, I can also provide a minimal synthetic repro that uses:

  • an ancestor directory with .gitignore containing *
  • a nested repo/worktree below it with its own .git
  • oxlint src returning 0 files while oxlint src/file.ts works

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions