File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 4
4
*/
5
5
'use strict' ;
6
6
7
- const micromatch = require ( 'micromatch' ) ;
8
7
const { getFolderPath, getFilename } = require ( '../utils/filename' ) ;
9
8
const { checkSettings, globPatternValidator } = require ( '../utils/settings' ) ;
10
9
const { getDocUrl } = require ( '../utils/doc' ) ;
10
+ const { matchRule } = require ( '../utils/match' ) ;
11
11
12
12
/**
13
13
* @type {import('eslint').Rule.RuleModule }
@@ -60,18 +60,22 @@ module.exports = {
60
60
const folderPath = getFolderPath ( filenameWithPath ) ;
61
61
62
62
for ( const [ fexPattern , folderPattern ] of Object . entries ( rules ) ) {
63
- if ( ! micromatch . isMatch ( filename , fexPattern ) ) {
64
- continue ;
65
- } else if ( micromatch . isMatch ( folderPath , folderPattern ) ) {
66
- return ;
67
- } else {
63
+ const matchResult = matchRule (
64
+ filename ,
65
+ fexPattern ,
66
+ folderPath ,
67
+ folderPattern
68
+ ) ;
69
+
70
+ if ( matchResult ) {
71
+ const { pattern } = matchResult ;
68
72
context . report ( {
69
73
node,
70
74
message :
71
- 'The folder of the file "{{filenameWithPath}}" does not match "{{folderPattern }}"' ,
75
+ 'The folder of the file "{{filenameWithPath}}" does not match "{{pattern }}"' ,
72
76
data : {
73
77
filenameWithPath,
74
- folderPattern ,
78
+ pattern ,
75
79
} ,
76
80
} ) ;
77
81
return ;
You can’t perform that action at this time.
0 commit comments