fix: handle digits after separator in defaultCamelize#301
fix: handle digits after separator in defaultCamelize#301jerryliang64 merged 2 commits intoeggjs:5.xfrom
Conversation
The regex in defaultCamelize only matched `[_-][a-z]`, so separators followed by digits (e.g. `foo_00.js`) were left untouched, producing `foo_00` instead of the expected `foo00`. Extend the regex to `[_-][a-z0-9]` so that underscores and hyphens before digits are also removed during camelization. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a bug in the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change refines filename camelization to include digits after separators when capitalizing (e.g., Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request addresses an issue in defaultCamelize where separators followed by digits were not handled correctly. The fix extends the regular expression to include digits, ensuring proper camelization for filenames like foo_00.js. The change is accompanied by comprehensive tests, including a new test fixture and assertions for various caseStyle options, which validate the fix effectively. The implementation is correct and the added tests are thorough.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/loader/file_loader.test.js`:
- Line 361: Remove the redundant bracket-notation assertion on the target
object: delete the line containing assert(!target['Foo_00']) so only the
existing assert(!target.Foo_00) remains; this removes the duplicate check and
resolves the ESLint dot-notation violation in file_loader.test.js.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 044b858b-de70-43d1-91c9-016cf194e376
📒 Files selected for processing (3)
lib/loader/file_loader.jstest/fixtures/load_dirs/camelize/foo_00.jstest/loader/file_loader.test.js
…tation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
defaultCamelizeregex[_-][a-z]only handled separators followed by letters, leaving separators before digits untouched (e.g.foo_00.js→foo_00instead offoo00)[_-][a-z0-9]so underscores/hyphens before digits are also removed during camelizationfoo_00.jsand assertions covering this edge case across all caseStyle modesTest plan
file_loader.test.jscaseStyle tests pass with new fixtureshould handle separator before digits correctlyverifiesFoo00is set andFoo_00is notload_service.test.jsis a pre-existing parallel race condition)🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests