Skip to content

Commit

Permalink
Merge 382b26c into 15e5c61
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmilajesupaul committed Jun 10, 2019
2 parents 15e5c61 + 382b26c commit c2d3c70
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/rules/prefer-default-export.js
Expand Up @@ -47,9 +47,12 @@ module.exports = {
// if there are specifiers, node.declaration should be null
if (!node.declaration) return

// don't count flow types exports
// don't warn on single type aliases or declarations
if (node.exportKind === 'type') return

if(node.declaration.type === 'TSTypeAliasDeclaration'
|| node.declaration.type === 'TypeAlias') return

if (node.declaration.declarations) {
node.declaration.declarations.forEach(function(declaration) {
captureDeclaration(declaration.id)
Expand Down
10 changes: 10 additions & 0 deletions tests/src/rules/prefer-default-export.js
Expand Up @@ -84,6 +84,16 @@ ruleTester.run('prefer-default-export', rule, {
parser: 'babel-eslint',
}),

// Single type declaration
test({
code: 'export type foo = string',
parser: 'typescript-eslint-parser',
}),
test({
code: 'export type foo = string',
parser: 'babel-eslint',
}),

// ...SYNTAX_CASES,
],
invalid: [
Expand Down

0 comments on commit c2d3c70

Please sign in to comment.