Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Dec 9, 2025

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

  • Unused catch parameters: Removed unused _e and _error parameters from catch blocks
  • Type safety: Added type guards before string conversion to prevent unsafe object stringification
  • Template expressions: Fixed invalid type usage in template literals with proper type checking
  • Spread operator: Added explicit type casting to prevent spreading arrays in object contexts
  • Exhaustiveness checks: Used satisfies never pattern for compile-time verification of handled cases
  • Floating promises: Added await for all async operations (Orama inserts, example scripts)
  • Lefthook optimisation: Group oxlint/oxfmt to maintain execution order whilst allowing parallel typecheck

Files Modified

  • src/utils/errors.ts: Type-safe error message formatting
  • src/tools/feedback.ts: Safe JSON parsing and explicit POST method
  • mocks/handlers.ts: Type-checked text extraction
  • src/modules/requestBuilder.ts: Safe value serialization and header spreading
  • src/toolsets/base.ts: Exhaustive authentication type checking and safe header conversion
  • src/tool.ts: Awaited Orama insert operations
  • examples/*.ts: Top-level await for all async entry points
  • lefthook.yaml: Optimised pre-commit hook execution order

Testing

  • pnpm lint:oxlint passes with 0 warnings and 0 errors
  • ✅ All pre-commit hooks (oxfmt, oxlint, typecheck) pass
  • ✅ No functional changes - purely type safety improvements

Closes #181

ryoppippi and others added 5 commits December 9, 2025 17:04
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
Copilot AI review requested due to automatic review settings December 9, 2025 17:16
@ryoppippi ryoppippi requested a review from a team as a code owner December 9, 2025 17:16
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 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 await keyword to async Orama insert operations
  • Added exhaustiveness checking using satisfies never pattern 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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@193

commit: 6acf4d8

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
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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

@ryoppippi
Copy link
Member Author

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)
Copy link
Contributor

@glebedel glebedel left a 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
@ryoppippi ryoppippi merged commit 15e849f into main Dec 9, 2025
9 checks passed
@ryoppippi ryoppippi deleted the fix/oxlint-errors branch December 9, 2025 19:10
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.

biome -> oxfmt + oxlint

3 participants