Skip to content

refactor: migrate to eslint-for-ai with enhanced type safety#4

Merged
eli0shin merged 4 commits intomainfrom
eslint-for-ai
Dec 26, 2025
Merged

refactor: migrate to eslint-for-ai with enhanced type safety#4
eli0shin merged 4 commits intomainfrom
eslint-for-ai

Conversation

@eli0shin
Copy link
Owner

@eli0shin eli0shin commented Dec 26, 2025

Summary

This PR modernizes the development infrastructure and improves type safety across the codebase through:

  • Migration to eslint-for-ai for AI-friendly linting standards
  • Implementation of Changesets for automated release management and semantic versioning
  • Enhanced type safety with @total-typescript/ts-reset and type-safe JSON parsing
  • Re-export of MCP SDK types for better protocol consistency

Changes

Infrastructure

  • Release Management: Added Changesets configuration for automated versioning and changelog generation
    • GitHub Actions workflow for automated PR creation and npm publishing
    • Changeset status checks to ensure releases are properly documented
  • Claude Command: Added /changeset command for automatic changeset generation from git history

Type Safety

  • Enhanced Type Definitions: Added @total-typescript/ts-reset for improved built-in type inference
  • Type Guards: Implemented isObject, parseJsonRpcResponse, and parseToolsArray for runtime-safe JSON parsing
  • SDK Types: Re-exported MCP SDK types instead of maintaining custom type definitions
  • Zod Integration: Leveraged Zod schemas from MCP SDK for type-safe response parsing

ESLint Configuration

  • Modern Config: Migrated to eslint-for-ai package consolidating multiple ESLint dependencies
  • Dependencies Removed: @eslint/js, typescript-eslint, eslint-plugin-import-x, globals
  • Code Quality: Fixed type assertions, removed unnecessary conditions, addressed console statements

Benefits

  • Automated Releases: Changesets provides automated version bumping and changelog generation based on semantic versioning
  • Better Documentation: Release notes automatically generated from changeset summaries
  • Improved Type Safety: Type guards and ts-reset eliminate unsafe type assertions and improve runtime safety
  • Simplified Configuration: Single ESLint package reduces maintenance burden
  • AI-Friendly Standards: ESLint rules optimized for AI code generation and analysis

Test Plan

  • All existing tests pass with updated type-safe implementations
  • ESLint configuration validates successfully
  • Type checking passes with enhanced type definitions
  • Integration tests confirm runtime type safety improvements
  • Changeset workflows configured and validated

🤖 Generated with Claude Code

eli0shin and others added 4 commits December 26, 2025 12:35
This commit modernizes the ESLint configuration and improves type safety across the codebase:

- Replace custom ESLint config with eslint-for-ai package for AI-friendly linting
- Add type guard functions (isObject, parseJsonRpcResponse, parseToolsArray) for safe JSON parsing
- Re-export MCP SDK types instead of maintaining custom type definitions
- Fix type assertions, unnecessary conditions, and console statements throughout source and tests
- Use Zod schemas from MCP SDK for type-safe response parsing

The migration to eslint-for-ai provides better code quality standards while the type guards eliminate unsafe type assertions and improve runtime safety.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds ts-reset to enhance TypeScript's built-in type definitions with better inference for common operations like Array.filter, JSON.parse, and more.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Changesets tooling and workflows to automate versioning, changelog generation, and publishing. Includes PR validation to ensure changesets are created for source changes.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add changeset documenting the migration to eslint-for-ai with type-safe JSON parsing, @total-typescript/ts-reset integration, and Changesets tooling addition.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@eli0shin eli0shin marked this pull request as ready for review December 26, 2025 18:15
Copilot AI review requested due to automatic review settings December 26, 2025 18:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the codebase by migrating to eslint-for-ai for consolidated ESLint configuration and enhances type safety through @total-typescript/ts-reset and custom type guard functions. The changes also introduce Changesets for automated release management.

  • Replaces multiple ESLint packages with the single eslint-for-ai package
  • Adds runtime type validation with custom type guard functions for JSON-RPC responses
  • Implements @total-typescript/ts-reset for improved built-in TypeScript type definitions
  • Introduces Changesets workflow for versioning and publishing

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/wildcard-filtering.test.ts Adds helper function for process output handling with explicit type annotations
tests/test-utils.ts Introduces isJsonRpcResponse type guard and simplifies JSON parsing logic
tests/test-messages.ts Updates default parameter syntax to use implicit typing
tests/setup.ts Replaces console.log with process.stderr.write for test output
tests/proxy.test.ts Modifies invalid command test to check async spawn behavior
tests/integration.test.ts Adds type guard and ESLint disable comments for Bun-specific type narrowing
tests/bunx-integration.test.ts Removes redundant type checks and simplifies error handling
src/types.ts Adds type guard functions parseJsonRpcResponse and parseToolsArray for safe JSON parsing
src/reset.d.ts Imports ts-reset for enhanced TypeScript type definitions
src/proxy-server.ts Adds readonly modifiers, uses Zod schemas for validation, and adopts nullish coalescing
src/cli.ts Integrates new type guard functions for safer JSON parsing in CLI operations
package.json Replaces ESLint packages with eslint-for-ai and adds Changesets dependencies
eslint.config.mjs Simplifies configuration to use eslint-for-ai recommended config
.github/workflows/version.yml Adds workflow for automated versioning and publishing
.github/workflows/changeset-check.yml Adds workflow to enforce changesets on source changes
.changeset/* Adds Changesets configuration and initial changeset file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eli0shin eli0shin merged commit e884d5d into main Dec 26, 2025
8 checks passed
@eli0shin eli0shin deleted the eslint-for-ai branch December 26, 2025 18:45
@github-actions github-actions bot mentioned this pull request Dec 26, 2025
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