Skip to content

Commit

Permalink
Apply code suggestion: check decl.id is non-null.
Browse files Browse the repository at this point in the history
  • Loading branch information
golopot committed May 30, 2019
1 parent 636b6f6 commit 5361f3f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rules/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ function isPlainRequireModule(node) {
return false
}
const decl = node.declarations[0]
const result = (decl.id.type === 'Identifier' || decl.id.type === 'ObjectPattern') &&
const result = decl.id &&
(decl.id.type === 'Identifier' || decl.id.type === 'ObjectPattern') &&
decl.init != null &&
decl.init.type === 'CallExpression' &&
decl.init.callee != null &&
Expand Down

0 comments on commit 5361f3f

Please sign in to comment.