Rules
no-use-context
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Features
🔍 🔄
Presets
corerecommendedrecommended-typescriptrecommended-type-checked
What it does
Replaces usages of useContext with use.
In React 19, use is preferred over useContext because it is more flexible.
In addition, it is recommended to enable the naming-convention/context-name rule to enforce consistent naming conventions for contexts.
An unsafe codemod is available for this rule.
Examples
Failing
Passing
Implementation
Further Reading
See Also
no-context-provider
Replaces usages of<Context.Provider>with<Context>.no-forward-ref
Replace usages offorwardRefwith passingrefas a prop.