Skip to content

React Review Audit #2

@reactreview

Description

@reactreview
⚠️ 110 warnings 86 score
Copy as prompt
Fix the following React Review diagnostics in my codebase.

## Warnings (110)

1. [warning] label-has-associated-control — src/components/GlobalVarForm.tsx:50
   A form label must be associated with a control — use `htmlFor` or nest the input.

2. [warning] control-has-associated-label — src/components/GlobalVarForm.tsx:51
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

3. [warning] label-has-associated-control — src/components/GlobalVarForm.tsx:60
   A form label must be associated with a control — use `htmlFor` or nest the input.

4. [warning] control-has-associated-label — src/components/GlobalVarForm.tsx:61
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

5. [warning] button-has-type — src/components/GlobalVarForm.tsx:79
   `<button>` elements must have an explicit `type` attribute.

6. [warning] button-has-type — src/components/GlobalVarForm.tsx:82
   `<button>` elements must have an explicit `type` attribute.

7. [warning] button-has-type — src/components/GlobalVarForm.tsx:85
   `<button>` elements must have an explicit `type` attribute.

8. [warning] js-tosorted-immutable — src/utils/fuzzy.ts:41
   [...array].sort() — use array.toSorted() for immutable sorting (ES2023)

9. [warning] js-set-map-lookups — src/utils/fuzzy.ts:52
   array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups

10. [warning] prefer-useReducer — src/components/ScriptRunner.tsx:34
   Component "ScriptRunner" has 8 useState calls — consider useReducer for related state

11. [warning] button-has-type — src/components/ScriptRunner.tsx:111
   `<button>` elements must have an explicit `type` attribute.

12. [warning] button-has-type — src/components/ScriptRunner.tsx:116
   `<button>` elements must have an explicit `type` attribute.

13. [warning] button-has-type — src/components/ScriptRunner.tsx:126
   `<button>` elements must have an explicit `type` attribute.

14. [warning] button-has-type — src/components/ScriptRunner.tsx:136
   `<button>` elements must have an explicit `type` attribute.

15. [warning] no-array-index-key — src/components/ScriptRunner.tsx:144
   Array index in `key` doesn't uniquely identify the element — re-renders may use stale state.

16. [warning] no-array-index-as-key — src/components/ScriptRunner.tsx:144
   Array index "i" used as key — causes bugs when list is reordered or filtered

17. [warning] control-has-associated-label — src/components/ScriptRunner.tsx:146
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

18. [warning] button-has-type — src/components/ScriptRunner.tsx:152
   `<button>` elements must have an explicit `type` attribute.

19. [warning] button-has-type — src/components/ScriptRunner.tsx:176
   `<button>` elements must have an explicit `type` attribute.

20. [warning] button-has-type — src/components/ScriptRunner.tsx:186
   `<button>` elements must have an explicit `type` attribute.

21. [warning] button-has-type — src/components/ScriptRunner.tsx:197
   `<button>` elements must have an explicit `type` attribute.

22. [warning] button-has-type — src/components/ScriptRunner.tsx:203
   `<button>` elements must have an explicit `type` attribute.

23. [warning] button-has-type — src/components/ScriptRunner.tsx:210
   `<button>` elements must have an explicit `type` attribute.

24. [warning] no-array-index-key — src/components/ScriptRunner.tsx:211
   Array index in `key` doesn't uniquely identify the element — re-renders may use stale state.

25. [warning] no-array-index-as-key — src/components/ScriptRunner.tsx:211
   Array index "i" used as key — causes bugs when list is reordered or filtered

26. [warning] no-giant-component — src/components/SettingsView.tsx:11
   Component "SettingsView" is 314 lines — consider breaking it into smaller focused components

27. [warning] prefer-useReducer — src/components/SettingsView.tsx:11
   Component "SettingsView" has 9 useState calls — consider useReducer for related state

28. [warning] no-cascading-set-state — src/components/SettingsView.tsx:66
   4 setState calls in a single useEffect — consider using useReducer or deriving state

29. [warning] exhaustive-deps — src/components/SettingsView.tsx:89
   The ref value `saveTimer.current` will likely have changed by the time this effect cleanup function runs. Copy it to a variable inside the hook callback and use that variable in cleanup.

30. [warning] control-has-associated-label — src/components/SettingsView.tsx:176
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

