web-component-analyzer icon indicating copy to clipboard operation
web-component-analyzer copied to clipboard

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

Open riovir opened this issue 1 year ago • 1 comments

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 avatar Apr 12 '24 15:04 riovir

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.

riovir avatar Apr 19 '24 10:04 riovir