Skip to content

lint: ESLint cleanup follow-up (test relaxation, setState bug, any/prefer-const) #2

@gbourne1

Description

@gbourne1

Context

Follow-up from the monorepo ESLint cleanup PR (jamdesk/jamdesk plan: `docs/plans/2026-05-08-eslint-warning-cleanup.md`). The plan included three tasks targeting this repo (Tasks 7, 10, 11), but execution happened in a worktree that doesn't include external project repos. Those three tasks are filed here to be done in this repo's own PR.

Tasks

Task 7 — Add test-file rule relaxation

Add a flat-config block to `eslint.config.mjs` disabling `@typescript-eslint/no-explicit-any` and `@typescript-eslint/no-unused-vars` for test files (`tests/**`, `.test.{ts,tsx}`, `.spec.{ts,tsx}`). Drops 3 errors from baseline (per the cleanup plan).

Task 10 — Fix setState-in-effect bugs

Refactor:

  • `components/tools/HtmlToMdx.tsx` (around line 22-26)
  • `components/tools/JsonYamlConverter.tsx` (around line 21-25)

Both call `setOutput('')` synchronously inside a `useEffect` body — React 19's `react-hooks/set-state-in-effect` rule flags this as a real anti-pattern (cascading renders). Fix: derive the empty-output state from `input` instead of mutating state in the effect.

Task 11 — Fix source any + prefer-const errors

  • `lib/analytics.ts:2-3`: replace 2× `any` with proper Plausible options type: `{ props?: Record<string, string | number | boolean> }`
  • `lib/mdx-formatter.ts:141`: `let processed` → `const processed` (never reassigned)

Why deferred

The cleanup plan ran in `jamdesk/jamdesk`'s eslint-cleanup branch (a worktree that excludes `projects/` external repos). Linked PR will be referenced once the monorepo cleanup is merged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions