@@ -3,8 +3,8 @@ import fs from 'fs'
3
3
import readPkgUp from 'read-pkg-up'
4
4
import minimatch from 'minimatch'
5
5
import resolve from 'eslint-module-utils/resolve'
6
+ import moduleVisitor from 'eslint-module-utils/moduleVisitor'
6
7
import importType from '../core/importType'
7
- import isStaticRequire from '../core/staticRequire'
8
8
import docsUrl from '../docsUrl'
9
9
10
10
function hasKeys ( obj = { } ) {
@@ -200,28 +200,8 @@ module.exports = {
200
200
allowBundledDeps : testConfig ( options . bundledDependencies , filename ) !== false ,
201
201
}
202
202
203
- // todo: use module visitor from module-utils core
204
- return {
205
- ImportDeclaration : function ( node ) {
206
- if ( node . source ) {
207
- reportIfMissing ( context , deps , depsOptions , node , node . source . value )
208
- }
209
- } ,
210
- ExportNamedDeclaration : function ( node ) {
211
- if ( node . source ) {
212
- reportIfMissing ( context , deps , depsOptions , node , node . source . value )
213
- }
214
- } ,
215
- ExportAllDeclaration : function ( node ) {
216
- if ( node . source ) {
217
- reportIfMissing ( context , deps , depsOptions , node , node . source . value )
218
- }
219
- } ,
220
- CallExpression : function handleRequires ( node ) {
221
- if ( isStaticRequire ( node ) ) {
222
- reportIfMissing ( context , deps , depsOptions , node , node . arguments [ 0 ] . value )
223
- }
224
- } ,
225
- }
203
+ return moduleVisitor ( node => {
204
+ reportIfMissing ( context , deps , depsOptions , node , node . value )
205
+ } , { commonjs : true } )
226
206
} ,
227
207
}
0 commit comments