runem / web-component-analyzer

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

Analyze seems to pick up variables inside my LitElement code (in ternary operators) #123

Closed hsablonniere closed 4 years ago

hsablonniere commented 4 years ago

Hey, I'm not sure what I'm doing wrong but I tried to reduce the test case:

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

export class TestComponent extends LitElement {
  render () {
    const someBoolean = (42 > 2);
    return html`<div>${someBoolean ? 'yes' : 'no'}</div>`;
  }
}

window.customElements.define('test-component', TestComponent);

When I run wca, the JSON output picks up the internal variable someBoolean.

{
  "version": 2,
  "tags": [
    {
      "name": "test-component",
      "properties": [
        {
          "name": "someBoolean",
          "type": "\"yes\" | \"no\""
        }
      ]
    }
  ]
}
  1. Why is this doing this?
  2. Is this a bug?
  3. Can I help? ;-)
hsablonniere commented 4 years ago

NOTES:

runem commented 4 years ago

Funky issue! Thanks for reporting :+1:

Should be fixed now, but not published yet!

hsablonniere commented 4 years ago

Great ;-)