Skip to content

Incorrect warning: Failed to find parent of doclet #133

Open
@mramato

Description

@mramato

Given SomeClass.js

/**
 * Some Class
 * @constructor
 * @private
 */
function SomeClass() {}

/**
 * Some Function
 */
SomeClass.someFunction = function () {};

/**
 * Some Prototype Function
 */
SomeClass.somePrototypeFunction = function () {};

export default SomeClass;

tsd-jsdoc outputs the below, incorrect, warnings:

[TSD-JSDoc] SomeClass.js:12:0 Failed to find parent of doclet 'SomeClass.someFunction' using memberof 'SomeClass', this is likely due to invalid JSDoc.
[TSD-JSDoc] SomeClass.js:18:0 Failed to find parent of doclet 'SomeClass.somePrototypeFunction' using memberof 'SomeClass', this is likely due to invalid JSDoc.

tsd-jsdoc should pick up on the fact that SomeClass is marked private and not print warnings for someFunction or somePrototypeFunction because they are automatically made private as well (according to JSDoc). JSDoc has no issues with this file.

I was able to hack up the JS to fix for this in my local tsd-jsdoc install, but would be happy to open a PR to fix it properly. I did this by adding an _ignoredNodes property to Emitter and then wrapping the warning in an additional check to see if the memberof is an ignored node and only displaying the warning if that is the case.

Thanks again for an awesome tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions