documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Lint and build break on documented class properties declared in constructor

Open stalgiag opened this issue 2 years ago • 0 comments

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

  • What version of documentation.js are you using?:
    • v14.0.2
  • How are you running documentation.js (on the CLI, Node.js API, Grunt, other?):
    • Node, tested with both documentation.build() and documentation.lint(), same error on both.

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.

stalgiag avatar Nov 14 '23 23:11 stalgiag