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

New Rule: component-method-names #10

Closed
Tracked by #8
adidahiya opened this issue Jun 16, 2016 · 2 comments
Closed
Tracked by #8

New Rule: component-method-names #10

adidahiya opened this issue Jun 16, 2016 · 2 comments

Comments

@adidahiya
Copy link
Contributor

(Seeking better rule name suggestions)

I want to enforce a certain naming pattern for callbacks and event handlers:

  • methods in props interfaces should use the on prefix -- this refers to code that binds handlers
  • methods on component classes should use the handle prefix -- these are the actual handlers that are bound by other methods
@adidahiya
Copy link
Contributor Author

adidahiya commented Aug 11, 2016

One more idea:

  • Methods that return JSX.Element or JSX.Element[] should be named using the render prefix. For example, renderMenuItems, not getMenuItems. This would require the type checker though, so maybe it should be another rule...

@adidahiya
Copy link
Contributor Author

Closing due to deprecation timeline #210

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