From 314d6ab0a5359f986104369654741fff67781074 Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Mon, 7 Nov 2016 05:38:08 -0500 Subject: [PATCH] prefer-default-export: handle export extensions default re-export (fixes #653) --- src/rules/prefer-default-export.js | 2 +- tests/src/rules/prefer-default-export.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/rules/prefer-default-export.js b/src/rules/prefer-default-export.js index fe01adbe2..c6c7b8f18 100644 --- a/src/rules/prefer-default-export.js +++ b/src/rules/prefer-default-export.js @@ -26,7 +26,7 @@ module.exports = { return { 'ExportDefaultSpecifier': function() { - specifierExportCount++ + hasDefaultExport = true }, 'ExportSpecifier': function(node) { diff --git a/tests/src/rules/prefer-default-export.js b/tests/src/rules/prefer-default-export.js index 5f61748f1..3a9145198 100644 --- a/tests/src/rules/prefer-default-export.js +++ b/tests/src/rules/prefer-default-export.js @@ -71,6 +71,16 @@ ruleTester.run('prefer-default-export', rule, { parser: 'babel-eslint', }), + // issue #653 + test({ + code: 'export default from "foo.js"', + parser: 'babel-eslint', + }), + test({ + code: 'export { a, b } from "foo.js"', + parser: 'babel-eslint', + }), + // ...SYNTAX_CASES, ], invalid: [