Skip to content

Commit

Permalink
[Fix] no-restricted-paths: use Minimatch.match instead of `minima…
Browse files Browse the repository at this point in the history
…tch` to comply with Windows Native paths
  • Loading branch information
AdriAt360 authored and ljharb committed Jun 8, 2022
1 parent 7378a5e commit d1fe8eb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rules/no-restricted-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d1fe8eb

Please sign in to comment.