logoESLint React
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

Features

🔍

Presets

  • recommended
  • recommended-typescript
  • recommended-type-checked

What it does

Enforces consistent naming conventions for context providers.

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

On this page