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

eslint-plugin-react-hooks feature request: enforce naming convention for useState() #16908

Closed
mbrowne opened this issue Sep 26, 2019 · 5 comments
Labels
Resolution: Stale Automatically closed due to inactivity

Comments

@mbrowne
Copy link

mbrowne commented Sep 26, 2019

Do you want to request a feature or report a bug?
Feature

What is the current behavior?

There is currently no rule to enforce the standard naming convention for useState.

What is the expected behavior?

It would be great to have a rule to enforce the standard naming convention for useState():

const [x, setX] = useState(...)

For example, the rule would consider this an error:

const [x, setFoo] = useState(...)

This would ensure that all useState variables followed the same convention, i.e. ${varName} and set${upperFirstVarName}.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

All versions with hooks

Note

I originally submitted a feature request for eslint-plugin-react: jsx-eslint/eslint-plugin-react#2417. It was suggested that I make the feature request here instead. I'm not sure which plugin would be the more appropriate place for this.

@stale
Copy link

stale bot commented Jan 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Jan 9, 2020
@stale
Copy link

stale bot commented Jan 16, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

@stale stale bot closed this as completed Jan 16, 2020
@karlhorky
Copy link
Contributor

@mbrowne would you be open to creating a new issue for this? It would be nice for beginners to learn!

@mbrowne
Copy link
Author

mbrowne commented Sep 22, 2020

Sure:
#19883

@karlhorky
Copy link
Contributor

Thanks, will watch there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Stale Automatically closed due to inactivity
Projects
None yet
Development

No branches or pull requests

2 participants