Commit 25cde38
## Summary
Follow-up to [PR
#3232](#3232). The Pro
migration base-package reference scan now covers TypeScript 4.7 `.mts` /
`.cts` source files (and their `.d.mts` / `.d.cts` declaration
counterparts), matching the existing `.mjs` / `.cjs` coverage.
- Adds `mts` and `cts` to
`ReactOnRails::ProMigration::JS_SOURCE_EXTENSIONS`. This shared constant
drives both `react_on_rails:doctor`'s stale-reference scanner and the
Pro generator's import rewriter, so the doctor warns on and the
generator can rewrite the new extensions in one step.
- `**/*.mts` / `**/*.cts` globs naturally cover `*.d.mts` / `*.d.cts`
declaration files, same as `.ts` covers `.d.ts`.
- Existing `react-on-rails-pro` false-positive guards (the
`(?:/[^'"]*)?['"]` lookahead in every reference pattern) carry over
unchanged.
Fixes #3250.
## Test plan
- [x] `bundle exec rspec spec/lib/react_on_rails/doctor_spec.rb -e
"check_base_package_references"` — 34 examples, 0 failures (includes 2
new specs)
- [x] `bundle exec rspec
spec/react_on_rails/generators/pro_generator_spec.rb` — 122 examples, 0
failures
- [x] `bundle exec rubocop lib/react_on_rails/pro_migration.rb
spec/lib/react_on_rails/doctor_spec.rb` — no offenses
- [x] New positive spec: stale `react-on-rails` references in `.mts`,
`.cts`, `.d.mts`, and `.d.cts` files all surface as warnings
- [x] New negative spec: `.mts`/`.cts`/`.d.mts` files referencing
`react-on-rails-pro` are not flagged
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: expands file-extension globbing for Pro migration/doctor
scans and adds regression tests; no runtime rendering or
security-sensitive logic changes.
>
> **Overview**
> Extends the Pro migration/`react_on_rails:doctor` base-package
reference scan to include TypeScript 4.7 module extensions
`*.mts`/`*.cts` (including `*.d.mts`/`*.d.cts` via globbing), matching
existing `*.mjs`/`*.cjs` coverage.
>
> Adds RSpec coverage to ensure `.mts`/`.cts` files with stale
`react-on-rails` references are flagged and that correct
`react-on-rails-pro` references are not, and documents the fix in
`CHANGELOG.md`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a1bc6f9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Development tools now scan additional TypeScript module formats
(.mts/.cts) and their declarations.
* **Documentation**
* Changelog updated to reflect expanded TypeScript module coverage.
* **Tests**
* Test coverage extended to validate scanning and warnings for the new
TypeScript module formats.
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/shakacode/react_on_rails/pull/3334?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c7a5193 commit 25cde38
3 files changed
Lines changed: 59 additions & 1 deletion
File tree
- react_on_rails
- lib/react_on_rails
- spec/lib/react_on_rails
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3841 | 3841 | | |
3842 | 3842 | | |
3843 | 3843 | | |
| 3844 | + | |
| 3845 | + | |
| 3846 | + | |
| 3847 | + | |
| 3848 | + | |
| 3849 | + | |
| 3850 | + | |
| 3851 | + | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
| 3862 | + | |
| 3863 | + | |
| 3864 | + | |
| 3865 | + | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
| 3869 | + | |
| 3870 | + | |
| 3871 | + | |
| 3872 | + | |
| 3873 | + | |
| 3874 | + | |
| 3875 | + | |
| 3876 | + | |
| 3877 | + | |
| 3878 | + | |
| 3879 | + | |
| 3880 | + | |
| 3881 | + | |
| 3882 | + | |
| 3883 | + | |
| 3884 | + | |
| 3885 | + | |
| 3886 | + | |
| 3887 | + | |
| 3888 | + | |
| 3889 | + | |
| 3890 | + | |
| 3891 | + | |
| 3892 | + | |
| 3893 | + | |
| 3894 | + | |
| 3895 | + | |
| 3896 | + | |
| 3897 | + | |
| 3898 | + | |
| 3899 | + | |
| 3900 | + | |
3844 | 3901 | | |
3845 | 3902 | | |
3846 | 3903 | | |
| |||
0 commit comments