Skip to content

Commit a0bc93e

Browse files
chore: enable react-hooks/exhaustive-deps lint rule (#7955)
* chore: setting lint rule to error * fix: what is happening locally * chore: adding disable lines from script, removed duplicate lines * Update snapshots * fix: what is actually happening, I think my editor is caching this file aggressively * Update snapshots * fix: updating with latest main since my large PR merged in before this. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent ca1dac4 commit a0bc93e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+640
-1
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
],
112112
"no-warning-comments": ["error",{"terms":["Menu.setApplicationMenu(null)"]}],
113113
"semi": ["error", "never"],
114-
"react-hooks/exhaustive-deps": "off",
114+
"react-hooks/exhaustive-deps": "error",
115115
"suggest-no-throw/suggest-no-throw": "error"
116116
},
117117
"overrides": [

src/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export function App() {
150150
// Stop is more serious than Pause
151151
engineStreamActor.send({ type: EngineStreamTransition.Stop })
152152
}
153+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
153154
}, [])
154155

155156
// Show a custom toast to users if they haven't done the onboarding
@@ -179,6 +180,7 @@ export function App() {
179180
}
180181
)
181182
}
183+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
182184
}, [settings.app.onboardingStatus])
183185

184186
useEffect(() => {
@@ -214,6 +216,7 @@ export function App() {
214216
}
215217
)
216218
}
219+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
217220
}, [])
218221

219222
useEffect(() => {
@@ -233,6 +236,7 @@ export function App() {
233236
}
234237
)
235238
}
239+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
236240
}, [kclManager.wasmInitFailed])
237241

238242
// Only create the native file menus on desktop

src/Router.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ function CoreDump() {
173173
rustContext,
174174
token
175175
),
176+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
176177
[]
177178
)
178179
useHotkeyWrapper(['mod + shift + period'], () => {

src/Toolbar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export function Toolbar({
5858
kclManager.artifactGraph,
5959
context.selectionRanges
6060
)
61+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
6162
}, [kclManager.artifactGraph, context.selectionRanges])
6263

6364
const toolbarButtonsRef = useRef<HTMLUListElement>(null)
@@ -90,11 +91,13 @@ export function Toolbar({
9091
sketchPathId,
9192
editorHasFocus: editorManager.getEditorView()?.hasFocus,
9293
}),
94+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
9395
[
9496
state,
9597
send,
9698
commandBarActor.send,
9799
sketchPathId,
100+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
98101
editorManager.getEditorView()?.hasFocus,
99102
]
100103
)
@@ -189,6 +192,7 @@ export function Toolbar({
189192
status: maybeIconConfig.status,
190193
}
191194
}
195+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
192196
}, [currentMode, disableAllButtons, configCallbackProps])
193197

194198
// To remember the last selected item in an ActionButtonDropdown

src/clientSideScene/ClientSideSceneComp.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export const ClientSideScene = ({
129129
)
130130
sceneEntitiesManager.tearDownSketch({ removeAxis: true })
131131
}
132+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
132133
}, [])
133134

134135
let cursor = 'default'
@@ -498,6 +499,7 @@ const ConstraintSymbol = ({
498499

499500
const _node = useMemo(
500501
() => getNodeFromPath<Expr>(kclManager.ast, pathToNode),
502+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
501503
[kclManager.ast, pathToNode]
502504
)
503505
if (err(_node)) return
@@ -662,11 +664,13 @@ export const CamDebugSettings = () => {
662664

663665
useEffect(() => {
664666
sceneInfra.camControls.setReactCameraPropertiesCallback(setCamSettings)
667+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
665668
}, [sceneInfra])
666669
useEffect(() => {
667670
if (camSettings.type === 'perspective' && camSettings.fov) {
668671
setFov(camSettings.fov)
669672
}
673+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
670674
}, [(camSettings as any)?.fov])
671675

672676
return (

src/components/AstExplorer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ function DisplayObj({
113113
} else {
114114
setHasCursor(false)
115115
}
116+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
116117
}, [node.start, node.end, node.type])
117118

118119
return (

src/components/CamToggle.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const CamToggle = () => {
2222
sceneInfra.camControls.dollyZoom(fov).catch(reportRejection)
2323
}
2424
)
25+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
2526
}, [])
2627

2728
const toggleCamera = () => {

src/components/CameraProjectionToggle.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export function CameraProjectionToggle() {
1111

1212
useEffect(() => {
1313
setChecked(settings.modeling.cameraProjection.current === 'perspective')
14+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
1415
}, [settings.modeling.cameraProjection.current])
1516

1617
return (

src/components/CommandBar/CommandArgOptionInput.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function CommandArgOptionInput({
3333
typeof arg.options === 'function'
3434
? arg.options(commandBarState.context, actorContext)
3535
: arg.options,
36+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
3637
[argName, arg, commandBarState.context, actorContext]
3738
)
3839
// The initial current option is either an already-input value or the configured default
@@ -49,6 +50,7 @@ function CommandArgOptionInput({
4950
const [selectedOption, setSelectedOption] = useState<
5051
CommandArgumentOption<unknown>
5152
>(currentOption || resolvedOptions[0])
53+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
5254
const initialQuery = useMemo(() => '', [arg.options, argName])
5355
const [query, setQuery] = useState(initialQuery)
5456
const [filteredOptions, setFilteredOptions] =
@@ -61,13 +63,15 @@ function CommandArgOptionInput({
6163
keys: ['name', 'description'],
6264
threshold: 0.3,
6365
}),
66+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
6467
[argName, resolvedOptions]
6568
)
6669

6770
// Reset the query and selected option when the argName changes
6871
useEffect(() => {
6972
setQuery(initialQuery)
7073
setSelectedOption(currentOption || resolvedOptions[0])
74+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
7175
}, [argName])
7276

7377
// Auto focus and select the input when the component mounts

src/components/CommandBar/CommandBar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const CommandBar = () => {
3636
useEffect(() => {
3737
if (commandBarState.matches('Closed')) return
3838
commandBarActor.send({ type: 'Close' })
39+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
3940
}, [pathname])
4041

4142
/**
@@ -55,6 +56,7 @@ export const CommandBar = () => {
5556
commandBarActor.send({ type: 'Close' })
5657
toast.error('Exiting command flow because engine disconnected')
5758
}
59+
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: blanket-ignored fix me!
5860
}, [immediateState, commandBarActor])
5961

6062
// Hook up keyboard shortcuts

0 commit comments

Comments
 (0)