Skip to content

Commit

Permalink
[Fix] guard against empty parent
Browse files Browse the repository at this point in the history
  • Loading branch information
laurens-dg authored Jul 18, 2023
1 parent 3a5ad34 commit d89ec13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rules/newline-after-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ module.exports = {

function checkImport(node) {
const { parent } = node;

if(!parent || !parent.body){
return
}

const nodePosition = parent.body.indexOf(node);
const nextNode = parent.body[nodePosition + 1];
const endLine = node.loc.end.line;
Expand Down

0 comments on commit d89ec13

Please sign in to comment.