oxc icon indicating copy to clipboard operation
oxc copied to clipboard

linter: CLI globs wrapped in quotes not supported, necessary in some cases

Open KieranP opened this issue 2 months ago • 3 comments

What version of Oxlint are you using?

1.14.0

What command did you run?

oxlint --type-aware 'src/**/*.{js,ts,svelte}'

What does your .oxlintrc.json config file look like?

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "ignorePatterns": ["/node_modules", "/dist", "/*.{js,ts}"],
  "plugins": ["eslint", "oxc", "typescript", "import", "promise", "unicorn"],
  "categories": {
    "correctness": "error",
    "nursery": "error",
    "pedantic": "error",
    "perf": "error",
    "restriction": "error",
    "style": "error",
    "suspicious": "error"
  }
}

What happened?

I'm trying to switch a project from yarn to pnpm. But unlike yarn, pnpm runs globs in a shell context (it uses default shell, which in my case is zsh, which complains if it can't find something).

$ ls -la **/test.non
zsh: no matches found: **/test.non
$ echo $?
1

For some other common JS CLIs (eslint, prettier), all I needed to do was wrap the globs in quotes, turning it from a shell processed glob to an application processed glob. But oxlint doesn't support this.

The problem command in question is:

$ pnpm oxlint --type-aware src/**/*.{js,ts,svelte}
zsh: no matches found: src/**/*.js
$ echo $?
1

Which is expected (zsh default setting to error when glob doesn't match something). But if I wrap the glob in quotes, the command runs, but on 0 files:

$ pnpm oxlint --type-aware 'src/**/*.{js,ts,svelte}'
Found 0 warnings and 0 errors.
Finished in 4ms on 0 files with 377 rules using 12 threads.
$ echo $?
0

It seems oxlint relies on globs being executed in the shell environment before being passed into the oxlint program. If I quote the glob, I imagine oxlint is treating it like a filename, and not finding it.

As mentioned earlier, this is in contrast with eslint, which supports quotes, and parses them internally, so that it does not have to rely on the shell to do it:

$ pnpm eslint 'src/**/*.{js,ts,svelte}'
$ echo $?
0
```run 

KieranP avatar Sep 05 '25 10:09 KieranP

There is also a bug in pnpm where globs within package scripts also aren't getting fully resolved (https://github.com/pnpm/pnpm/issues/9943), making this ticket even more crucial to being able to use oxlint with pnpm.

KieranP avatar Sep 05 '25 11:09 KieranP

The issues stem from how different shells (and different versions of shells) handle ** glob path expansion. Some don't support at all, some support in full, and some are in between. Some error, some dont. See #13555

If OxLint accepted quote glob paths and resolves them itself, this would provide consistency and reliability across all systems, regardless of shell type or shell version.

KieranP avatar Sep 06 '25 02:09 KieranP

Also seems like glob patterns with different endings are not supported (even in standard sh shell), I guess due to limited capabilities of the shell.

Works:

  • oxlint -c .oxlintrc.json ./*
  • oxlint -c .oxlintrc.json ./**
  • oxlint -c .oxlintrc.json ./*
  • oxlint -c .oxlintrc.json ./**/*.ts

Does not work:

  • oxlint -c .oxlintrc.json ./**/*.{ts,tsx}

Having "native glob support" would be ideal. A workaround could be via ignorePatterns for now

TheAlexLichter avatar Nov 07 '25 15:11 TheAlexLichter

Yeah I think this is important to fix for consistency, especially in preventing unintended differences between CI envs and local developer envs, if they use different shells.

connorshea avatar Nov 22 '25 21:11 connorshea