@samitouri / QOS-React / commits / 4e00747378

[DevTools] Don't pluralize if already plural (#34870)

In a demo today, `cookies()` showed up as `cookieses`. While adorable, is wrong.

Sebastian Markbåge committed Oct 16, 2025 at 10:50 UTC 4e0074737826a1296eb028c53ce4f6b6db8d09ba
1 file changed +21
packages/react-devtools-shared/src/devtools/views/utils.js
+21
@@ -205,6 +205,27 @@ export function pluralize(word: string): string {
205 return word;
206 }
207
208 + // Bail out if it's already plural.
209 + switch (word) {
210 + case 'men':
211 + case 'women':
212 + case 'children':
213 + case 'feet':
214 + case 'teeth':
215 + case 'mice':
216 + case 'people':
217 + return word;
218 + }
219 +
220 + if (
221 + /(ches|shes|ses|xes|zes)$/i.test(word) ||
222 + /[^s]ies$/i.test(word) ||
223 + /ves$/i.test(word) ||
224 + /[^s]s$/i.test(word)
225 + ) {
226 + return word;
227 + }
228 +
229 switch (word) {
230 case 'man':
231 return 'men';