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 option to require-default-props
to forbid default props for required props
#1524
Comments
require-default-props
to forbid default props for required props
Sound great to me - as long as it does a "safe" thing when it encounters things that aren't statically analyzeable, like imported shapes, spread props, etc. It'd also be super fancy if spread props worked when the object literal it referenced was defined in the same file. |
+1 on warning on spread prop violations when the referenced object literal in the same file Is the "safe" thing generally not warning on propTypes that aren't explicitly declared in the same file? |
Yes, exactly - basically, what's safe is not creating false positives. |
The
require-default-props
rule allows required props to also have a default prop. It would be nice to add an option to warn against this behavior.Option:
forbidDefaultForRequired
(boolean
) - Setting this totrue
will forbid required props from also having a default prop declaration. Defaultfalse
.The following patterns are considered warnings:
The following patterns are not considered warnings:
The text was updated successfully, but these errors were encountered: