Skip to content

Commit

Permalink
Get the fix: skip imports if it is a TSImportEqualsDeclaration and it…
Browse files Browse the repository at this point in the history
… is consuming an object
  • Loading branch information
be5invis committed Jun 19, 2020
1 parent 49a1cbc commit a38d6ad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/rules/newline-after-import.js
Expand Up @@ -119,6 +119,12 @@ after ${type} statement not followed by another ${type}.`,
const { parent } = node
const nodePosition = parent.body.indexOf(node)
const nextNode = parent.body[nodePosition + 1]

// skip object imports
if (node.type === 'TSImportEqualsDeclaration' &&
(!node.moduleReference || node.moduleReference.type !== 'TSExternalModuleReference')) {
return
}

if (nextNode && nextNode.type !== 'ImportDeclaration' && nextNode.type !== 'TSImportEqualsDeclaration') {
checkForNewLine(node, nextNode, 'import')
Expand Down

0 comments on commit a38d6ad

Please sign in to comment.