Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "Forward unconsumed props" assist to analyzer plugin #590

Open
aaronlademann-wf opened this issue Jun 29, 2020 · 0 comments
Open

Add a "Forward unconsumed props" assist to analyzer plugin #590

aaronlademann-wf opened this issue Jun 29, 2020 · 0 comments

Comments

@aaronlademann-wf
Copy link
Contributor

aaronlademann-wf commented Jun 29, 2020

Similar to the assist that adds a ref, this assist would automatically add:

..modifyProps(addUnconsumedDomProps)

To Dom.* builders, and:

..modifyProps(addUnconsumedProps)

to custom component builders.

For the addUnconsumedProps one - the assist should also check to see if consumedProps is set, and if not - set it to:

@override
get consumedProps => propsMeta.forMixins({
  NameOfSinglePropsMixinUsedByComponent
});

if the component only uses a single mixin, or if there is a mixin used by a concrete props class that matches the form: <NameOfFactory>PropsMixin.

If the prop mixin situation is more complicated than that, and there isn't already a consumedProps override in the class, add something like this - with the comment as a linked group so that the user's selection is there after the assist runs so that its highlighted, and so they can easily start typing the name of the mixin(s) they want to consume.

@override
get consumedProps => propsMeta.forMixins({
  // FIXME: Add the names of mixin(s) with prop keys that should not be forwarded to the child component
});

Related to https://github.com/Workiva/over_react_analyzer_plugin/issues/41 / #591

Transferred from https://github.com/Workiva/over_react_analyzer_plugin/issues/56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant