micromatch / micromatch/picomatch

Incorrectly matches `[1-5]` against `[1-5]`

Open
#71 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
1.3k
Forks
135
Avg merge
23h 38m
Merged PRs (30d)
7

Description

  • Code: picomatch('[1-5]')('[1-5]')
  • Expected result: false
  • Actual result: true

Apparently this mistake is caused explicitly:

https://github.com/micromatch/picomatch/blob/4a510d7fd7a3037efaf54786e5fe2b553cdc657a/lib/picomatch.js#L128

Why? This should not match. Please remove this check.

As a workaround, I am using picomatch.makeRe(pattern).test(str) instead of picomatch(pattern)(str).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the check linked in lib/picomatch.js around line 128 and reproduce picomatch('[1-5]')('[1-5]'). Compare that result with picomatch.makeRe(pattern).test(str), then verify the direct matcher returns false for the reported case and add regression coverage using the project's existing test structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.