Rules
no-missing-context-display-name
Enforces that all contexts have a 'displayName' that can be used in DevTools.
Full Name in eslint-plugin-react-x
react-x/no-missing-context-display-nameFull Name in @eslint-react/eslint-plugin
@eslint-react/no-missing-context-display-nameFeatures
🔧
Presets
Rule Details
Context displayName property is used by React DevTools to identify the context in the component tree. Without it, debugging becomes difficult as contexts appear as "Context" or "Context.Provider" without any distinguishing information.
Common Violations
Invalid
import React from "react";
const MyContext = React.createContext();Valid
import React from "react";
const MyContext = React.createContext();
MyContext.displayName = "MyContext";Resources
Further Reading
See Also
react-x/no-missing-component-display-name
Enforces that all components have adisplayNamethat can be used in DevTools.