enforce lint rule hooks - poc #1342
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Description
Added ESLint React Hooks plugin to improve code quality and catch potential issues with React hooks usage. This PR configures the plugin with recommended settings and adds specific rules for exhaustive dependencies, setState in effects, refs, and immutability.
The PR also fixes numerous hook dependency issues throughout the codebase to comply with the new linting rules, including:
Additionally, added a new
lint:allscript and made the defaultlintcommand use the--quietflag to ignorewarn noise by default.Current State
There are still ~27 violations in
src/components/Home/RunSection/RunSection.tsx
src/components/shared/Dialogs/ComponentDuplicateDialog.tsx
src/components/shared/FullscreenElement/FullscreenElement.tsx
src/components/shared/ReactFlow/FlowCanvas/FlowCanvas.tsx
src/components/shared/ReactFlow/FlowCanvas/TaskNode/TaskOverview/logs.tsx
src/components/shared/ReactFlow/FlowSidebar/components/ComponentItem.tsx
src/hooks/useAutoSave.ts
src/hooks/useLoadPipelineRuns.ts
src/providers/BackendProvider.tsx
src/providers/ComponentLibraryProvider/ComponentLibraryProvider.tsx
src/providers/ComponentSpecProvider.tsx
src/providers/ExecutionDataProvider.tsx
src/providers/PipelineRunsProvider.tsx
Most popular violation is
react-hooks/set-state-in-effect e.g.One of the workarounds for this is using
queueMicrotask:But it would be better to rethink organization and useEffect usage. In most cases it should be possible to avoid using useEffect at all.
Other common violation is not using useQuery and using useEffect to trigger data fetch.
Most problematic is
src/components/shared/ReactFlow/FlowCanvas/FlowCanvas.tsx - fixing violations there causing infinite loops.In some cases fix may require more advanced changes to the code.
Type of Change
Checklist
Test Instructions
npm run lintto verify the code passes the new linting rulesAdditional Comments
The PR includes a commented-out autofix option for the exhaustive-deps rule that was intentionally left disabled as it may cause infinite loops in the current codebase. This could be useful for future mass-refactoring efforts.