Skip to content

Commit

Permalink
Fix #545: allow re-export of defaults from ignored files (i.e. node_m…
Browse files Browse the repository at this point in the history
…odules)
  • Loading branch information
benmosher committed Sep 20, 2016
1 parent b6ac532 commit 24c04b7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function (context) {

if (imports.errors.length) {
imports.reportErrors(context, node)
} else if (!imports.get('default')) {
} else if (imports.get('default') === undefined) {
context.report(defaultSpecifier, 'No default export found in module.')
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/files/default-export-from-ignored.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { foo as default } from './common.js'
1 change: 1 addition & 0 deletions tests/files/default-export-from-named.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { d as default } from './named-exports.js'
1 change: 1 addition & 0 deletions tests/files/default-export-from.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default from './bar'
21 changes: 21 additions & 0 deletions tests/src/rules/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,27 @@ ruleTester.run('default', rule, {
parser: 'babel-eslint',
}),

// #545: more ES7 cases
test({
code: "import bar from './default-export-from.js';",
parser: 'babel-eslint',
}),
test({
code: "import bar from './default-export-from-named.js';",
parser: 'babel-eslint',
}),
test({
code: "import bar from './default-export-from-ignored.js';",
settings: { 'import/ignore': ['common'] },
parser: 'babel-eslint',
}),
test({
code: "export bar from './default-export-from-ignored.js';",
settings: { 'import/ignore': ['common'] },
parser: 'babel-eslint',
}),


...SYNTAX_CASES,
],

Expand Down

0 comments on commit 24c04b7

Please sign in to comment.