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

Rule proposal: enforce selector result name #98

Open
EvgenyOrekhov opened this issue Jan 9, 2024 · 0 comments
Open

Rule proposal: enforce selector result name #98

EvgenyOrekhov opened this issue Jan 9, 2024 · 0 comments

Comments

@EvgenyOrekhov
Copy link

Enforce const <name> = useSelector(select<Name>) naming convention.

It will make it easier to see which values and selector functions are related, and it will make it easier to grep code.

Examples of incorrect code:

const foo = useSelector(selectBar); // Should warn to use `const bar`
const posts = useSelector(selectUserPosts); // Should warn to use `const userPosts`

Examples of correct code:

const bar = useSelector(selectBar);
const userPosts = useSelector(selectUserPosts);
const { foo } = useSelector(selectBar); // Destructuring is not checked
const foo = useSelector((state) => state.bar); // Inline functions are not checked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant