Commit e7af37b
fix: handle digits after separator in defaultCamelize (#301)
## Summary
- `defaultCamelize` regex `[_-][a-z]` only handled separators followed
by letters, leaving separators before digits untouched (e.g. `foo_00.js`
→ `foo_00` instead of `foo00`)
- Extended regex to `[_-][a-z0-9]` so underscores/hyphens before digits
are also removed during camelization
- Added test fixture `foo_00.js` and assertions covering this edge case
across all caseStyle modes
## Test plan
- [x] Existing `file_loader.test.js` caseStyle tests pass with new
fixture
- [x] New test case `should handle separator before digits correctly`
verifies `Foo00` is set and `Foo_00` is not
- [x] Full test suite passes (the 1 flaky timeout in
`load_service.test.js` is a pre-existing parallel race condition)
🤖 Generated with [Claude Code](https://claude.ai/code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved camelization so identifiers with separators
(underscores/dashes) followed by digits are transformed correctly (e.g.,
separator+digits become contiguous capitalized segments).
* **Tests**
* Added tests verifying correct handling of separator-before-digit cases
across multiple naming styles.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>1 parent e8bb315 commit e7af37b
File tree
3 files changed
+23
-1
lines changed- lib/loader
- test
- fixtures/load_dirs/camelize
- loader
3 files changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
| |||
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
| 283 | + | |
282 | 284 | | |
283 | 285 | | |
284 | 286 | | |
| |||
293 | 295 | | |
294 | 296 | | |
295 | 297 | | |
| 298 | + | |
296 | 299 | | |
297 | 300 | | |
298 | 301 | | |
| |||
312 | 315 | | |
313 | 316 | | |
314 | 317 | | |
| 318 | + | |
315 | 319 | | |
316 | 320 | | |
317 | 321 | | |
| |||
340 | 344 | | |
341 | 345 | | |
342 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
343 | 361 | | |
344 | 362 | | |
345 | 363 | | |
| |||
0 commit comments