Skip to content

Commit 10acd08

Browse files
committed
refactoring(require-jsdoc): remove unreached (and if fixed, unneeded) code block
testing: ignore unused guard block
1 parent d9fdc7a commit 10acd08

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/exportParser.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,21 +282,23 @@ const findNode = function (node, block, cache) {
282282
};
283283

284284
const findExportedNode = function (block, node, cache) {
285+
/* istanbul ignore next */
285286
if (block === null) {
286287
return false;
287288
}
288289
const blockCache = cache || [];
289-
for (const key in block.props) {
290-
if (Object.prototype.hasOwnProperty.call(block.props, key)) {
291-
blockCache.push(block.props[key]);
292-
if (block.props[key].exported) {
290+
const {props} = block;
291+
for (const key in props) {
292+
if (Object.prototype.hasOwnProperty.call(props, key)) {
293+
blockCache.push(props[key]);
294+
if (props[key].exported) {
293295
if (findNode(node, block)) {
294296
return true;
295297
}
296298
}
297-
if (!blockCache.includes(block.props[key]) && findExportedNode(block.props[key], node, blockCache)) {
298-
return true;
299-
}
299+
300+
// No need to check `props[key]` for exported nodes as ESM
301+
// exports are only global
300302
}
301303
}
302304

0 commit comments

Comments
 (0)