Rules
context-name
Full Name in eslint-plugin-react-naming-convention
react-naming-convention/context-name
Full Name in @eslint-react/eslint-plugin
@eslint-react/naming-convention/context-name
Presets
recommended
recommended-typescript
recommended-type-checked
Description
Enforces context name to be a valid component name with the suffix Context
.
In React 19, you can render <Context>
as a provider instead of <Context.Provider>
. This rule enforces that the context has a valid component name with the suffix Context
.
Examples
Failing
const theme = createContext("");
const Theme = createContext("");
const themecontext = createContext("");
const themeContext = createContext("");
Passing
const ThemeContext = createContext("");
Implementation
See Also
component-name
Enforces naming conventions for components.