-
Notifications
You must be signed in to change notification settings - Fork 3
fix(lint): resolve all oxlint errors #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Replace Biome with oxlint/oxfmt for linting and formatting to align with strict TypeScript code quality standards. This change introduces comprehensive linting rules including type-aware checks, strict boolean expressions, and floating promise detection. BREAKING CHANGE: Linting rules are now significantly stricter. Code that previously passed Biome's checks may now fail with oxlint's pedantic, correctness, suspicious, performance, and style rule categories all set to error level. Changes: - Add .oxlintrc.jsonc with comprehensive TypeScript rules - Add .oxfmtrc.jsonc for code formatting (tabs, single quotes, semicolons) - Update lefthook.yaml to run oxlint → oxfmt → typecheck sequentially - Replace biome scripts with oxlint/oxfmt in package.json - Update pnpm-workspace.yaml to include oxfmt, oxlint, oxlint-tsgolint - Remove biome.json configuration - Remove @biomejs/biome from dependencies - Add oxfmt@^0.17.0, oxlint@^1.32.0, oxlint-tsgolint@^0.8.4 Rationale: oxlint provides more granular control over TypeScript-specific rules and better aligns with the project's goal of maintaining high code quality standards. The type-aware linting catches more potential runtime errors at development time. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Apply oxlint auto-fixes and oxfmt formatting across the entire codebase to align with new code style standards (tabs, single quotes, semicolons). This commit includes: - Auto-fixes applied by oxlint --fix - Formatting applied by oxfmt (tabs, single quotes, semicolons) - Updates to all TypeScript source files, tests, examples, and configs Note: Some lint errors remain and will be addressed in follow-up commits. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove unused catch parameters '_e' and '_error' in error handling code to comply with oxlint no-unused-vars rule. Empty catch blocks are used where the error doesn't need to be handled explicitly. - src/utils/errors.ts: Remove _e parameter from stringify catch block - src/tools/feedback.ts: Remove _error parameter from JSON parse catch
Add proper type checking before converting unknown values to strings to fix oxlint no-base-to-string and restrict-template-expressions errors. This prevents unsafe object stringification and invalid template expressions. - src/utils/errors.ts: Add type guards for requestBody and provider errors - mocks/handlers.ts: Check text value type before returning - src/modules/requestBuilder.ts: Type-safe value serialization with explicit handling - src/toolsets/base.ts: Safe header value conversion with type checks
Add await to orama.insert() call to fix oxlint no-floating-promises error. The insert operation returns a promise and should be awaited since we're already in an async function context. - Ensures proper sequencing of database insertions - Prevents potential race conditions during tool indexing
There was a problem hiding this 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 resolves oxlint errors introduced after migrating to oxlint/oxfmt. The changes primarily consist of formatting updates (spaces to tabs) and type safety improvements to ensure compliance with TypeScript best practices.
- Formatting converted from spaces to tabs across all files
- Type safety improvements including type guards before string conversion and proper type checks in template expressions
- Removed unused catch parameter variables
- Added
awaitkeyword to async Orama insert operations - Added exhaustiveness checking using
satisfies neverpattern for authentication types
Reviewed changes
Copilot reviewed 41 out of 60 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Formatting only - indentation changed from spaces to tabs |
| tsdown.config.ts | Formatting only - indentation changed from spaces to tabs |
| tsconfig.json | Formatting only - indentation changed from spaces to tabs, arrays condensed |
| src/utils/tfidf-index.ts | Formatting only - indentation changed from spaces to tabs |
| src/utils/errors.ts | Type safety improvements: added type guards for requestBody and providerError fields before string conversion; removed unused catch parameter |
| src/utils/array.ts | Formatting only - indentation changed from spaces to tabs |
| src/types.ts | Formatting only - indentation changed from spaces to tabs |
| src/toolsets/stackone.ts | Formatting only - indentation changed from spaces to tabs |
| src/toolsets/index.ts | Formatting only - indentation changed from spaces to tabs |
| src/toolsets/base.ts | Added exhaustiveness checking with satisfies never for unsupported auth types; improved type safety for header value conversion |
| src/tools/feedback.ts | Removed unused catch parameter; added explicit type assertion satisfies 'POST' for HTTP method |
| src/tool.ts | Added await to orama.insert() call to properly handle async operation; formatting changes |
| src/tests/*.ts | Formatting only - indentation changed from spaces to tabs |
| src/schemas/rpc.ts | Formatting only - indentation changed from spaces to tabs |
| src/mcp-client.ts | Formatting only - indentation changed from spaces to tabs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5ae7029 to
455e752
Compare
commit: |
455e752 to
3bbff3c
Compare
Replace unawaited function calls with top-level await to fix oxlint no-floating-promises errors. This ensures examples run to completion and any errors are properly surfaced. - examples/index.ts: await quickstart() - examples/openai-integration.ts: await openaiIntegration() - examples/ai-sdk-integration.ts: await aiSdkIntegration() - examples/human-in-the-loop.ts: await humanInTheLoopExample() - examples/meta-tools.ts: await main() in import.meta.main guard
3bbff3c to
7cdac7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 60 files
e7960d1 to
6407bf6
Compare
|
after all current prs are merged, i merge it |
Use groups structure to run oxlint before oxfmt whilst allowing typecheck to run in parallel with the lint-fmt group. This maintains the critical oxlint → oxfmt ordering whilst improving overall speed. - lint-fmt group: sequential execution (oxlint → oxfmt) - typecheck group: runs in parallel with lint-fmt group
Replace biome-ignore comment with oxlint-compatible eslint-disable directive for consistency with the new linting toolchain.
Add detailed oxlint configuration with ESLint-compatible rules: Plugins enabled: - node: Node.js specific rules - jsdoc: JSDoc documentation validation - import: Import/export statement rules - unicorn: Modern JavaScript best practices Key features: - Comprehensive rule set from @antfu/eslint-config - TypeScript-specific overrides to disable JS-only rules - Test file overrides for flexible assertions - Examples/scripts override for console.log usage - Extensive ignore patterns for generated/build files Environment: Node.js with ES2024 support (no browser)
68fc8e3 to
013cf79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (but you have conflicts)
Resolve conflicts: - Update examples to use local accountId instead of ACCOUNT_IDS constants - Remove examples/constants.ts (deleted in main) - Merge MSW handlers with MCP protocol endpoints - Keep oxlint/oxfmt packages in pnpm-workspace.yaml - Use MSW + Hono approach for MCP fetch tests - Use .test.ts pattern for vitest config
Summary
This PR resolves all 20 oxlint errors introduced after the migration to oxlint/oxfmt in #189. The fixes maintain code functionality whilst ensuring compliance with TypeScript best practices.
What Changed
_eand_errorparameters from catch blockssatisfies neverpattern for compile-time verification of handled casesawaitfor all async operations (Orama inserts, example scripts)Files Modified
src/utils/errors.ts: Type-safe error message formattingsrc/tools/feedback.ts: Safe JSON parsing and explicit POST methodmocks/handlers.ts: Type-checked text extractionsrc/modules/requestBuilder.ts: Safe value serialization and header spreadingsrc/toolsets/base.ts: Exhaustive authentication type checking and safe header conversionsrc/tool.ts: Awaited Orama insert operationsexamples/*.ts: Top-level await for all async entry pointslefthook.yaml: Optimised pre-commit hook execution orderTesting
pnpm lint:oxlintpasses with 0 warnings and 0 errorsCloses #181