Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #168 from liferay/wincent/export-no-source
Browse files Browse the repository at this point in the history
fix(import-extensions): handle exports without sources
  • Loading branch information
wincent authored Apr 3, 2020
2 parents 2ff29ef + fb5ba95 commit df44835
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ module.exports = {
} else if (
(node.type === 'ExportNamedDeclaration' ||
node.type === 'ExportAllDeclaration') &&
node.source &&
(node.source.type === 'Literal' ||
node.source.type === 'TemplateLiteral')
) {
Expand Down
12 changes: 12 additions & 0 deletions plugins/eslint-plugin-liferay/tests/lib/rules/import-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,17 @@ ruleTester.run('import-extensions', rule, {
{
code: `const billboard = not_a_require('billboard.js');`,
},
{
// Regression discovered here:
//
// https://github.com/liferay/liferay-npm-tools/pull/429#issuecomment-608451060
//
// Can't assume that all exports have a source.
code: `
const foo = 1;
export {foo};
`,
},
],
});

0 comments on commit df44835

Please sign in to comment.