Skip to content

chore: add flat ESLint config with typescript-eslint, react-hooks, an… - #1491

Merged
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
p70436464-prog:feat/eslint-flat-config
Nov 26, 2026
Merged

greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
p70436464-prog:feat/eslint-flat-config

Conversation

@p70436464-prog

Copy link
Copy Markdown
Contributor

Closes #1375

Summary

Adds a flat ESLint v9 configuration (eslint.config.js) with @eslint/js, typescript-eslint, eslint-plugin-react-hooks, and eslint-plugin-jsx-a11y, adds lint and lint:fix scripts to package.json, fixes all production lint errors, audits existing eslint-disable comments, and documents linting in CONTRIBUTING.md.

Changes

  • ESLint setup: Added eslint, @eslint/js, typescript-eslint, eslint-plugin-react-hooks, eslint-plugin-jsx-a11y, and globals as devDependencies, plus npm run lint and npm run lint:fix scripts.
  • Flat config (eslint.config.js):
    • Ignores dist, coverage, e2e, and *.config.*.
    • Configures browser globals for app code and Vitest globals for *.test.{ts,tsx} and setupTests.ts.
    • Enforces react-hooks/rules-of-hooks (error) and react-hooks/exhaustive-deps (warn); disables React 19 Compiler-only rules bundled in eslint-plugin-react-hooks v7 since this project runs React 18 without React Compiler.
    • Enables jsx-a11y recommended rules at error for all rules that currently pass, and tracks the 11 rules with existing violations at warn.
    • Enforces @typescript-eslint/no-explicit-any and @typescript-eslint/no-unused-vars at error in production code and warn in test files.
  • Fixes:
    • Fixed conditional hook calls (react-hooks/rules-of-hooks) in src/components/ApiCard.tsx and src/components/EmptyState.tsx.
    • Fixed no-unsafe-finally in src/hooks/useVaultBalances.ts and @typescript-eslint/no-unused-expressions in src/state/pinnedApis.ts.
    • Fixed no-useless-escape, prefer-const, and unused variables/catch bindings across production source files.
    • Added a justified eslint-disable-next-line no-control-regex in src/components/RequireAuth.tsx.
  • Existing eslint-disable audit:
    • src/pages/MyApis.tsx: removed unused eslint-disable-next-line react-hooks/exhaustive-deps.
    • src/hooks/useLocalStorage.ts: kept both eslint-disable-next-line react-hooks/exhaustive-deps with one-line justifications.
    • src/components/ParamsBuilder.tsx: kept existing justified eslint-disable-next-line react-hooks/exhaustive-deps.
  • Docs: Added a Linting section and PR checklist item to CONTRIBUTING.md.

Verification

  • npm run lint exits 0 (0 errors, 122 warnings across legacy jsx-a11y, react-hooks/exhaustive-deps, and test-only no-explicit-any/no-unused-vars).
  • Verified deliberate jsx-a11y/alt-text violation (<img src="x.png" />) fails with exit code 1.
  • Verified Vitest tests pass on modified modules (RequireAuth.test.tsx, EmptyState.test.tsx — 75/75 passed).

Proposed CI Step

Per the issue notes, .github/workflows/ci.yml is untouched in this PR. Suggested addition after npm ci:

      - run: npm ci
      - run: npm run lint

@drips-wave

drips-wave Bot commented Nov 24, 2026

Copy link
Copy Markdown

@p70436464-prog Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@github-actions

Copy link
Copy Markdown

pr-malware-guard: needs security review

These files need a maintainer's review before merge (the check passes with a warning):

  • Lockfile change — package-lock.json
  • Dependency change in package.json — package.json

@github-actions github-actions Bot added the needs-security-review Needs a maintainer security review (pr-malware-guard) label Nov 24, 2026
@greatest0fallt1me
greatest0fallt1me merged commit a44cdaa into CalloraOrg:main Nov 26, 2026
1 check passed
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Thanks @p70436464-prog! Merged. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-security-review Needs a maintainer security review (pr-malware-guard)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce ESLint (typescript-eslint, react-hooks, jsx-a11y) with a CI lint step and fix existing violations

2 participants