Rules
no-use-context
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Features
🔄
Presets
xrecommendedrecommended-typescriptrecommended-type-checked
Description
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.
Examples
Before
After
Implementation
Further Reading
See Also
no-context-provider
Replaces usages of<Context.Provider>with<Context>.no-forward-ref
Replace usages offorwardRefwith passingrefas a prop.