You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[boolean-prop-naming](docs/rules/boolean-prop-naming.md)| Enforces consistent naming for boolean props ||||||
295
295
|[button-has-type](docs/rules/button-has-type.md)| Disallow usage of `button` elements without an explicit `type` attribute ||||||
296
-
|[context-display-name](docs/rules/context-display-name.md)| Disallow missing displayName in a React context definition ||||||
297
296
|[default-props-match-prop-types](docs/rules/default-props-match-prop-types.md)| Enforce all defaultProps have a corresponding non-required PropType ||||||
298
297
|[destructuring-assignment](docs/rules/destructuring-assignment.md)| Enforce consistent usage of destructuring assignment of props, state, and context ||| 🔧 |||
299
298
|[display-name](docs/rules/display-name.md)| Disallow missing displayName in a React component definition | ☑️ |||||
`displayName` allows you to [name your context](https://reactjs.org/docs/context.html#contextdisplayname) object. This name is used in the React dev tools for the context's `Provider` and `Consumer`.
134
+
When `true` this rule will warn on context objects without a `displayName`.
135
+
136
+
## Rule Details
137
+
138
+
Examples of **incorrect** code for this rule:
139
+
140
+
```jsx
141
+
constHello=React.createContext();
142
+
```
143
+
144
+
Examples of **correct** code for this rule:
145
+
146
+
```jsx
147
+
constHello=React.createContext();
148
+
Hello.displayName="HelloContext";
149
+
```
150
+
151
+
131
152
## About component detection
132
153
133
154
For this rule to work we need to detect React components, this could be very hard since components could be declared in a lot of ways.
0 commit comments