31. [warning] button-has-type — src/components/SettingsView.tsx:176
   `<button>` elements must have an explicit `type` attribute.

32. [warning] button-has-type — src/components/SettingsView.tsx:198
   `<button>` elements must have an explicit `type` attribute.

33. [warning] control-has-associated-label — src/components/SettingsView.tsx:201
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

34. [warning] button-has-type — src/components/SettingsView.tsx:210
   `<button>` elements must have an explicit `type` attribute.

35. [warning] control-has-associated-label — src/components/SettingsView.tsx:213
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

36. [warning] control-has-associated-label — src/components/SettingsView.tsx:235
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

37. [warning] button-has-type — src/components/SettingsView.tsx:264
   `<button>` elements must have an explicit `type` attribute.

38. [warning] button-has-type — src/components/SettingsView.tsx:286
   `<button>` elements must have an explicit `type` attribute.

39. [warning] button-has-type — src/components/SettingsView.tsx:307
   `<button>` elements must have an explicit `type` attribute.

40. [warning] button-has-type — src/components/SettingsView.tsx:344
   `<button>` elements must have an explicit `type` attribute.

41. [warning] button-has-type — src/components/SettingsView.tsx:351
   `<button>` elements must have an explicit `type` attribute.

42. [warning] button-has-type — src/components/Sidebar.tsx:78
   `<button>` elements must have an explicit `type` attribute.

43. [warning] button-has-type — src/components/Sidebar.tsx:89
   `<button>` elements must have an explicit `type` attribute.

44. [warning] button-has-type — src/components/Sidebar.tsx:98
   `<button>` elements must have an explicit `type` attribute.

45. [warning] button-has-type — src/components/Sidebar.tsx:107
   `<button>` elements must have an explicit `type` attribute.

46. [warning] button-has-type — src/components/Sidebar.tsx:115
   `<button>` elements must have an explicit `type` attribute.

47. [warning] button-has-type — src/components/Sidebar.tsx:123
   `<button>` elements must have an explicit `type` attribute.

48. [warning] button-has-type — src/components/Sidebar.tsx:131
   `<button>` elements must have an explicit `type` attribute.

49. [warning] click-events-have-key-events — src/components/Sidebar.tsx:142
   Visible non-interactive elements with click handlers must have a corresponding keyboard listener (`onKeyUp`, `onKeyDown`, or `onKeyPress`).

50. [warning] no-static-element-interactions — src/components/Sidebar.tsx:142
   Static HTML elements with event handlers require a role — add `role="…"` or use a semantic HTML element instead.

51. [warning] click-events-have-key-events — src/components/Sidebar.tsx:156
   Visible non-interactive elements with click handlers must have a corresponding keyboard listener (`onKeyUp`, `onKeyDown`, or `onKeyPress`).

52. [warning] no-static-element-interactions — src/components/Sidebar.tsx:156
   Static HTML elements with event handlers require a role — add `role="…"` or use a semantic HTML element instead.

53. [warning] button-has-type — src/components/Sidebar.tsx:161
   `<button>` elements must have an explicit `type` attribute.

54. [warning] button-has-type — src/components/Sidebar.tsx:165
   `<button>` elements must have an explicit `type` attribute.

55. [warning] button-has-type — src/components/Sidebar.tsx:169
   `<button>` elements must have an explicit `type` attribute.

56. [warning] js-flatmap-filter — src/index.tsx:98
   .map().filter(Boolean) iterates twice — use .flatMap() to transform and filter in a single pass

57. [warning] button-has-type — src/index.tsx:133
   `<button>` elements must have an explicit `type` attribute.

58. [warning] control-has-associated-label — src/index.tsx:157
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

59. [warning] button-has-type — src/index.tsx:165
   `<button>` elements must have an explicit `type` attribute.

60. [warning] button-has-type — src/index.tsx:242
   `<button>` elements must have an explicit `type` attribute.

61. [warning] button-has-type — src/index.tsx:292
   `<button>` elements must have an explicit `type` attribute.

62. [warning] button-has-type — src/index.tsx:298
   `<button>` elements must have an explicit `type` attribute.

63. [warning] button-has-type — src/index.tsx:301
   `<button>` elements must have an explicit `type` attribute.

64. [warning] button-has-type — src/index.tsx:348
   `<button>` elements must have an explicit `type` attribute.

