Skip to content

fix global declares (jsr doesn't allow them)#90

Merged
jhheider merged 1 commit into
mainfrom
jsr-publish
Jul 22, 2026
Merged

fix global declares (jsr doesn't allow them)#90
jhheider merged 1 commit into
mainfrom
jsr-publish

Conversation

@jhheider

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 22, 2026 20:54
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 29957096047

Warning

No base build found for commit 5aaf5ed on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 82.201%

Details

  • Patch coverage: 3 uncovered changes across 3 files (37 of 40 lines covered, 92.5%).

Uncovered Changes

File Changed Covered %
src/hooks/useConfig.ts 2 1 50.0%
src/hooks/useShellEnv.ts 2 1 50.0%
src/plumbing/hydrate.ts 2 1 50.0%
Total (10 files) 40 37 92.5%

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 3059
Covered Lines: 2570
Line Coverage: 84.01%
Relevant Branches: 784
Covered Branches: 589
Branch Coverage: 75.13%
Branches in Coverage %: Yes
Coverage Strength: 3107.62 hits per line

💛 - Coveralls

@jhheider
jhheider merged commit 093e186 into main Jul 22, 2026
10 checks passed
@jhheider
jhheider deleted the jsr-publish branch July 22, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown

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 removes global prototype/declare global extensions (disallowed by JSR) and replaces them with explicit utility functions, updating internal call sites and publish/lint configuration accordingly.

Changes:

  • Replaced Array.prototype.compact, Set.prototype.insert, String/Number.prototype.chuzzle, and Promise.prototype.swallow with exported helper functions (compact, insert, chuzzle, swallow).
  • Updated call sites and tests to use the new helpers instead of prototype methods/side-effect imports.
  • Removed --allow-slow-types / --no-check workarounds from publish commands and CI.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/utils/misc.ts Removes global extensions and introduces compact/insert/chuzzle helpers.
src/utils/misc.test.ts Updates tests to call compact/insert/chuzzle helpers.
src/utils/error.ts Replaces Promise.prototype.swallow with exported swallow(promise, …) helper.
src/utils/error.test.ts Updates swallow tests to use the new swallow() helper.
src/plumbing/which.ts Replaces .swallow(PantryError) with swallow(…, PantryError).
src/plumbing/hydrate.ts Replaces .compact(...) usage with compact(...).
src/hooks/useShellEnv.ts Replaces seen.insert(...) with insert(seen, ...).
src/hooks/usePantry.ts Replaces .insert, .compact, and .swallow with helper functions.
src/hooks/useInventory.ts Removes side-effect import of misc prototype extensions.
src/hooks/useDownload.ts Removes side-effect import and updates chuzzle usage.
src/hooks/useConfig.ts Replaces .compact(...) usage with compact(...).
src/hooks/useCellar.ts Replaces .swallow(...) usage with swallow(...).
mod.ts Removes side-effect import and re-exports new helper functions via utils.
deno.json Removes no-slow-types lint exclusion and simplifies publish dry-run args.
.github/workflows/publish-jsr.yml Removes --allow-slow-types / --no-check from publish steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/misc.ts
export function compact<T>(arr: Array<T>): Array<Exclude<T, Falsy>>
export function compact<T, S>(arr: Array<T>, body: (t: T) => S | Falsy, opts?: { rescue: boolean }): Array<S>
export function compact<T, S>(arr: Array<T>, body?: (t: T) => S | T | Falsy, opts?: { rescue: boolean }): Array<S | T>
export function compact<T, S>(arr: Array<T>, body?: (t: T) => S | Falsy, opts?: { rescue: boolean }): Array<S | T> {
Comment thread mod.ts
Comment on lines +1 to 2
import { chuzzle, compact, flatmap, insert, validate } from "./src/utils/misc.ts"

Comment thread src/utils/error.test.ts
assertRejects(() => new Promise((_, reject) => reject(new FooError())).swallow(BarError))
await swallow(new Promise((_, reject) => reject(new BarError())), BarError)
await swallow(new Promise((_, reject) => reject(new BazError())), BarError)
assertRejects(() => swallow(new Promise((_, reject) => reject(new FooError())), BarError))
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.

3 participants