Description
Hello
First, thank you for the plugin which works very well and helps us catch a lot of issues at code time :-)
I have a use-case in my project where a method is used to provide props to some components. I would like to allow props spreading on all components but only when it comes from this method. A code sample can be:
const myMethod = () => ({ onClick: console.log(1), role: "button", tabIndex: 0 });
const MyComponent = () => (
<div
{...myMethod()}
className="fake-button"
>
Hello
</div>
)
The method is always the same and we control its output so it is safe for us to use it anywhere but the issue currently is that the rule would allow using props spreading from anything.
TL;DR: I would like to have another option in the jsx-props-no-spreading
rule to ignore props spreading when it comes from a specific method.
Could it be possible to add this exception to the rule?
I looked at the rule code and it is fairly understandable so I can create a pull request if this is acceptable.
Thank you