8000 feat: framework fallback none by Shinigami92 · Pull Request #33 · un-ts/unuse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dismiss alert

feat: framework fallback none #33

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

Merged
merged 1 commit into from
Jun 24, 2025
Merged

Conversation

Shinigami92
Copy link
Member
@Shinigami92 Shinigami92 commented Jun 24, 2025

closes #32

I'm not sure if this is a fix or feat 🤔


Important

Added 'none' framework fallback to allow operation without a specific framework, updating behavior and tests accordingly.

  • New Feature:
    • Added 'none' as a SupportedFramework in index.ts to allow operation without a specific framework.
    • Updated initFrameworkImport() and importedFramework() to exclude 'none'.
  • Behavior Changes:
    • Default framework set to 'none' in toUnSignal(), tryOnScopeDispose(), unAccess(), unRefElement(), and unResolve().
    • In unResolve(), added handling for 'none' framework to return UnSignal or UnComputed based on readonly option.
  • Tests:
    • Updated unResolve/index.spec.ts to use 'none' framework for testing UnSignal and UnComputed behavior.
  • Documentation:
    • Added changeset thick-candles-doubt.md documenting the new 'none' framework feature.

This description was created by Ellipsis for 3ffae19. You can customize this summary. It will automatically update as commits are pushed.


Summary by CodeRabbit

  • New Features
    • Added support for a 'none' framework fallback, allowing the library to operate without a specific framework.
  • Bug Fixes
    • Improved handling of framework detection to ensure a default value is always set, preventing undefined behavior.
  • Tests
    • Updated test cases to use the 'none' framework option for more consistent testing.
  • Documentation
    • Added a changeset documenting the new feature and related updates.

@Shinigami92 Shinigami92 self-assigned this Jun 24, 2025
Copy link
changeset-bot bot commented Jun 24, 2025

🦋 Changeset detected

Latest commit: 3ffae19

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
unuse Minor
unuse-angular Minor
unuse-react Minor
unuse-solid Minor
unuse-vue Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
coderabbitai bot commented Jun 24, 2025

Walkthrough

A new 'none' fallback option was introduced for framework detection and handling across several modules. All relevant type signatures, internal logic, and test cases were updated to use 'none' instead of undefined as the default or fallback framework. This change standardizes framework-agnostic behavior and simplifies conditional checks throughout the codebase.

Changes

File(s) Change Summary
.changeset/thick-candles-doubt.md Added a changeset documenting the new 'none' framework fallback feature and related minor tags.
packages/unuse/src/_framework/index.ts Extended SupportedFramework type to include 'none'; updated framework import logic to exclude 'none' as argument.
packages/unuse/src/toUnSignal/index.ts Changed fallback logic to assign 'none' as default framework, using explicit string comparison.
packages/unuse/src/tryOnScopeDispose/index.ts Updated framework assignment to default to 'none' and use strict equality check.
packages/unuse/src/unAccess/index.ts Defaulted framework to 'none', added explicit 'none' case in switch, and unified detection logic.
packages/unuse/src/unRefElement/index.ts Assigned framework to 'none' if falsy, with ESLint directive for unnecessary condition.
packages/unuse/src/unResolve/index.spec.ts Updated all test cases to use 'none' instead of undefined for the framework option.
packages/unuse/src/unResolve/index.ts Removed undefined from type constraints; defaulted framework to 'none' and updated type signatures.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant FrameworkHandler

    User->>App: Calls function (e.g., unResolve)
    App->>FrameworkHandler: Determine framework (default to 'none' if undefined)
    alt Framework is 'none'
        FrameworkHandler-->>App: Return framework-agnostic behavior
    else Framework is a supported framework
        FrameworkHandler-->>App: Import/use specific framework logic
    end
    App-->>User: Return result
Loading

Possibly related issues

Poem

In the warren of code, a new path is shown,
Where frameworks may wander, or leave you alone.
With 'none' as a friend, the fallback is clear,
No more undefined, just rabbits to cheer!
🐇✨
Hop along, little code, your journey’s begun—
Framework or none, you still get things done!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00b5721 and 3ffae19.

