Skip to content

Commit

Permalink
[Refactor] export: clean up rule, tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 1, 2022
1 parent ade33a4 commit 3603428
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 79 deletions.
20 changes: 12 additions & 8 deletions src/rules/export.js
Expand Up @@ -131,15 +131,19 @@ module.exports = {
}

return {
'ExportDefaultDeclaration': (node) => addNamed('default', node, getParent(node)),
ExportDefaultDeclaration(node) {
addNamed('default', node, getParent(node));
},

'ExportSpecifier': (node) => addNamed(
node.exported.name || node.exported.value,
node.exported,
getParent(node.parent),
),
ExportSpecifier(node) {
addNamed(
node.exported.name || node.exported.value,
node.exported,
getParent(node.parent),
);
},

'ExportNamedDeclaration': function (node) {
ExportNamedDeclaration(node) {
if (node.declaration == null) return;

const parent = getParent(node);
Expand All @@ -165,7 +169,7 @@ module.exports = {
}
},

'ExportAllDeclaration': function (node) {
ExportAllDeclaration(node) {
if (node.source == null) return; // not sure if this is ever true

// `export * as X from 'path'` does not conflict
Expand Down

0 comments on commit 3603428

Please sign in to comment.