sindresorhus/globby

`{extension: false}` and `expandDirectories.extensions` don't work together #97

garyking posted onGitHub

If using noext: true (or extension: false, which is the same thing), and expandDirectories.extensions, then no results will be returned.

Example:

globby.sync(dirPath, {
  expandDirectories: {
    // Must have more than one extension here.
    extensions: ['md', 'txt'],
  },
  extension: false,
})

Would you be able to submit a pull request with one or more failing tests? That would help getting this fixed faster.

posted by sindresorhus over 6 years ago

@sindresorhus Done

posted by garyking over 6 years ago

@issuehunt has funded $40.00 to this issue. See it on IssueHunt

posted by IssueHuntBot about 6 years ago

dir-glob is appending all extensions to the glob pattern: tmp\\**\\*.{md,tmp}. The option noext turns extglob support off, so fast-glob is unable to resolve the pattern.

@sindresorhus Should we just display a warning/error when both options are used simultaneously? That would of course need some kind of documentation.

posted by medusalix about 6 years ago

@medusalix According to the fast-glob docs, the noext options disables patterns like +(a|b)). dir-glob doesn't use that pattern syntax, it uses brace expansion, which is a different option nobrace.

posted by sindresorhus about 6 years ago

@sindresorhus fast-glob uses micromatch, which turns tmp\\**\\*.{md,tmp} into tmp/**/*.(md|tmp) using brace expansion. When noext is specified, literal parentheses get matched:

it('should match literal parens when noext is true (issue #116)', function() {
    assert(mm.isMatch('a/(dir)', 'a/(dir)', {noext: true}));
});
posted by medusalix about 6 years ago

@sindresorhus We could just throw an error if noext: true and expandDirectories.extensions are used together.

posted by medusalix about 6 years ago

That sounds like a leaked implementation detail and should be reported to fast-glob. Can you open an issue on fast-glob about this?

But yes, we should still throw an error for now until it's fixed in fast-glob.

posted by sindresorhus about 6 years ago

the issue I opened isn't actionable apparently.

posted by janat08 almost 6 years ago
posted by janat08 almost 6 years ago

@sindresorhus has rewarded $36.00 to @janat08. See it on IssueHunt

  • :moneybag: Total deposit: $40.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $4.00
posted by issuehunt-app[bot] over 5 years ago

Fund this Issue

$40.00
Rewarded

Rewarded pull request

Recent activities

janat08 was rewarded by sindresorhus for sindresorhus/globby# 97
over 5 years ago
janat08 submitted an output to  sindresorhus/ globby# 97
almost 6 years ago