Skip to content

refactor: migrate to unrouting#3931

Merged
BobbieGoede merged 3 commits intomainfrom
refactor/unrouting
Feb 13, 2026
Merged

refactor: migrate to unrouting#3931
BobbieGoede merged 3 commits intomainfrom
refactor/unrouting

Conversation

@danielroe
Copy link
Copy Markdown
Contributor

@danielroe danielroe commented Feb 13, 2026

🔗 Linked issue

resolves #2411

📚 Description

this migrates nuxtjs/i18n to use unrouting, which we're planning to use for nuxt fs routing, so we can keep things in sync

Summary by CodeRabbit

  • Dependencies

    • Integrated unrouting library as a new dependency to handle route segment parsing and Vue Router-compatible route transformation.
  • Configuration

    • Enhanced VSCode settings with a comprehensive list of i18n locale directory paths for improved locale file discovery and management.
  • Tests

    • Updated routing tests to use the new library and reflect changes in token type representation and route construction methodology.

@danielroe danielroe marked this pull request as ready for review February 13, 2026 13:46
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 13, 2026

Walkthrough

This pull request migrates route parsing functionality from a locally-maintained module to an external library called "unrouting". The changes remove the route-parsing.ts file (155 lines) containing a finite-state machine parser and replace it with imports from the unrouting package. The imports in src/pages.ts and test files are updated to use unrouting's parseSegment and toVueRouterSegment functions. Token type representations change from numeric codes to string enums (dynamic, static, catchall, optional). A dependency entry for unrouting (^0.1.5) is added to package.json. VSCode settings are expanded with i18n-ally locale paths configuration.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Detailed notes

Key areas requiring careful review:

  • External dependency vetting: The new "unrouting" library requires assessment for security, maintenance status, and long-term viability
  • Behavioral equivalence: Confirm that toVueRouterSegment produces identical routing behavior as the removed getRoutePath function, including edge cases around dynamic segments, catchalls, groups, and colon escaping
  • Token type semantics: Verify that string-based token types (dynamic, static, catchall, optional) map correctly to the previous numeric codes and don't introduce subtle bugs in downstream consumers
  • Complete removal: Ensure no other files depend on the removed route-parsing.ts functions or types before deletion
  • Test coverage validation: Review updated test cases to confirm they adequately exercise the new library's behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive The PR adds VSCode i18n-ally configuration and the unrouting dependency; only the VSCode settings change appears tangential to the core migration objective. Clarify whether the VSCode i18n-ally.localesPaths settings in .vscode/settings.json are necessary for the unrouting migration or represent a separate scope addition.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: migrate to unrouting' is concise and clearly identifies the main change—migrating from local route parsing to the external unrouting package.
Linked Issues check ✅ Passed The PR successfully migrates from local route-parsing implementation to the unrouting package, addressing issue #2411's objective to use parseSegment and getRoutePath for implementation synchronization.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/unrouting

No actionable comments were generated in the recent review. 🎉


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@BobbieGoede BobbieGoede left a comment

Choose a reason for hiding this comment

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

Thanks! 🎉

@BobbieGoede BobbieGoede merged commit 9c798ad into main Feb 13, 2026
10 checks passed
@BobbieGoede BobbieGoede deleted the refactor/unrouting branch February 13, 2026 14:29
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.

Segment parser implementation syncing

2 participants