65. [warning] button-has-type — src/index.tsx:379
   `<button>` elements must have an explicit `type` attribute.

66. [warning] button-has-type — src/index.tsx:385
   `<button>` elements must have an explicit `type` attribute.

67. [warning] button-has-type — src/index.tsx:388
   `<button>` elements must have an explicit `type` attribute.

68. [warning] prefer-useReducer — src/components/PackagesView.tsx:10
   Component "PackagesView" has 5 useState calls — consider useReducer for related state

69. [warning] no-derived-state — src/components/PackagesView.tsx:30
   Avoid storing derived state. "packages" is only set here, and thus could be computed directly during render.

70. [warning] design-no-three-period-ellipsis — src/components/PackagesView.tsx:73
   Three-period ellipsis ("...") in JSX text — use the actual ellipsis character "…" (or `&hellip;`)

71. [warning] control-has-associated-label — src/components/PackagesView.tsx:85
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

72. [warning] button-has-type — src/components/PackagesView.tsx:93
   `<button>` elements must have an explicit `type` attribute.

73. [warning] click-events-have-key-events — src/components/PackagesView.tsx:107
   Visible non-interactive elements with click handlers must have a corresponding keyboard listener (`onKeyUp`, `onKeyDown`, or `onKeyPress`).

74. [warning] no-static-element-interactions — src/components/PackagesView.tsx:107
   Static HTML elements with event handlers require a role — add `role="…"` or use a semantic HTML element instead.

75. [warning] button-has-type — src/components/PackagesView.tsx:128
   `<button>` elements must have an explicit `type` attribute.

76. [warning] button-has-type — src/components/PackagesView.tsx:133
   `<button>` elements must have an explicit `type` attribute.

77. [warning] no-derived-state — src/components/PackagesView.tsx:167
   Avoid storing derived state. Compute "installed" directly during render, optionally with `useMemo` if it's expensive.

78. [warning] design-no-three-period-ellipsis — src/components/PackagesView.tsx:189
   Three-period ellipsis ("...") in JSX text — use the actual ellipsis character "…" (or `&hellip;`)

79. [warning] button-has-type — src/components/PackagesView.tsx:196
   `<button>` elements must have an explicit `type` attribute.

80. [warning] button-has-type — src/components/PackagesView.tsx:205
   `<button>` elements must have an explicit `type` attribute.

81. [warning] button-has-type — src/components/PackagesView.tsx:210
   `<button>` elements must have an explicit `type` attribute.

82. [warning] no-array-index-key — src/components/PackagesView.tsx:227
   Array index in `key` doesn't uniquely identify the element — re-renders may use stale state.

83. [warning] no-array-index-as-key — src/components/PackagesView.tsx:227
   Array index "i" used as key — causes bugs when list is reordered or filtered

84. [warning] prefer-useReducer — src/components/TriggerForm.tsx:15
   Component "TriggerForm" has 7 useState calls — consider useReducer for related state

85. [warning] button-has-type — src/components/TriggerForm.tsx:85
   `<button>` elements must have an explicit `type` attribute.

86. [warning] label-has-associated-control — src/components/TriggerForm.tsx:91
   A form label must be associated with a control — use `htmlFor` or nest the input.

87. [warning] control-has-associated-label — src/components/TriggerForm.tsx:92
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

88. [warning] label-has-associated-control — src/components/TriggerForm.tsx:101
   A form label must be associated with a control — use `htmlFor` or nest the input.

89. [warning] control-has-associated-label — src/components/TriggerForm.tsx:103
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

90. [warning] button-has-type — src/components/TriggerForm.tsx:121
   `<button>` elements must have an explicit `type` attribute.

91. [warning] label-has-associated-control — src/components/TriggerForm.tsx:137
   A form label must be associated with a control — use `htmlFor` or nest the input.

92. [warning] control-has-associated-label — src/components/TriggerForm.tsx:138
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

93. [warning] control-has-associated-label — src/components/TriggerForm.tsx:150
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

94. [warning] button-has-type — src/components/TriggerForm.tsx:164
   `<button>` elements must have an explicit `type` attribute.

95. [warning] button-has-type — src/components/TriggerForm.tsx:167
   `<button>` elements must have an explicit `type` attribute.

