Skip to content

Commit cae8d6c

Browse files
committed
fix: add "allowWindowsEscape" to Minimatch options
1 parent 5fdc48c commit cae8d6c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/util/check-restricted.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ class Restriction {
3939
const negate = raw[0] === "!" && raw[1] !== "("
4040
const pattern = negate ? raw.slice(1) : raw
4141
const absolute = path.isAbsolute(pattern)
42-
const matcher = new Minimatch(pattern, { dot: true })
42+
const matcher = new Minimatch(pattern, {
43+
allowWindowsEscape: true,
44+
dot: true,
45+
})
4346
return { absolute, matcher, negate }
4447
})
4548

lib/util/get-convert-path.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
"use strict"
66

7-
const Minimatch = require("minimatch").Minimatch
7+
const { Minimatch } = require("minimatch")
88

99
/**
1010
* @param {any} x - An any value.
@@ -53,8 +53,12 @@ function toStringArray(x) {
5353
* @returns {function} Created predicate function.
5454
*/
5555
function createMatch(includePatterns, excludePatterns) {
56-
const include = includePatterns.map(pattern => new Minimatch(pattern))
57-
const exclude = excludePatterns.map(pattern => new Minimatch(pattern))
56+
const include = includePatterns.map(
57+
pattern => new Minimatch(pattern, { allowWindowsEscape: true })
58+
)
59+
const exclude = excludePatterns.map(
60+
pattern => new Minimatch(pattern, { allowWindowsEscape: true })
61+
)
5862

5963
return filePath =>
6064
include.some(m => m.match(filePath)) &&

0 commit comments

Comments
 (0)