question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pathGroups using minimatch instead of real regexes

See original GitHub issue

The new pathGroup addition is using minimatch, this being based on shell glob expansions makes it incredible hard to do differing matching on paths containing ../ updots, as these are not easily (if at all) added to the minimatch expression in unspecified depth. Yes, the codebase should import from the roots and not jump up arbitrarily, but sometimes the world is at it is. This shortcoming is not evident inside the PR tests themselves, as all these prefix with special characters: https://github.com/benmosher/eslint-plugin-import/pull/1386/files I didn’t find a way to express my wanted regex with minimatch, it would be great to have a shortcutting flag to just supply a real regex.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:27 (12 by maintainers)

github_iconTop GitHub Comments

7reactions
ljharbcommented, Jan 27, 2020

I’m not interested in a regex approach; I’d rather fix the way we’re using minimatch.

In other words, I’d expect you to be able to use globs - multiple globs in an array if possible - to achieve what you want, and if you can’t right now, let’s make that happen.

4reactions
tulircommented, Feb 16, 2020

Pretty sure it doesn’t:

> minimatch("../../web_modules/preact.js", "**/web_modules/**")
false
> minimatch("../../web_modules/preact.js", "{.,..,../..,../../..}/web_modules/**")
true
Read more comments on GitHub >

github_iconTop Results From Across the Web

pathGroups using minimatch instead of real regexes #1632
The new pathGroup addition is using minimatch, this being based on shell glob expansions makes it incredible hard to do differing matching ...
Read more >
ESLint plugin import not sorting properly - Stack Overflow
Okay, I solved this. The problem was that eslint couldn't resolve typescript aliases and that's why it sorts imports randomly, ...
Read more >
Regular Expression Denial of Service (ReDoS) in minimatch
minimatch is a minimal matching utility. Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) ...
Read more >
eslint-plugin-import | Yarn - Package Manager
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names.
Read more >
Understanding AS Path Regular Expressions for Use as ...
When working with AS paths and routing policy match conditions, you can use regular expressions to locate routes. To do so, create one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found