96. [warning] js-set-map-lookups — src/components/CodeEditor.tsx:93
   array.indexOf() in a loop is O(n) per call — convert to a Set for O(1) lookups

97. [warning] no-danger — src/components/CodeEditor.tsx:296
   Do not use `dangerouslySetInnerHTML` — it injects raw HTML and is a common XSS vector.

98. [warning] control-has-associated-label — src/components/CodeEditor.tsx:298
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

99. [warning] button-has-type — src/components/ScriptLangView.tsx:174
   `<button>` elements must have an explicit `type` attribute.

100. [warning] no-array-index-as-key — src/components/ScriptLangView.tsx:179
   Array index "i" used as key — causes bugs when list is reordered or filtered

101. [warning] no-array-index-key — src/components/ScriptLangView.tsx:181
   Array index in `key` doesn't uniquely identify the element — re-renders may use stale state.

102. [warning] no-initialize-state — src/components/ScriptLangView.tsx:221
   Avoid initializing state in an effect. Instead, initialize "activeSection"'s `useState()` with "undefined". For SSR hydration, prefer `useSyncExternalStore()`.

103. [warning] control-has-associated-label — src/components/ScriptLangView.tsx:252
   A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`.

104. [warning] button-has-type — src/components/ScriptLangView.tsx:260
   `<button>` elements must have an explicit `type` attribute.

105. [warning] button-has-type — src/components/ScriptLangView.tsx:267
   `<button>` elements must have an explicit `type` attribute.

106. [warning] no-array-index-key — src/components/ScriptLangView.tsx:300
   Array index in `key` doesn't uniquely identify the element — re-renders may use stale state.

107. [warning] no-array-index-as-key — src/components/ScriptLangView.tsx:300
   Array index "i" used as key — causes bugs when list is reordered or filtered

108. [warning] unused-dependency — package.json:0
   Unused dependency: `@codemirror/basic-setup`

109. [warning] unused-dependency — package.json:0
   Unused dependency: `@codemirror/lang-javascript`

110. [warning] unused-dependency — package.json:0
   Unused dependency: `@codemirror/theme-one-dark`

⚠️ Warnings (110)

`<button>` elements must have an explicit `type` attribute. · 54 in 8 files

button-has-type

Set type="button" (or "submit" / "reset") explicitly on every &lt;button&gt;.

File Lines
src/components/ScriptRunner.tsx 111, 116, 126, 136, 152, 176, 186, 197, +2 more
src/components/Sidebar.tsx 78, 89, 98, 107, 115, 123, 131, 161, +2 more
src/index.tsx 133, 165, 242, 292, 298, 301, 348, 379, +2 more
src/components/SettingsView.tsx 176, 198, 210, 264, 286, 307, 344, 351
src/components/PackagesView.tsx 93, 128, 133, 196, 205, 210
…and 3 more files view on react.review
A control must be associated with a text label — add visible text, `aria-label`, or `aria-labelledby`. · 15 in 8 files

control-has-associated-label

Every interactive control must have an accessible label.

File Lines
src/components/SettingsView.tsx 176, 201, 213, 235
src/components/TriggerForm.tsx 92, 103, 138, 150
src/components/GlobalVarForm.tsx 51, 61
src/components/ScriptRunner.tsx 146
src/index.tsx 157
…and 3 more files view on react.review
A form label must be associated with a control — use `htmlFor` or nest the input. · 5 in 2 files

label-has-associated-control

Associate every label with a control via htmlFor or by nesting the input.

File Lines
src/components/TriggerForm.tsx 91, 101, 137
src/components/GlobalVarForm.tsx 50, 60
Array index in `key` doesn't uniquely identify the element — re-renders may use stale state. · 5 in 3 files

no-array-index-key

Use a stable, data-derived key instead of the array index.

File Lines
src/components/ScriptRunner.tsx 144, 211
src/components/ScriptLangView.tsx 181, 300
src/components/PackagesView.tsx 227
Array index "i" used as key — causes bugs when list is reordered or filtered · 5 in 3 files

no-array-index-as-key

Use a stable unique identifier: key={item.id} or key={item.slug} — index keys break on reorder/filter

File Lines
src/components/ScriptRunner.tsx 144, 211
src/components/ScriptLangView.tsx 179, 300
src/components/PackagesView.tsx 227
Component "ScriptRunner" has 8 useState calls — consider useReducer for related state · 4 in 4 files

prefer-useReducer

Group related state: const [state, dispatch] = useReducer(reducer, { field1, field2, ... })

File Lines
src/components/ScriptRunner.tsx 34
src/components/SettingsView.tsx 11
src/components/PackagesView.tsx 10
src/components/TriggerForm.tsx 15
Visible non-interactive elements with click handlers must have a corresponding keyboard listener (`onKeyUp`, `onKeyDown`, or `onKeyPress`). · 3 in 2 files

click-events-have-key-events

Pair onClick with onKeyUp / onKeyDown / onKeyPress for keyboard users.

File Lines
src/components/Sidebar.tsx 142, 156
src/components/PackagesView.tsx 107
Static HTML elements with event handlers require a role — add `role="…"` or use a semantic HTML element instead. · 3 in 2 files

no-static-element-interactions

Static HTML elements with event handlers require a role, or use a semantic HTML element instead.

File Lines
src/components/Sidebar.tsx 142, 156
src/components/PackagesView.tsx 107
Unused dependency: `@codemirror/basic-setup` · 3 in 1 file

unused-dependency

Remove the dependency from package.json if it is genuinely unused.

File Lines
package.json 0, 0, 0
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups · 2 in 2 files

js-set-map-lookups

Use a Set or Map for repeated membership tests / keyed lookups — Array.includes/find is O(n) per call

File Lines
src/utils/fuzzy.ts 52
src/components/CodeEditor.tsx 93
Avoid storing derived state. "packages" is only set here, and thus could be computed directly during render. · 2 in 1 file

no-derived-state

Compute derived state inline during render (or with useMemo if expensive) instead of mirroring it into useState via a useEffect. See https://react.dev/learn/you-might-not-need-an-effect#updating-state-based-on-props-or-state

File Lines
src/components/PackagesView.tsx 30, 167
Three-period ellipsis ("...") in JSX text — use the actual ellipsis character "…" (or `…`) · 2 in 1 file

design-no-three-period-ellipsis

Use the typographic ellipsis "…" (or &hellip;) instead of three periods — pairs with action-with-followup labels ("Rename…", "Loading…")

File Lines
src/components/PackagesView.tsx 73, 189
[...array].sort() — use array.toSorted() for immutable sorting (ES2023) · 1 in 1 file

js-tosorted-immutable

Use array.toSorted() (ES2023) instead of [...array].sort() for immutable sorting without the spread allocation

File Lines
src/utils/fuzzy.ts 41
Component "SettingsView" is 314 lines — consider breaking it into smaller focused components · 1 in 1 file

no-giant-component

Extract logical sections into focused components: &lt;UserHeader /&gt;, &lt;UserActions /&gt;, etc.

File Lines
src/components/SettingsView.tsx 11
4 setState calls in a single useEffect — consider using useReducer or deriving state · 1 in 1 file

no-cascading-set-state

Combine into useReducer: const [state, dispatch] = useReducer(reducer, initialState)

File Lines
src/components/SettingsView.tsx 66
The ref value `saveTimer.current` will likely have changed by the time this effect cleanup function runs. Copy it to a variable inside the hook callback and use that variable in cleanup. · 1 in 1 file

exhaustive-deps

List every value the hook callback captures in its dependency array.

File Lines
src/components/SettingsView.tsx 89
.map().filter(Boolean) iterates twice — use .flatMap() to transform and filter in a single pass · 1 in 1 file

js-flatmap-filter

Use .flatMap(item =&gt; condition ? [value] : []) — transforms and filters in a single pass instead of creating an intermediate array

File Lines
src/index.tsx 98
Do not use `dangerouslySetInnerHTML` — it injects raw HTML and is a common XSS vector. · 1 in 1 file

no-danger

Render trusted content as React children rather than injecting raw HTML.

File Lines
src/components/CodeEditor.tsx 296
Avoid initializing state in an effect. Instead, initialize "activeSection"'s `useState()` with "undefined". For SSR hydration, prefer `useSyncExternalStore()`. · 1 in 1 file

no-initialize-state

Pass the initial value directly to useState() instead of setting it from a mount-only useEffect. For SSR hydration, prefer useSyncExternalStore().

File Lines
src/components/ScriptLangView.tsx 221

Reviewed by reactreview for commit a2de2f8. Configure here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions