picomatch icon indicating copy to clipboard operation
picomatch copied to clipboard

cwd option does nothing?

Open TwitchBronBron opened this issue 3 years ago • 2 comments

The cwd option is specified in the docs here. image

However, It doesn't appear to be used anywhere in the picomatch source code. See this github text search. https://github.com/micromatch/picomatch/search?q=cwd

Here are some simple tests proving the cwd option isn't used.

var picomatch = require('picomatch');

console.log(
    picomatch.isMatch('file.txt', '*.txt')
); //true

console.log(
    picomatch.isMatch('C:/projects/file.txt', '*.txt', { cwd: 'C:/projects' })
); //false

console.log(
    picomatch.isMatch('file.txt', '*.txt', { cwd: 'totally/bogus/cwd' })
); //true

Does picomatch need to be updated to add the cwd option, or should all the unsupported options in the docs be removed?

TwitchBronBron avatar Mar 16 '22 13:03 TwitchBronBron

Just noticed this issue too. There is no cwd reference in the code base.

3cp avatar Apr 30 '22 09:04 3cp

I think cwd is handled by fast-glob, not the underneath micromatch and picomatch. No idea why the option shows up in micromatch and picomatch's doc.

3cp avatar Apr 30 '22 11:04 3cp