Skip to content

Commit

Permalink
Ignoring flow type exports (#639)
Browse files Browse the repository at this point in the history
* Ignoring flow type exports, resolve #484

* Added test and note to CHANGELOG
  • Loading branch information
jakubsta authored and benmosher committed Nov 3, 2016
1 parent 2602b5d commit 29bc56e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
- [`no-extraneous-dependencies`]: check globs against CWD + absolute path ([#602] + [#630], thanks [@ljharb])

### Fixed
- [`prefer-default-export`] handles flow `export type` ([#484])
- [`prefer-default-export`] handles re-exported default exports ([#609])
- Fix crash when using [`newline-after-import`] with decorators ([#592])
- Properly report [`newline-after-import`] when next line is a decorator
Expand Down
3 changes: 3 additions & 0 deletions src/rules/prefer-default-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ module.exports = {
// if there are specifiers, node.declaration should be null
if (!node.declaration) return

// don't count flow types exports
if (node.exportKind === 'type') return

if (node.declaration.declarations) {
node.declaration.declarations.forEach(function(declaration) {
captureDeclaration(declaration.id)
Expand Down
5 changes: 5 additions & 0 deletions tests/src/rules/prefer-default-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ ruleTester.run('prefer-default-export', rule, {
import * as foo from './foo';`,
}),

test({
code: `export type UserId = number;`,
parser: 'babel-eslint',
}),

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

0 comments on commit 29bc56e

Please sign in to comment.