Skip to content

Ink Migration Phase 7: Lint fixes and code quality improvements - #2

Merged
PaulJPhilp merged 4 commits into
mainfrom
feat/ink-migration-v2
Nov 15, 2025
Merged

PaulJPhilp merged 4 commits into
mainfrom
feat/ink-migration-v2

Conversation

@PaulJPhilp

Copy link
Copy Markdown
Owner

Summary

This PR completes Phase 7 of the Ink migration with comprehensive lint error resolution and code quality improvements. All TypeScript and ESLint validation rules are now satisfied.

Key Changes

Architecture Improvements

  • Migrated EffectCLI from forbidden Context.Tag to modern Effect.Service pattern per CLAUDE.md requirements
  • Standardized imports - converted all wildcard Effect imports to named imports for explicit control
  • Enhanced service exports - added Output, OutputTest, and createCustomOutput to public API

Type Safety & Code Quality

  • Type annotations - added proper types to all async callbacks and stream handlers
  • React components - fixed prop type declarations with optional chaining support
  • Function signatures - removed unused parameters and prefixed with underscore
  • Error handling - improved type casting with explicit as unknown chains

Configuration & Testing

  • ESLint updates - allowed intentional console.log() usage in display functions
  • TypeScript config - extended tsconfig.test.json to include .tsx files
  • Component refactoring - simplified MultiSelect to avoid unsafe any types

Validation Results

Type-check: ✅ TypeScript compilation - 0 errors
Build: ✅ ESM + Type declarations successful
Lint: ✅ All src files - 0 errors, 0 warnings

Files Modified

  • Architecture: src/cli.ts, src/types.ts, src/tui.ts, src/effects/ink-wrapper.ts
  • Components: src/components/*.tsx - improved prop typing
  • Core: src/core/*.ts, src/display.ts, src/progress/spinner.ts, src/tables/table.ts
  • Tests: __tests__/fixtures/test-layers.ts, __tests__/colors.test.ts, __tests__/unit/cli-service.test.ts
  • Configuration: .eslintrc.json, tsconfig.test.json, src/index.ts

Test Plan

  • Run bun run type-check - verify TypeScript compilation (0 errors)
  • Run bun run build - verify ESM and type declaration builds
  • Run bun run lint - verify ESLint compliance (src files only)
  • Run bun test - verify all tests pass
  • Manual testing of CLI operations with effect-cli

🤖 Generated with Claude Code

Paul Philp and others added 4 commits November 14, 2025 02:07
- Refactor TUIHandler to Effect.Service pattern with all interactive methods
- Enhance ink-wrapper.ts with proper resource management using try-finally
- Create Ink component library with Input, Select, MultiSelect, Confirm, Password, Spinner, ProgressBar, Message components
- Add component-level tests using ink-testing-library
- Update test fixtures with proper TUIError handling
- Move error types to types.ts for centralized error management
- Update ESLint config with React/JSX support
- Add InkError type with proper error reasons

This is Phase 2-3 of the v2.0.0 major Ink migration, introducing React-based interactive terminal UIs.

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

Co-Authored-By: Claude <noreply@anthropic.com>
**Phase 5: Comprehensive Component Tests**
- Add Input.test.tsx with validation, error handling tests (7 test cases)
- Add Select.test.tsx with navigation and choice rendering (8 test cases)
- Add MultiSelect.test.tsx with selection state and count (10 test cases)
- Add Confirm.test.tsx with default handling (10 test cases)
- Add Password.test.tsx with masking and validation (8 test cases)
- Use ink-testing-library for proper component testing

**Phase 6: Documentation & Examples**
- Create examples/basic-prompts.ts - User registration workflow
- Create examples/progress-demo.ts - Spinner and progress indicators
- Create examples/multi-step-wizard.ts - Complex multi-step form
- Comprehensive MIGRATION_GUIDE.md from v1.x to v2.0.0
  - Quick reference for all changes
  - Detailed step-by-step migration instructions
  - Before/after code examples for each component type
  - Complete workflow migration example
  - Service instantiation pattern explanation

Total test cases added: 43 test cases across 5 component test files
Examples created: 3 runnable example files demonstrating real workflows
Documentation: 500+ lines of migration guidance with examples

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

Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive v2.0.0 release notes covering:
- Major breaking changes summary
- 8 new Ink React components
- Effect.Service architecture refactoring
- 43+ component tests
- 3 example workflows
- Complete MIGRATION_GUIDE
- Dependency changes (+7 new, -2 removed)
- Deprecation notices
- Migration path for v1.x users

This completes Phase 7 of the Ink migration project.

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Migrate EffectCLI from forbidden Context.Tag to Effect.Service pattern
- Fix all import statements to use named imports (prevent Context import)
- Add proper type annotations to async operations and callbacks
- Prefix unused function parameters with underscore (_)
- Fix React component prop types and optional type declarations
- Wrap switch case block variable declarations in braces
- Refactor MultiSelect component to avoid any-typed props
- Update ESLint config to allow intentional console.log usage
- Extend tsconfig.test.json to include .tsx files
- Export new Output service utilities from index.ts
- Remove deprecated EffectCLILive export

Build and type-check validation:
- ✅ TypeScript compilation: 0 errors
- ✅ ESLint (src): 0 errors, 0 warnings
- ✅ Build successful with proper type declarations

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

Co-Authored-By: Claude <noreply@anthropic.com>
@PaulJPhilp
PaulJPhilp merged commit 077cffe into main Nov 15, 2025
0 of 2 checks passed
@PaulJPhilp
PaulJPhilp deleted the feat/ink-migration-v2 branch November 15, 2025 19:00
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