refactor: migrate to eslint-for-ai with enhanced type safety#4
Merged
refactor: migrate to eslint-for-ai with enhanced type safety#4
Conversation
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>
There was a problem hiding this comment.
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-aipackage - Adds runtime type validation with custom type guard functions for JSON-RPC responses
- Implements
@total-typescript/ts-resetfor 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR modernizes the development infrastructure and improves type safety across the codebase through:
eslint-for-aifor AI-friendly linting standards@total-typescript/ts-resetand type-safe JSON parsingChanges
Infrastructure
/changesetcommand for automatic changeset generation from git historyType Safety
@total-typescript/ts-resetfor improved built-in type inferenceisObject,parseJsonRpcResponse, andparseToolsArrayfor runtime-safe JSON parsingESLint Configuration
eslint-for-aipackage consolidating multiple ESLint dependencies@eslint/js,typescript-eslint,eslint-plugin-import-x,globalsBenefits
Test Plan
🤖 Generated with Claude Code