documentationjs / documentation

:book: documentation for modern JavaScript
http://documentation.js.org/
Other
5.78k stars 482 forks source link

Lint and build break on documented class properties declared in constructor #1617

Open stalgiag opened 7 months ago

stalgiag commented 7 months ago

If you're reporting a bug, please include input code, output documentation, a description of what you expected to happen, and what happened instead.

Error

Running either documentation.build() or documentation.lint() on this file throws an error:

scope.path.parentPath.parentPath.node.id.name,
                                                   ^
TypeError: Cannot read properties of null (reading 'name')
    at ThisExpression (file:///Users/stalgia/Desktop/Work/p5-scratch-pad/node_modules/documentation/src/infer/membership.js:98:52)
    at NodePath._call (/Users/stalgia/Desktop/Work/p5-scratch-pad/node_modules/@babel/traverse/lib/path/context.js:46:20)

Expectation

That these functions will run without throwing errors.

This seems to be an issue with the documentation of the properties declared inside of the constructor. Removing those comments allows both linting and building to work as expected. I understand that this style of inline docs for classes is not recommended but it should be possible to lint without throwing an error on this.

We are evaluating options for replacing our current inline doc parser and this issue is a blocker for documentation.js.