Skip to content

Commit d89ec13

Browse files
authored
[Fix] guard against empty parent
1 parent 3a5ad34 commit d89ec13

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/rules/newline-after-import.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ module.exports = {
149149

150150
function checkImport(node) {
151151
const { parent } = node;
152+
153+
if(!parent || !parent.body){
154+
return
155+
}
156+
152157
const nodePosition = parent.body.indexOf(node);
153158
const nextNode = parent.body[nodePosition + 1];
154159
const endLine = node.loc.end.line;

0 commit comments

Comments
 (0)