runem / web-component-analyzer

CLI that analyzes web components and emits documentation
https://runem.github.io/web-component-analyzer
MIT License
504 stars 64 forks source link

Failed gathering comments in LitElement component #101

Closed yveslange closed 4 years ago

yveslange commented 5 years ago

The comment is not added to the resulting markdown output.

☠ Failing usecase: » file: src/first-compo.js

import { html, css, LitElement } from 'lit-element';

@customElement('first-compo')
export class FirstCompo extends LitElement {
  static get properties() {
    return {
      /**
       * This is my comment for the property `foo`
       */
      foo: {
        type: String,
      },
    };
  }

constructor()  {
  this.foo = "init foo";
}

✓ Working usecase 1:

  static get properties() {
    return {
      /**
       * This is my comment for the property `foo`
       */
      foo: {
        type: String,
      },
    };
  }

constructor()  {
  // initialization removed
}

Here the This is my comment for the property foo will be used

✓ Working usecase 2:

  static get properties() {
    return {
      /**
       * This is my comment for the property `foo`
       */
      foo: {
        type: String,
      },
    };
  }

constructor()  {
   /**
     * My comment for foo in the constructor
     */
   this.foo = "something"
}

Here, the My comment for foo in the constructor will be used

It seems that if

I would suggest to use the comment from the properties instead of nothing.

runem commented 4 years ago

Version 1.0.0 which has just been published parses jsdoc inside static get properties() { :tada: Thanks for opening this issue :+1:

yveslange commented 4 years ago

Works thanks