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
forbid-component-props should have a component whitelist #1732
Comments
Makes sense. Maybe we could change the schema (preserving back compat) so that "forbid" can be an array of strings and/or objects following this schema:
|
so |
"custom" and "html" would be only allowing an enum of "forbid", "allow", or "ignore", and would apply to all custom and all HTML components, respectively. Although yeah, maybe we only need "forbid" or "allow" here. |
So, deprecate {
propName: string,
component: forbid|allow,
dom: forbid|allow,
override: {somehtmltag: allow, SomeComponent: allow, ...}
} |
no, i still think the rule name should be I like your suggested schema - "overrides" with an object, same forbid/allow enum. |
what would the |
ah, good point :-) in that case, we'd just need |
|
PR: #1735 |
I am glad this is change was made. What would be the best way to whitelist all components from a package? For example |
then you’d need a list of hundreds of component names in your config |
This seems to be working:
|
For custom components it makes sense to have the rule, but when using third-party components violating the rule (
ReactModal
usingclassName
is probably one of the more prominent examples) there isn't much you can do about it...Having to add
eslint-disable react/forbid-component-props
comments isn't a very pretty solution.The text was updated successfully, but these errors were encountered: