context-name
Enforces identifier names assigned from 'createContext' calls to be a valid component name with the suffix 'Context'.
Full Name in eslint-plugin-react-naming-convention
react-naming-convention/context-nameFull Name in @eslint-react/eslint-plugin
@eslint-react/naming-convention-context-namePresets
naming-convention
recommended
recommended-typescript
recommended-type-checked
strict
strict-typescript
strict-type-checked
Rule Details
Enforces that the context has a valid component name with the suffix Context.
Examples
// Problem: Identifier 'theme' does not have the 'Context' suffix
const theme = createContext("");// Problem: Identifier 'themeContext' is not PascalCase
const themeContext = createContext("");// Recommended: PascalCase with 'Context' suffix
const ThemeContext = createContext("");// Recommended: Name is exactly 'Context'
const Context = createContext("");// OK: PascalCase with 'Context' suffix (MemberExpression)
obj.nested.ThemeContext = createContext("");// OK: PascalCase with 'Context' suffix (class property)
class Foo { ThemeContext = createContext(""); }