File tree 1 file changed +3
-20
lines changed
1 file changed +3
-20
lines changed Original file line number Diff line number Diff line change @@ -24,32 +24,15 @@ module.exports = {
24
24
25
25
create ( context ) {
26
26
const sourceCode = context . getSourceCode ( ) ;
27
- const ruleInfo = utils . getRuleInfo ( sourceCode . ast ) ;
28
-
29
- if ( ! ruleInfo || ! ruleInfo . create . params . length ) {
30
- return { } ;
31
- }
32
-
33
- if ( ruleInfo . create . params [ 0 ] . type !== 'Identifier' ) {
34
- // TODO: Make the rule detect `module.exports = { create({report}) { report(foo, bar); } };`
35
- return { } ;
36
- }
37
-
38
- const contextIdentifiers = new WeakSet ( ) ;
27
+ let contextIdentifiers ;
39
28
40
29
// ----------------------------------------------------------------------
41
30
// Public
42
31
// ----------------------------------------------------------------------
43
32
44
33
return {
45
- [ ruleInfo . create . type ] ( node ) {
46
- if ( node === ruleInfo . create ) {
47
- context . getDeclaredVariables ( node )
48
- . find ( variable => variable . name === node . params [ 0 ] . name )
49
- . references
50
- . map ( ref => ref . identifier )
51
- . forEach ( identifier => contextIdentifiers . add ( identifier ) ) ;
52
- }
34
+ Program ( node ) {
35
+ contextIdentifiers = utils . getContextIdentifiers ( context , node ) ;
53
36
} ,
54
37
CallExpression ( node ) {
55
38
if (
You can’t perform that action at this time.
0 commit comments