-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Experimental features? #1807
Comments
I think it'd be useful if it was configurable both ways - ie, i could use it to require OR forbid implementing them as static class properties. Also, don't forget |
Yes. I can implement And having one rule for each feels like it would be a bit tedious. |
How about |
Sounds good! So having "always" set for "react/component-static-property-style" forbids object property notation style and forces you to provide them as static class properties? |
not "always" because that isn't clear what it means. I'd expect it to take this schema:
|
@hornta Did you ever implement this rule in your ruleset? Although we would want to enforce the opposite :"forbid implementing them as static class properties." |
No I have not. You can give it a go :-) |
I have made a rule that enforces you to specify
propTypes
anddefaultProps
as static class properties. I don't know if I should make a PR for this since it depends on the experimental feature. We are planning on using it in our codebase, which is large. Would it be of interest here?INCORRECT
class MyComp extends Component {} MyComp.propTypes = {}; MyComp.defaultProps = {}
CORRECT
class MyComp extends Component { static propTypes = {}; static defaultProps = {}; }
The text was updated successfully, but these errors were encountered: