chore(lint): turn on the rules that would have caught the dead code (#7037)

Three rules were off, so nothing enforced them. Measured, fixed the sites, and
enabled them where the cost is bounded.

`noAccumulatingSpread` — 2 violations, both real O(n²) reducers, both now
`Object.fromEntries`. One duplicates a block's subBlocks on every block
duplication; the other rebuilds a Record from every workspace env var. Enabled
repo-wide.

`noUnusedVariables` / `noUnusedFunctionParameters` — 633 repo-wide, but only 6
under `packages/`. Fixed those 6 and enabled both at error for `packages/**` via
an override, which permanently covers 979 files. `apps/sim`'s remaining 627 are
left deliberately: that is a sweep of its own, and a rule enabled with 627
outstanding warnings teaches people to ignore it.

This is the class of rule whose absence let the dead code in #7019 accumulate —
eleven unread loggers, a whole unimported file, write-only locals — none of which
any gate could see.

Two of the six were in `workflow-renderer`, where the fix is narrower than it
looks. `isWorkflowRunning` is destructured-but-unread in both the block and
subflow views, and the app passes it from `workflow-block.tsx` and
`subflow-node.tsx`. Its TSDoc claimed it "holds every block's action swell open";
nothing reads it, so that behavior does not exist. Removing the prop breaks the
callers and implementing it is a UX decision — there is adjacent logic
deliberately not pinning the toolbar during a handoff. So only the unused binding
goes, and the TSDoc now says what is true.

Not enabled: `noDocumentCookie` (3 sites, and its fix is the CookieStore API,
which is a browser-support call) and `useExhaustiveDependencies` (384 errors).
This commit is contained in:
Waleed
2026-08-24 11:10:19 -07:00
committed by GitHub
parent edf07ec3cd
commit cae80c5f20
8 changed files with 42 additions and 21 deletions
@@ -795,9 +795,9 @@ export function SecretsManager() {
}
}
const validVariables = envVars
.filter((v) => v.key && v.value)
.reduce<Record<string, string>>((acc, { key, value }) => ({ ...acc, [key]: value }), {})
const validVariables = Object.fromEntries(
envVars.filter((v) => v.key && v.value).map(({ key, value }) => [key, value])
)
const before = initialWorkspaceVarsRef.current
const after = mergedWorkspaceVars
+5 -9
View File
@@ -580,15 +580,11 @@ export const useWorkflowStore = create<WorkflowStore>()(
const activeWorkflowId = get().currentWorkflowId
const mergedBlock = mergeSubblockState(get().blocks, activeWorkflowId || undefined, id)[id]
const newSubBlocks = Object.entries(mergedBlock.subBlocks).reduce(
(acc, [subId, subBlock]) => ({
...acc,
[subId]: {
...subBlock,
value: structuredClone(subBlock.value),
},
}),
{}
const newSubBlocks = Object.fromEntries(
Object.entries(mergedBlock.subBlocks).map(([subId, subBlock]) => [
subId,
{ ...subBlock, value: structuredClone(subBlock.value) },
])
)
// Remap condition/router IDs in the duplicated subBlocks
+14 -1
View File
@@ -134,12 +134,25 @@
"noStaticOnlyClass": "off"
},
"performance": {
"noAccumulatingSpread": "off",
"noAccumulatingSpread": "error",
"noDelete": "error",
"noImgElement": "off"
}
}
},
"overrides": [
{
"includes": ["packages/**"],
"linter": {
"rules": {
"correctness": {
"noUnusedFunctionParameters": "error",
"noUnusedVariables": "error"
}
}
}
}
],
"javascript": {
"formatter": {
"jsxQuoteStyle": "single",
+1 -1
View File
@@ -40,7 +40,7 @@ export function createMockSocket(): IMockSocket {
disconnected: false,
// Core methods
emit: vi.fn((event: string, ..._args: any[]) => {
emit: vi.fn((_event: string, ..._args: any[]) => {
return socket
}),
+1 -1
View File
@@ -471,7 +471,7 @@ export class SimStudioClient {
try {
const status = await this.getWorkflowStatus(workflowId)
return status.isDeployed
} catch (error) {
} catch {
return false
}
}
@@ -78,7 +78,7 @@ export function generateLoopBlocks(blocks: Record<string, BlockState>): Record<s
Object.entries(blocks)
.filter(([_, block]) => block.type === 'loop')
.forEach(([id, block]) => {
.forEach(([id]) => {
const loop = convertLoopBlockToLoop(id, blocks)
if (loop) {
loops[id] = loop
@@ -95,7 +95,7 @@ export function generateParallelBlocks(
Object.entries(blocks)
.filter(([_, block]) => block.type === 'parallel')
.forEach(([id, block]) => {
.forEach(([id]) => {
const parallel = convertParallelBlockToParallel(id, blocks)
if (parallel) {
parallels[id] = parallel
@@ -65,7 +65,14 @@ export interface SubflowNodeViewProps {
isFocused: boolean
/** Whether execution controls are active for this subflow. */
isRunning?: boolean
/** Whether the parent workflow is executing. Holds every subflow action swell open. */
/**
* Whether the parent workflow is executing.
*
* Accepted and currently unread: `subflow-node.tsx` supplies it and nothing
* below consults it, so the hold-open behavior this once claimed is not
* implemented. Kept in the interface because the caller passes it — wire it up
* or stop passing it, but do not read this as working today.
*/
isWorkflowRunning?: boolean
/** Whether this subflow participates in the current execution handoff. */
isExecutionHighlighted?: boolean
@@ -326,7 +333,6 @@ export function SubflowNodeView({
isLocked,
isFocused,
isRunning = false,
isWorkflowRunning = false,
isExecutionHighlighted = false,
diffStatus,
nestingLevel,
@@ -393,7 +393,14 @@ export interface WorkflowBlockViewProps {
runPathStatus?: BlockRunStatus
/** Whether execution controls are active for this block. */
isRunning?: boolean
/** Whether the parent workflow is executing. Holds every block's action swell open. */
/**
* Whether the parent workflow is executing.
*
* Accepted and currently unread: `workflow-block.tsx` supplies it and nothing
* below consults it, so the hold-open behavior this once claimed is not
* implemented. Kept in the interface because the caller passes it — wire it up
* or stop passing it, but do not read this as working today.
*/
isWorkflowRunning?: boolean
/** Whether this block participates in the current execution handoff. */
isExecutionHighlighted?: boolean
@@ -521,7 +528,6 @@ export function WorkflowBlockView({
ringStyles,
runPathStatus,
isRunning = false,
isWorkflowRunning = false,
isExecutionHighlighted = false,
Icon,
iconBgColor,