DianaSuvorova / eslint-plugin-react-redux

Enforcing best practices for react-redux

Home Page:https://www.npmjs.com/package/eslint-plugin-react-redux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rule proposal: enforce selector result name

EvgenyOrekhov opened this issue · comments

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