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

react/sort-comp event handlers #2116

Open
jeffvandyke opened this issue Oct 7, 2019 · 4 comments
Open

react/sort-comp event handlers #2116

jeffvandyke opened this issue Oct 7, 2019 · 4 comments

Comments

@jeffvandyke
Copy link
Contributor

@jeffvandyke jeffvandyke commented Oct 7, 2019

This might have been gone over before, but a common practice for event handlers (currently documented as /^on.+$/) is to start them with handle..., as in handleClick(). This is seen all over the React docs, including the home page, and it allows a clear convention for names of props (/^on.+$/) vs handlers defined on that instance (/^handle.+$/).

Since some people might allow usage of on as the method name of a handler, is there any opposition to add (/^handle.+$/) before the (/^on.+$/) entry for the react/sort-comp rule?

@jeffvandyke jeffvandyke changed the title react/sort-comp react/sort-comp event handlers Oct 7, 2019
@ljharb
Copy link
Collaborator

@ljharb ljharb commented Oct 7, 2019

This is something you could configure for yourself, so your question is about changing the default?

@jeffvandyke
Copy link
Contributor Author

@jeffvandyke jeffvandyke commented Oct 7, 2019

I think it's common enough of a practice (React docs) to make the default, but that's my opinion, and I'm curious if others concur.

@ljharb
Copy link
Collaborator

@ljharb ljharb commented Oct 7, 2019

The React docs recommend a number of antipatterns that this guide does not :-) but in this case it doesn't seem problematic to allow.

@jeffvandyke
Copy link
Contributor Author

@jeffvandyke jeffvandyke commented Oct 7, 2019

Awesome! I might have time to get that implemented... (and I agree on the other react doc recommendations, good to handle those instances on a case-by-case basis)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.