Skip to content

Commit

Permalink
use VariableDeclarator instead of looping VariableDeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
vikr01 committed Oct 26, 2018
1 parent 1834f05 commit 8fe7df2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/rules/named.js
Expand Up @@ -64,12 +64,9 @@ module.exports = {
})
}

function checkRequire(declarationNode) {
if(!options.commonjs) {
return
}
function checkRequire(node) {
if(!options.commonjs) return

declarationNode.declarations.forEach(function(node) {
if(node.type !== 'VariableDeclarator') return

if(!node.id || node.id.type !== 'ObjectPattern' || node.id.properties.length === 0) {
Expand Down Expand Up @@ -122,7 +119,6 @@ module.exports = {
}
}
})
})
}

return {
Expand All @@ -136,7 +132,7 @@ module.exports = {
, 'ExportSpecifier'
),

'VariableDeclaration': checkRequire,
'VariableDeclarator': checkRequire,
}

},
Expand Down

0 comments on commit 8fe7df2

Please sign in to comment.