From 43058f6f64623cbe670656c540474024e2e33d8f Mon Sep 17 00:00:00 2001 From: AdriAt360 Date: Wed, 8 Jun 2022 11:52:16 +0200 Subject: [PATCH] [Fix] `no-restricted-paths`: use `Minimatch.match` instead of `minimatch` to comply with Windows Native paths --- src/rules/no-restricted-paths.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rules/no-restricted-paths.js b/src/rules/no-restricted-paths.js index 9d56949726..9b17975b5c 100644 --- a/src/rules/no-restricted-paths.js +++ b/src/rules/no-restricted-paths.js @@ -3,7 +3,7 @@ import path from 'path'; import resolve from 'eslint-module-utils/resolve'; import moduleVisitor from 'eslint-module-utils/moduleVisitor'; import isGlob from 'is-glob'; -import { Minimatch, default as minimatch } from 'minimatch'; +import { Minimatch } from 'minimatch'; import docsUrl from '../docsUrl'; import importType from '../core/importType'; @@ -83,7 +83,8 @@ module.exports = { function isMatchingTargetPath(filename, targetPath) { if (isGlob(targetPath)) { - return minimatch(filename, targetPath); + const mm = new Minimatch(targetPath); + return mm.match(filename); } return containsPath(filename, targetPath);