Skip to content

Commit 72708a0

Browse files
committed
Fix export without declaration. Fixes #393
1 parent 70f92db commit 72708a0

File tree

8 files changed

+211
-33
lines changed

8 files changed

+211
-33
lines changed

lib/infer/kind.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ module.exports = function () {
5050
// This behavior is in need of fixing https://github.com/documentationjs/documentation/issues/351
5151
findKind(path.node.declarations[0].init);
5252
}
53-
} else if (t.isExportNamedDeclaration(path)) {
53+
} else if (t.isExportNamedDeclaration(path) && path.node.declaration) {
54+
// && makes sure that
55+
// export { foo } from bar;
56+
// doesn't check for a non-existent declaration type
5457
if (path.node.declaration.kind === 'const') {
5558
comment.kind = 'constant';
5659
}

test/fixture/es6-import.output.json

Lines changed: 52 additions & 16 deletions
Large diffs are not rendered by default.

test/fixture/es6-import.output.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ This function returns the number one.
5050

5151
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone
5252

53+
# execute
54+
55+
This is re-exported
56+
5357
# foo
5458

5559
This is an async method

test/fixture/es6-import.output.md.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,51 @@
865865
}
866866
]
867867
},
868+
{
869+
"depth": 1,
870+
"type": "heading",
871+
"children": [
872+
{
873+
"type": "text",
874+
"value": "execute"
875+
}
876+
]
877+
},
878+
{
879+
"type": "paragraph",
880+
"children": [
881+
{
882+
"type": "text",
883+
"value": "This is re-exported",
884+
"position": {
885+
"start": {
886+
"line": 1,
887+
"column": 1,
888+
"offset": 0
889+
},
890+
"end": {
891+
"line": 1,
892+
"column": 20,
893+
"offset": 19
894+
},
895+
"indent": []
896+
}
897+
}
898+
],
899+
"position": {
900+
"start": {
901+
"line": 1,
902+
"column": 1,
903+
"offset": 0
904+
},
905+
"end": {
906+
"line": 1,
907+
"column": 20,
908+
"offset": 19
909+
},
910+
"indent": []
911+
}
912+
},
868913
{
869914
"depth": 1,
870915
"type": "heading",

test/fixture/es6.input.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,8 @@ function iAmPublic() { }
117117
* @access private
118118
*/
119119
function iAmAccessPrivate() { }
120+
121+
/**
122+
* This is re-exported
123+
*/
124+
export { execute } from 'external-module';

test/fixture/es6.output.json

Lines changed: 52 additions & 16 deletions
Large diffs are not rendered by default.

test/fixture/es6.output.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ This function returns the number one.
5050

5151
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** numberone
5252

53+
# execute
54+
55+
This is re-exported
56+
5357
# foo
5458

5559
This is an async method

test/fixture/es6.output.md.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,51 @@
865865
}
866866
]
867867
},
868+
{
869+
"depth": 1,
870+
"type": "heading",
871+
"children": [
872+
{
873+
"type": "text",
874+
"value": "execute"
875+
}
876+
]
877+
},
878+
{
879+
"type": "paragraph",
880+
"children": [
881+
{
882+
"type": "text",
883+
"value": "This is re-exported",
884+
"position": {
885+
"start": {
886+
"line": 1,
887+
"column": 1,
888+
"offset": 0
889+
},
890+
"end": {
891+
"line": 1,
892+
"column": 20,
893+
"offset": 19
894+
},
895+
"indent": []
896+
}
897+
}
898+
],
899+
"position": {
900+
"start": {
901+
"line": 1,
902+
"column": 1,
903+
"offset": 0
904+
},
905+
"end": {
906+
"line": 1,
907+
"column": 20,
908+
"offset": 19
909+
},
910+
"indent": []
911+
}
912+
},
868913
{
869914
"depth": 1,
870915
"type": "heading",

0 commit comments

Comments
 (0)