Skip to content

Conversation

@KKonstantinov
Copy link
Contributor

@KKonstantinov KKonstantinov commented Jan 19, 2026

Add ESLint Unicorn Plugin for Enhanced Code Quality Standards

Summary

This PR integrates the eslint-plugin-unicorn into the TypeScript SDK's linting configuration and applies its recommended rules across the entire codebase. The changes enforce modern JavaScript/TypeScript best practices, improve code consistency, and enhance long-term
maintainability.

Motivation and Context

Why This Change is Needed

As an SDK that serves as a reference implementation for the Model Context Protocol, code quality and consistency are paramount. The codebase should exemplify best practices that the broader community can follow when building their own MCP implementations.

Key motivations:

  1. Consistency in a Growing Codebase: As more contributors join the project, having automated enforcement of coding standards reduces cognitive load during code reviews and ensures uniform patterns regardless of who writes the code.

  2. Modern JavaScript/TypeScript Idioms: The unicorn plugin enforces contemporary patterns that are cleaner, more readable, and often more performant.

  3. Filename Conventions: Enforcing camelCase filenames eliminates inconsistencies (e.g., auth-extensions.ts vs authExtensions.ts) and aligns with common TypeScript/JavaScript conventions in the ecosystem.

  4. Reduced Bike-Shedding: Automated linting removes subjective style discussions from PRs, letting reviewers focus on logic and architecture rather than formatting preferences.

  5. Onboarding Experience: New contributors can rely on the linter to guide them toward idiomatic code, reducing the learning curve and back-and-forth in reviews.

  6. Auto-fix Support: The majority of unicorn rules support automatic fixing via eslint --fix, making it easy for contributors to comply with standards without manual effort.

Specific Rules Enabled

The unicorn plugin is added with its recommended configuration, plus some additional rules explicitly enabled and a few pragmatic exceptions:

Rule Setting Rationale
unicorn/filename-case camelCase Consistent file naming across the SDK
unicorn/better-regex Error Improves regexes by making them shorter, consistent, and safer
unicorn/consistent-destructuring Error Enforces using destructured variables over properties for cleaner code
unicorn/no-useless-undefined Error (args excluded) Cleaner code, but allows explicit undefined in function arguments for clarity
unicorn/prevent-abbreviations Off Abbreviations like params, args, config are industry-standard
unicorn/no-null Off null is semantically meaningful in JSON-RPC and the MCP protocol
unicorn/prefer-add-event-listener Off Confuses methods on SDK classes, like onrequest and similar and gives false-positive recommendations

For the full list of 100+ rules included in the recommended configuration, see the eslint-plugin-unicorn rules documentation.

How Has This Been Tested?

  • All existing unit tests pass (pnpm test)
  • All existing integration tests pass
  • Linting passes across the entire monorepo (pnpm lint)
  • Build succeeds for all packages (pnpm build)
  • Conformance tests validate the changes work with the MCP specification

Breaking Changes

This is a non-breaking change for SDK consumers.

  • All changes are internal implementation details
  • No public API signatures have changed
  • File renames are internal and do not affect the public exports (index.ts files updated accordingly)
  • TypeScript consumers will see no difference in type definitions

For contributors:

  • New code must follow camelCase filename conventions
  • The linter will automatically flag non-idiomatic patterns during development
  • Most issues can be auto-fixed by running pnpm lint --fix

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional Context

Files Renamed (kebab-case → camelCase)

Old Name New Name
auth-extensions.ts authExtensions.ts
auth-utils.ts authUtils.ts
in-memory.ts inMemory.ts
zod-compat.ts zodCompat.ts
zod-json-schema-compat.ts zodJsonSchemaCompat.ts
ajv-provider.ts ajvProvider.ts
cfworker-provider.ts cfWorkerProvider.ts
mcp-server.ts mcpServer.ts
task-listing.test.ts taskListing.test.ts

Future Benefits

Once merged, the linter will automatically enforce these standards on all future contributions, ensuring the codebase maintains a consistent, modern style as it evolves.

@changeset-bot
Copy link

changeset-bot bot commented Jan 19, 2026

⚠️ No Changeset found

Latest commit: 33ffcf6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 19, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1403

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1403

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1403

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1403

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1403

commit: 33ffcf6

@KKonstantinov KKonstantinov marked this pull request as ready for review January 19, 2026 16:43
@KKonstantinov KKonstantinov requested a review from a team as a code owner January 19, 2026 16:43
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