📒 Files selected for processing (8)
  • .changeset/thick-candles-doubt.md (1 hunks)
  • packages/unuse/src/_framework/index.ts (3 hunks)
  • packages/unuse/src/toUnSignal/index.ts (1 hunks)
  • packages/unuse/src/tryOnScopeDispose/index.ts (1 hunks)
  • packages/unuse/src/unAccess/index.ts (1 hunks)
  • packages/unuse/src/unRefElement/index.ts (1 hunks)
  • packages/unuse/src/unResolve/index.spec.ts (3 hunks)
  • packages/unuse/src/unResolve/index.ts (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • .changeset/thick-candles-doubt.md
  • packages/unuse/src/unRefElement/index.ts
  • packages/unuse/src/unResolve/index.spec.ts
  • packages/unuse/src/toUnSignal/index.ts
  • packages/unuse/src/tryOnScopeDispose/index.ts
  • packages/unuse/src/unAccess/index.ts
  • packages/unuse/src/_framework/index.ts
  • packages/unuse/src/unResolve/index.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor
github-actions bot commented Jun 24, 2025

Coverage Report

Status Category Percentage Covered / Total
🔴 Lines 31.93% (🎯 90%)
⬇️ -0.13%
731 / 2289
🔴 Statements 31.93% (🎯 90%)
⬇️ -0.13%
731 / 2289
🔴 Functions 60.97% (🎯 90%)
🟰 ±0%
50 / 82
🔴 Branches 74.13% (🎯 85%)
⬇️ -1.16%
192 / 259
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/unuse/src/_framework/index.ts 81.53%
⬇️ -0.28%
62.5%
🟰 ±0%
100%
🟰 ±0%
81.53%
⬇️ -0.28%
48-49, 67-68, 76-77, 85-86, 94-95, 102-103
packages/unuse/src/toUnSignal/index.ts 73.04%
⬇️ -0.64%
63.33%
⬇️ -0.95%
66.66%
🟰 ±0%
73.04%
⬇️ -0.64%
18-19, 32-33, 36-37, 44-45, 49, 51-52, 74-75, 82-88, 99-100, 106-107, 114-121, 131, 141-142
packages/unuse/src/tryOnScopeDispose/index.ts 77.77%
⬆️ +0.50%
78.57%
⬆️ +1.65%
50%
🟰 ±0%
77.77%
⬆️ +0.50%
11-14, 23-24, 35-36, 40-41
packages/unuse/src/unAccess/index.ts 63.36%
⬇️ -2.29%
75%
⬇️ -3.37%
66.66%
🟰 ±0%
63.36%
⬇️ -2.29%
45-46, 50-51, 64-65, 68-69, 73, 76-83, 86-95, 98-107, 116-117, 120-121, 124-125
packages/unuse/src/unRefElement/index.ts 75%
⬇️ -6.81%
33.33%
⬇️ -16.67%
100%
🟰 ±0%
75%
⬇️ -6.81%
29, 36-37
packages/unuse/src/unResolve/index.ts 91.81%
⬇️ -0.85%
94.28%
⬇️ -2.77%
71.42%
🟰 ±0%
91.81%
⬇️ -0.85%
73-74, 95-96, 101, 127-130
Unchanged Files
docs/.vitepress/config.ts 0% 0% 0% 0% 1-25
docs/.vitepress/dist/assets/app.DYZM1BAi.js 0% 0% 0% 0% 1
docs/.vitepress/dist/assets/index.md.DlWRzJh1.js 0% 0% 0% 0% 1
docs/.vitepress/dist/assets/index.md.DlWRzJh1.lean.js 0% 0% 0% 0% 1
docs/.vitepress/dist/assets/chunks/framework.Cl5_4IdU.js 0% 0% 0% 0% 1-18
docs/.vitepress/dist/assets/chunks/theme.5Tkc4cwY.js 0% 0% 0% 0% 1
packages/unuse-angular/dist/index.d.ts 0% 0% 0% 0% 1-3
packages/unuse-angular/dist/index.js 0% 0% 0% 0% 1-83
packages/unuse-angular/src/index.ts 0% 100% 100% 0% 6-195
packages/unuse-react/dist/index.d.ts 0% 0% 0% 0% 1-3
packages/unuse-react/dist/index.js 0% 0% 0% 0% 1-83
packages/unuse-react/src/index.ts 0% 100% 100% 0% 2-206
packages/unuse-solid/dist/index.d.ts 0% 0% 0% 0% 1-3
packages/unuse-solid/dist/index.js 0% 0% 0% 0% 1-84
packages/unuse-solid/src/index.ts 0% 100% 100% 0% 2-200
packages/unuse-vue/dist/index.d.ts 0% 0% 0% 0% 1-3
packages/unuse-vue/dist/index.js 0% 0% 0% 0% 1-73
packages/unuse-vue/src/index.ts 0% 100% 100% 0% 2-183
packages/unuse/dist/index.d.ts 0% 0% 0% 0% 1-4
packages/unuse/dist/index.js 0% 0% 0% 0% 1-700
packages/unuse/src/index.ts 0% 0% 0% 0% 1-16
packages/unuse/src/_testUtils/angular.ts 100% 100% 100% 100%
packages/unuse/src/_testUtils/react.ts 100% 100% 100% 100%
packages/unuse/src/_testUtils/solid.ts 100% 100% 100% 100%
packages/unuse/src/_testUtils/vue.ts 100% 100% 100% 100%
packages/unuse/src/isClient/index.ts 100% 0% 100% 100%
packages/unuse/src/isObject/index.ts 100% 100% 100% 100%
packages/unuse/src/isWorker/index.ts 66.66% 0% 100% 66.66% 5
packages/unuse/src/toArray/index.ts 100% 50% 100% 100%
packages/unuse/src/unComputed/index.ts 100% 100% 100% 100%
packages/unuse/src/unSignal/index.ts 100% 100% 100% 100%
packages/unuse/src/unWatch/index.ts 100% 100% 100% 100%
packages/unuse/src/useEventListener/index.ts 96.38% 86.66% 100% 96.38% 193-194, 199
packages/unuse/src/useIntervalFn/index.ts 92.98% 80% 100% 92.98% 78-79, 83-84
packages/unuse/src/useWebSocket/index.ts 46.93% 41.66% 33.33% 46.93% 162-164, 204-213, 217-219, 223-225, 234-236, 245-257, 263-264, 271-276, 279-309, 312-313, 316-327, 331-356, 368-369
Generated in workflow #88 for commit 3ffae19 by the Vitest Coverage Report Action

@Shinigami92 Shinigami92 marked this pull request as ready for review June 24, 2025 15:03
Copy link
Contributor
@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 00b5721 in 1 minute and 57 seconds. Click for details.
  • Reviewed 313 lines of code in 8 files
  • Skipped 0 files when reviewing.
  • Skipped posting 12 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/thick-candles-doubt.md:9
  • Draft comment:
    Ambiguous commit message; clarify whether this is a feature or fix.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to clarify the commit message, which is similar to asking them to update the PR description. This violates the rule against asking for updates to the PR description or similar clarifications.
2. packages/unuse/src/_framework/index.ts:46
  • Draft comment:
    Returning early in the 'none' case avoids unused imports; ensure downstream code safely handles lack of framework features.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. packages/unuse/src/_framework/index.ts:104
  • Draft comment:
    Returning an empty object in the 'none' case may mask errors if framework methods are later called; document or safeguard this behavior.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment raises a valid concern - returning {} could lead to runtime errors if framework methods are called. However, this appears to be an intentional design choice given the type casting. The type system should catch incorrect usage at compile time. The comment doesn't provide a clear actionable alternative. I might be putting too much faith in the TypeScript type system to catch misuse. The runtime behavior could still be dangerous. While runtime safety is important, the type casting suggests this is an intentional escape hatch for the 'none' case. Adding documentation would be nice but not essential. Delete the comment as it questions an intentional design choice without providing clear actionable improvements.
4. packages/unuse/src/toUnSignal/index.ts:48
  • Draft comment:
    Defaulting UNUSE_FRAMEWORK to 'none' ensures predictable behavior when no framework is set.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
5. packages/unuse/src/tryOnScopeDispose/index.ts:27
  • Draft comment:
    Using the same fallback to 'none' here standardizes behavior; this is appropriate for tryOnScopeDispose.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
6. packages/unuse/src/unAccess/index.ts:72
  • Draft comment:
    Fallback to 'none' in isUnRef is consistent; ensure documentation clearly explains behavior when no framework is specified.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
7. packages/unuse/src/unRefElement/index.ts:28
  • Draft comment:
    Vue-specific handling in unRefElement is clear; consider adding similar commentary for non-Vue paths to aid future maintenance.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
8. packages/unuse/src/unResolve/index.spec.ts:15
  • Draft comment:
    Explicitly specifying ' 8000 none' as the framework in tests improves clarity and consistency.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
9. packages/unuse/src/unResolve/index.ts:100
  • Draft comment:
    Defaulting the framework option to 'none' clarifies behavior; ensure this change is highlighted in the documentation.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
10. packages/unuse/src/unResolve/index.ts:116
  • Draft comment:
    Directly overriding state methods (e.g., in Angular case) is a hack; add inline comments to document potential pitfalls for maintenance.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
11. packages/unuse/src/unResolve/index.ts:160
  • Draft comment:
    The React state update hack is fragile; ensure thorough documentation to avoid future maintenance issues.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
12. .changeset/thick-candles-doubt.md:9
  • Draft comment:
    On line 9, the commit message reads "feat: framework fallback 'none'". The combination of backticks and single quotes around none appears unusual—was this intentional, or should it be formatted as either 'none'` or simply none?
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a purely cosmetic issue in a changeset file. The message is still perfectly readable and understandable regardless of the quote style. The actual functionality or code behavior is not affected. This seems like an extremely minor formatting preference. The unusual formatting might cause confusion when the changeset is processed, or it might be against some established changeset formatting conventions. Changesets are primarily for documentation purposes, and even if there are formatting conventions, this is too minor an issue to warrant a comment. The meaning is clear regardless of quote style. Delete this comment as it's purely about cosmetic formatting in documentation and doesn't affect functionality or code quality.

Workflow ID: wflow_ss5kHl2tSB8QdtOO

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/unuse/src/_framework/index.ts (1)

55-62: Consider updating the type definition to handle 'none' case.

The ImportedFrameworkReturn<TFramework> type doesn't explicitly handle the 'none' case. While the current implementation works, consider updating the type for completeness:

export type ImportedFrameworkReturn<TFramework extends SupportedFramework> =
  TFramework extends 'angular'
    ? typeof import('@angular/core')
    : TFramework extends 'react'
      ? typeof import('react')
      : TFramework extends 'solid'
        ? typeof import('solid-js')
+       : TFramework extends 'none'
+         ? {}
-        : typeof import('vue');
+         : typeof import('vue');
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d5e265 and 00b5721.

📒 Files selected for processing (8)
  • .changeset/thick-candles-doubt.md (1 hunks)
  • packages/unuse/src/_framework/index.ts (3 hunks)
  • packages/unuse/src/toUnSignal/index.ts (1 hunks)
  • packages/unuse/src/tryOnScopeDispose/index.ts (1 hunks)
  • packages/unuse/src/unAccess/index.ts (1 hunks)
  • packages/unuse/src/unRefElement/index.ts (1 hunks)
  • packages/unuse/src/unResolve/index.spec.ts (3 hunks)
  • packages/unuse/src/unResolve/index.ts (6 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
packages/unuse/src/unRefElement/index.ts (1)
packages/unuse/src/_framework/index.ts (1)
  • SupportedFramework (1-1)
packages/unuse/src/unResolve/index.spec.ts (2)
packages/unuse/src/unResolve/index.ts (1)
  • unResolve (86-237)
packages/unuse/src/unSignal/index.ts (2)
  • isUnSignal (69-79)
  • unSignal (45-64)
packages/unuse/src/tryOnScopeDispose/index.ts (1)
packages/unuse/src/_framework/index.ts (1)
  • SupportedFramework (1-1)
packages/unuse/src/toUnSignal/index.ts (1)
packages/unuse/src/_framework/index.ts (1)
  • SupportedFramework (1-1)
packages/unuse/src/unAccess/index.ts (1)
packages/unuse/src/_framework/index.ts (2)
  • SupportedFramework (1-1)
  • importedFramework (64-110)
packages/unuse/src/unResolve/index.ts (1)
packages/unuse/src/_framework/index.ts (1)
  • SupportedFramework (1-1)
🔇 Additional comments (14)
.changeset/thick-candles-doubt.md (1)

1-10: LGTM! Well-structured changeset documentation.

The changeset properly documents the feature addition with appropriate version bumps and clear description.

packages/unuse/src/unRefElement/index.ts (1)

27-29: LGTM! Consistent framework fallback implementation.

The change properly implements the new 'none' fallback pattern, ensuring the framework variable is always defined and type-safe.

packages/unuse/src/unResolve/index.spec.ts (4)

15-15: LGTM! Test correctly updated for new framework fallback.

The test properly uses 'none' instead of undefined, aligning with the type system changes.


23-23: LGTM! Consistent test update.


34-34: LGTM! Consistent test update.


44-44: LGTM! Consistent test update.

packages/unuse/src/tryOnScopeDispose/index.ts (1)

26-29: LGTM! Improved clarity with explicit framework comparison.

The change from a falsy check to explicit 'none' comparison improves code clarity and aligns with the new type-safe framework handling pattern.

packages/unuse/src/_framework/index.ts (3)

1-1: LGTM! Type extension properly adds 'none' option.

The SupportedFramework type correctly includes the new 'none' fallback option.


46-48: LGTM! Proper handling of 'none' case.

The initFrameworkImport function correctly handles the 'none' case by returning early without attempting to import any framework.


104-106: ```shell
#!/bin/bash

Search for globalThis.UNUSE_FRAMEWORK usages

rg "UNUSE_FRAMEWORK" -n packages/unuse/src


</details>
<details>
<summary>packages/unuse/src/toUnSignal/index.ts (1)</summary>

`47-52`: **LGTM! Clean framework fallback implementation.**

The changes correctly implement the 'none' fallback pattern by:
- Ensuring `framework` always has a value by defaulting to `'none'`
- Explicitly handling the `'none'` case to return a plain `unSignal`
- Using appropriate ESLint disable comment for the necessary condition check

This provides consistent, framework-agnostic behavior when no specific framework is configured.

</details>
<details>
<summary>packages/unuse/src/unAccess/index.ts (1)</summary>

`71-121`: **Excellent refactoring with improved framework detection.**

The changes enhance the `isUnRef` function by:
- Implementing consistent framework defaulting to `'none'`
- Using framework-specific detection methods (`Angular.isSignal`, `Vue.isRef`, etc.)
- Properly structuring the switch statement with explicit cases
- Adding appropriate `'none'` case handling

This makes the framework detection more reliable and maintainable while preserving the original detection logic.

</details>
<details>
<summary>packages/unuse/src/unResolve/index.ts (2)</summary>

`19-19`: **Improved type safety by constraining framework type.**

Removing `undefined` from the `TFramework` constraint improves type safety by ensuring it's always a valid `SupportedFramework` value. This aligns with the new framework fallback pattern where `'none'` serves as the explicit default.

---

`99-103`: **Consistent framework defaulting implementation.**

The framework option now follows the same pattern as other files in the codebase:
- Defaults to `'none'` when `globalThis.__UNUSE_FRAMEWORK__` is falsy
- Maintains type safety with proper casting
- Includes appropriate ESLint disable comment

This ensures predictable behavior across the entire framework detection system.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

< 8000 div data-view-component="true" class="comment-reactions js-reactions-container js-reaction-buttons-container social-reactions reactions-container d-flex">
@Shinigami92 Shinigami92 force-pushed the feat-framework-fallback-eq-none branch from 00b5721 to 3ffae19 Compare June 24, 2025 15:13
Copy link
Contributor
@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed 3ffae19 in 1 minute and 29 seconds. Click for details.
  • Reviewed 332 lines of code in 8 files
  • Skipped 0 files when reviewing.
  • Skipped posting 10 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/thick-candles-doubt.md:9
  • Draft comment:
    Consider clarifying in the commit message whether this change is a feature or a fix; the title is ambiguous.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
2. packages/unuse/src/_framework/index.ts:11
  • Draft comment:
    Good use of 'Exclude<SupportedFramework, "none">' to restrict framework initialization; this reduces misuse of the 'none' fallback.
  • Reason this comment was not posted:
    Confidence changes required: 10% <= threshold 50% None
3. packages/unuse/src/toUnSignal/index.ts:48
  • Draft comment:
    Repeated fallback logic (using globalThis.UNUSE_FRAMEWORK || 'none') appears in several files; consider abstracting this logic into a helper function for consistency and maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
4. packages/unuse/src/unResolve/index.ts:115
  • Draft comment:
    Overriding Angular signal's 'set' and 'update' methods is risky; consider safer synchronization approaches to avoid unexpected side effects.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. packages/unuse/src/unResolve/index.ts:142
  • Draft comment:
    Directly mutating the React state array (assigning to state[0] and overriding state[1]) is dangerous; this might bypass React's state management and could lead to unexpected behavior.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. packages/unuse/src/unResolve/index.ts:206
  • Draft comment:
    In the Solid branch, using an effect to call state[1](() => signal.get()) might be redundant; verify if this extra update is necessary or if a more direct syncing mechanism can be used.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
7. packages/unuse/src/unResolve/index.ts:227
  • Draft comment:
    In the default branch (for 'none'), returning either the raw signal or an unComputed value is acceptable, but ensure this behavior is well-documented so that users understand the fallback behavior when no framework is used.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 50% None
8. packages/unuse/src/unResolve/index.ts:70
  • Draft comment:
    Multiple '@ts-expect-error' comments indicate underlying type safety issues. Consider revisiting the type definitions to reduce these overrides if possible.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. packages/unuse/src/unResolve/index.spec.ts:15
  • Draft comment:
    Using an explicit framework 'none' in tests improves clarity and reproducibility compared to an undefined fallback.
  • Reason this comment was not posted:
    Confidence changes required: 10% <= threshold 50% None
10. .changeset/thick-candles-doubt.md:9
  • Draft comment:
    On line 9, the commit message includes an unusual mix of backticks and single quotes: feat: framework fallback 'none'. Please confirm if the intended formatting was to have the fallback value formatted as code (e.g. none`) or simply quoted (e.g. 'none').
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to confirm their intention regarding the formatting of a commit message. This violates the rule against asking the author to confirm their intention or to explain something. The comment does not provide a specific code suggestion or ask for a test to be written, which would be acceptable.

Workflow ID: wflow_ozfYDLqph8CizEJC

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@Shinigami92 Shinigami92 linked an issue Jun 24, 2025 that may be closed by this pull request
5 tasks
@Shinigami92 Shinigami92 requested a review from JounQin June 24, 2025 15:19
@Shinigami92 Shinigami92 merged commit a56cbed into main Jun 24, 2025
16 checks passed
@Shinigami92 Shinigami92 deleted the feat-framework-fallback-eq-none branch June 24, 2025 16:06
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.

Improve framework parameter API: implement 'framework: none' strategy
2 participants
0