Skip to content

Readability: sync/async cleanup, DRY, type safety, config fixes#55

Open
WolfieLeader wants to merge 9 commits intoTanStack:mainfrom
WolfieLeader:fix/readability
Open

Readability: sync/async cleanup, DRY, type safety, config fixes#55
WolfieLeader wants to merge 9 commits intoTanStack:mainfrom
WolfieLeader:fix/readability

Conversation

@WolfieLeader
Copy link
Contributor

🎯 Changes

Sync/async correctness

  • scanForIntents and scanLibrary were sync internally but declared async — removed the unnecessary async/await throughout source and tests
  • Fixed 2 broken tests that used .rejects.toThrow() on sync functions (these would silently pass since the throw happens before expect() is called)

DRY

  • Deduplicated discoverSkills — removed copy from library-scanner.ts, now imports from scanner.ts
  • Tests import findSkillFiles from src/utils.js instead of redefining it locally
  • Extracted repeated test helpers: mockFetchVersion, mockFetchNotOk, requireFirstSkill, readPkgBin, readPkgFiles

Type safety

  • Type narrowing guards instead of ! non-null assertions and as casts
  • Removed redundant (obj[field] as string) casts where TS already narrowed the type

Config

  • ESLint: allow T[] syntax, import order as warning, type-safe config export
  • tsconfig: removed outDir/declaration (tsdown handles builds), added noEmit: true, included tests/ in type checking
  • knip: added source entry points — knip can't trace dist/*.mjs back to source files, so intent-library.ts was falsely reported unused

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 9, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@tanstack/intent@55

commit: 9888da8

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