Skip to content

Commit 020d12d

Browse files
committed
chore: add picomatch options for consistent glob matching
1 parent fc07a30 commit 020d12d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/steiger/src/shared/globs/create-filter-according-to-globs.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ export function createFilterAccordingToGlobs({ inclusions, exclusions }: ApplyGl
1313
const thereAreInclusions = Array.isArray(inclusions)
1414
const thereAreExclusions = Array.isArray(exclusions)
1515
const inclusionsEmpty = thereAreInclusions && inclusions.length === 0
16+
const picomatchOptions = { posixSlashes: true }
1617

17-
const isIncluded = thereAreInclusions ? picomatch(inclusions) : () => true
18+
const isIncluded = thereAreInclusions ? picomatch(inclusions, picomatchOptions) : () => true
1819

1920
const positiveExclusionPatterns =
2021
(thereAreExclusions && exclusions.filter((pattern) => !isNegatedGlob(pattern))) || []
2122
const negativeExclusionPatterns =
2223
(thereAreExclusions && exclusions.filter((pattern) => isNegatedGlob(pattern)).map((pattern) => pattern.slice(1))) ||
2324
[]
2425

25-
const isPositivelyExcluded = picomatch(positiveExclusionPatterns)
26-
const isReIncluded = picomatch(negativeExclusionPatterns)
26+
const isPositivelyExcluded = picomatch(positiveExclusionPatterns, picomatchOptions)
27+
const isReIncluded = picomatch(negativeExclusionPatterns, picomatchOptions)
2728

2829
function filterAccordingToGlobs(path: string) {
2930
if (inclusionsEmpty) {

0 commit comments

Comments
 (0)