Skip to content

Commit

Permalink
Change order and newline-after-import to exclude "export import"s only
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Jun 19, 2020
1 parent a38d6ad commit c36429b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/rules/newline-after-import.js
Expand Up @@ -120,9 +120,8 @@ after ${type} statement not followed by another ${type}.`,
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')) {
// skip "export import"s
if (node.type === 'TSImportEqualsDeclaration' && node.isExport) {
return
}

Expand Down
4 changes: 4 additions & 0 deletions src/rules/order.js
Expand Up @@ -615,6 +615,10 @@ module.exports = {
TSImportEqualsDeclaration: function handleImports(node) {
let name
let type
// skip "export import"s
if (node.isExport) {
return
}
if (node.moduleReference.type === 'TSExternalModuleReference') {
name = node.moduleReference.expression.value
type = 'import'
Expand Down

0 comments on commit c36429b

Please sign in to comment.