runem / web-component-analyzer

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

Option to limit scanning to JSDoc only / other form to limit results #280

Open riovir opened 5 months ago

riovir commented 5 months ago

Use case

Maintaining a component pack built on top of another one. (Specifically @lion/ui.) The design system only supports a subset of the underlying components, implemented via extending a base class. Since the analyzer notices and automatically includes the props and other APIs of the underlying components those get exposed.

This results in officially supported APIs (currently defined in JSDoc) getting mixed with inherited APIs. (Also following different documentation style.) Once under-the-hood changes remove those exposed APIs, patch releases are prone to cause broken apps that accidentally use an unsupported prop.

Feature request

It would be great to have a flag that limits the analyzer to JSDoc-only, or opts out from scanning for known libraries. Inspecting the source seemed to hint that a hidden option, analyzeDefaultLib could be disabled via the --no-analyzeDefaultLib flag. That said, the resulting custom-elements.json still includes the inherited props.

riovir commented 5 months ago

Found a workaround: declare a fake class intended only to be documented with JSDoc. This way the analyzer will ignore the real class as it has no @element annotation.