oui
oui copied to clipboard
Fix anonymous class error in docsite
With PR #1104, building the docsite fails because of this line:
https://github.com/opensearch-project/oui/blob/a17c839b6102b16619b7bff6ba94b328a99db836/src-docs/src/views/comment/comment_actions.tsx#L38
The issue is that the proptypes-from-ts-props
Babel plugin doesn't support anonymous classes. There are a few ways that I can think to resolve this:
- Refactor the component to a functional component. This shouldn't be too much effort and could be considered a modernization effort.
- Filter the plugin so it doesn't run on docsite files. The plugin is really just to make sure proptypes are generated for source components, so it doesn't make much sense that it's running on the docsite. Granted, this doesn't really fix anything, just suppresses it.
- Give the class a name. This is a pretty quick and simple fix, but doesn't account for if this crops up in the future. Granted, if we only accept functional components in the future, this shouldn't be an issue.
- Add support for this in the Babel plugin. This may require gaining some knowledge about that plugin, which seems quite large and complex, so my mind doesn't immediately run to this one.
I put these in order of what I would prefer, but I want to get more opinions on this.