File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ module.exports = {
34
34
shouldCheck : false ,
35
35
node : null ,
36
36
} ;
37
+ let contextIdentifiers ;
37
38
38
39
/**
39
40
* Checks whether or not the last code path segment is reachable.
@@ -56,20 +57,27 @@ module.exports = {
56
57
}
57
58
58
59
return {
60
+ Program ( node ) {
61
+ contextIdentifiers = utils . getContextIdentifiers ( context , node ) ;
62
+ } ,
59
63
60
64
// Stacks this function's information.
61
65
onCodePathStart ( codePath , node ) {
62
66
const parent = node . parent ;
67
+ const shouldCheck = node . type === 'FunctionExpression' &&
68
+ node . body . type === 'BlockStatement' &&
69
+ // check if it is context.report({fix})
70
+ utils . getKeyName ( parent ) === 'fix' &&
71
+ parent . parent . type === 'ObjectExpression' &&
72
+ parent . parent . parent . type === 'CallExpression' &&
73
+ contextIdentifiers . has ( parent . parent . parent . callee . object ) &&
74
+ parent . parent . parent . callee . property . name === 'report' ;
63
75
64
76
funcInfo = {
65
77
upper : funcInfo ,
66
78
codePath,
67
79
hasReturn : false ,
68
- shouldCheck :
69
- node . type === 'FunctionExpression' &&
70
- node . body . type === 'BlockStatement' &&
71
- // check if it is naming fix
72
- utils . getKeyName ( parent ) === 'fix' ,
80
+ shouldCheck,
73
81
node,
74
82
} ;
75
83
} ,
You can’t perform that action at this time.
0 commit comments