micromatch / picomatch

Blazing fast and accurate glob matcher written JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. Used by GraphQL, Jest, Astro, Snowpack, Storybook, bulma, Serverless, fdir, Netlify, AWS Amplify, Revogrid, rollup, routify, open-wc, imba, ava, docusaurus, fast-glob, globby, chokidar, anymatch, cloudflare/miniflare, pts, and more than 5 million projects! Please follow picomatch's author: https://github.com/jonschlinkert
https://github.com/micromatch
MIT License
972 stars 56 forks source link

cwd option does nothing? #105

Open TwitchBronBron opened 2 years ago

TwitchBronBron commented 2 years ago

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?

3cp commented 2 years ago

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

3cp commented 2 years ago

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.