Skip to content

Remove all lint suppressions from codebase - #342

Merged
malibio merged 3 commits into
mainfrom
feature/remove-all-lint-suppressions
Oct 23, 2025
Merged

malibio merged 3 commits into
mainfrom
feature/remove-all-lint-suppressions

Conversation

@malibio

@malibio malibio commented Oct 23, 2025

Copy link
Copy Markdown
Collaborator

Summary

Enforces zero-tolerance policy for lint suppressions by removing all eslint-disable, @ts-expect-error, @ts-nocheck, and svelte-ignore comments from the codebase.

Changes Made

Test Files

  • test-helpers.ts: Removed function overload eslint-disable comments by consolidating JSDoc
  • position-cursor.test.ts: Fixed requestAnimationFrame spy typing with proper type cast
  • node-deletion-with-mentions.test.ts: Used unknown type assertion instead of any
  • Keyboard command tests: Added proper type casts for vi.fn() mock functions

Source Files

  • shared-node-store.ts: Fixed dynamic key access using type-safe spread operator
  • +layout.svelte: Changed window.__TAURI_INTERNALS__ check to in operator

Svelte Components

  • ordered-list-node.svelte, quote-block-node.svelte: Added role="presentation" for accessibility
  • autocomplete-modal.svelte: Added proper ARIA attributes, keyboard handlers, and roles for full a11y compliance

Result

  • ✅ 0 lint suppressions remaining in codebase
  • ✅ All files pass bun run quality:fix with 0 errors and 0 warnings
  • ✅ Proper TypeScript types used throughout
  • ✅ Accessibility improvements for interactive elements
  • ✅ Pre-commit hooks pass successfully

Test Plan

  • Run bun run quality:fix - passes with 0 errors/warnings
  • Verify no lint suppressions remain: grep -r "eslint-disable|@ts-expect-error|@ts-nocheck|svelte-ignore" src - 0 results
  • Pre-commit hooks pass successfully

🤖 Generated with Claude Code

malibio and others added 3 commits October 24, 2025 00:43
This commit enforces zero-tolerance policy for lint suppressions by addressing
all eslint-disable, @ts-expect-error, @ts-nocheck, and svelte-ignore comments.

**Fixes Applied:**

Test Files:
- test-helpers.ts: Removed function overload eslint-disable comments
- position-cursor.test.ts: Fixed requestAnimationFrame spy typing with proper cast
- node-deletion-with-mentions.test.ts: Used `unknown` type assertion instead of `any`
- keyboard command tests: Added proper type casts for vi.fn() mock functions

Source Files:
- shared-node-store.ts: Fixed dynamic key access with proper type-safe spread operator
- +layout.svelte: Changed `window.__TAURI_INTERNALS__` check to `in` operator

Svelte Components:
- ordered-list-node.svelte, quote-block-node.svelte: Added `role="presentation"` instead of suppressing a11y warnings
- autocomplete-modal.svelte: Added proper ARIA attributes, keyboard handlers, and roles

**Result:**
- 0 lint suppressions remaining in codebase
- All files pass quality:fix with 0 errors and 0 warnings
- Proper TypeScript types used throughout
- Accessibility improvements for interactive elements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Implements all reviewer recommendations from pragmatic code review:

**Changes Made:**

1. **Removed test-node-operations.mjs** - Exploratory test script not integrated
   into test suite or documented. Removed to maintain clear project structure.

2. **Enhanced ESLint Configuration** - Added `varsIgnorePattern: '^_'` to
   @typescript-eslint/no-unused-vars rule to allow underscore-prefixed variables
   in destructuring (in addition to existing argsIgnorePattern).

3. **Improved Unused Variable Pattern** - Changed from `void content;` to
   underscore prefix (`content: _content`) in shared-node-store.ts for more
   idiomatic intentionally-unused variable handling in destructuring.

4. **Added Accessibility Documentation** - Added comprehensive comments
   explaining `role="presentation"` usage in ordered-list-node.svelte and
   quote-block-node.svelte wrapper components, clarifying they're for styling
   and event delegation only.

**Reviewer Recommendations Not Implemented:**

- **createTestNode function refactoring** (SKIPPED) - Current discriminated
  union pattern is type-safe, well-documented, and doesn't require breaking
  API changes across test files. The runtime type checking approach is a
  standard TypeScript pattern for backward-compatible APIs.

- **Mock typing improvements in tests** (REVERTED) - Attempted to type mocks
  at creation with `ReturnType<typeof vi.fn<[], T>>` but this doesn't work
  with Vitest's type system. Kept existing type cast pattern at usage sites
  as originally implemented.

**Result:**
- ✅ All quality checks pass (0 errors, 0 warnings)
- ✅ All practical improvements implemented
- ✅ Code follows project standards
- ✅ Accessibility improved with proper documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Addresses all optional and nice-to-have suggestions from pragmatic code review
to maximize code quality and maintainability.

**Changes Made:**

1. **Consolidate ESLint Configuration (DRY Principle)**
   - Extracted `commonUnusedVarsRule` constant to avoid duplication across 3 config sections
   - Reduces risk of configuration drift and improves maintainability
   - eslint.config.js: lines 10, 82, 133, 277

2. **Enhanced Accessibility (WCAG 2.1)**
   - Added aria-describedby to autocomplete modal dialog
   - Added IDs to header and keyboard shortcuts sections for programmatic relationships
   - Screen readers now get richer context about modal purpose and available shortcuts
   - autocomplete-modal.svelte: lines 460, 467, 490

3. **Improved Test Documentation**
   - Added comprehensive comments explaining Vitest type cast limitations
   - Documented why ReturnType<typeof vi.fn> casts are necessary at usage sites
   - Helps future developers understand non-obvious testing patterns
   - Files: position-cursor.test.ts, keyboard-command-integration.test.ts,
     navigate-down.command.test.ts, navigate-up.command.test.ts

4. **Added Test Helper Function**
   - Created mockReturnValue<T>(fn, value) helper in test-helpers.ts
   - Centralizes repetitive type cast pattern for mock functions
   - Available for future tests to reduce boilerplate
   - test-helpers.ts: lines 625-643
   - Note: Existing tests not updated to avoid touching working code unnecessarily

5. **Enhanced Type Safety Documentation**
   - Improved comment for Node type assertion in shared-node-store.ts
   - Explains why widening to Node type is safe and necessary for API compatibility
   - Note: Using Omit<Node, 'content'> was attempted but creates type incompatibility
     with backend API signatures. Original approach with better docs is optimal.
   - shared-node-store.ts: lines 607-609

**Recommendations Not Implemented (with rationale):**

- **Omit<Node, 'content'> type precision** - Would require changing backend API
  signatures that expect Node type. Current approach with improved documentation
  is more pragmatic. The type widening is intentional and safe.

**Result:**
- ✅ All quality checks pass (0 errors, 0 warnings)
- ✅ Improved code maintainability (DRY principle)
- ✅ Enhanced accessibility (WCAG 2.1 compliance)
- ✅ Better documentation for complex patterns
- ✅ Helper utilities for future development

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio
malibio merged commit 2b32886 into main Oct 23, 2025
@malibio
malibio deleted the feature/remove-all-lint-suppressions branch October 23, 2025 23:15
malibio added a commit that referenced this pull request Feb 4, 2026
…ions

Remove all lint suppressions from codebase
malibio added a commit that referenced this pull request Feb 5, 2026
…ions

Remove all lint suppressions from codebase
malibio added a commit that referenced this pull request Feb 26, 2026
…ions

Remove all lint suppressions from codebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant