fix global declares (jsr doesn't allow them)#90
Merged
Merged
Conversation
Coverage Report for CI Build 29957096047Warning No base build found for commit Coverage: 82.201%Details
Uncovered Changes
Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |
There was a problem hiding this comment.
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, andPromise.prototype.swallowwith 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-checkworkarounds 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.
| 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 on lines
+1
to
2
| import { chuzzle, compact, flatmap, insert, validate } from "./src/utils/misc.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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.