react_on_rails 15.0.0.alpha.1 → 15.0.0.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +479 -81
  3. data/CONTRIBUTING.md +61 -47
  4. data/Gemfile.development_dependencies +1 -1
  5. data/Gemfile.lock +4 -4
  6. data/KUDOS.md +22 -1
  7. data/NEWS.md +48 -48
  8. data/PROJECTS.md +45 -40
  9. data/README.md +24 -16
  10. data/SUMMARY.md +62 -52
  11. data/eslint.config.ts +213 -0
  12. data/knip.ts +100 -0
  13. data/lib/generators/USAGE +1 -1
  14. data/lib/generators/react_on_rails/dev_tests_generator.rb +4 -8
  15. data/lib/generators/react_on_rails/templates/.eslintrc +1 -1
  16. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.module.css +2 -2
  17. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorldServer.js +1 -1
  18. data/lib/generators/react_on_rails/templates/base/base/app/javascript/packs/registration.js.tt +1 -1
  19. data/lib/generators/react_on_rails/templates/base/base/config/shakapacker.yml +1 -1
  20. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/reducers/helloWorldReducer.js +1 -1
  21. data/lib/react_on_rails/configuration.rb +81 -12
  22. data/lib/react_on_rails/controller.rb +4 -2
  23. data/lib/react_on_rails/engine.rb +1 -3
  24. data/lib/react_on_rails/helper.rb +184 -56
  25. data/lib/react_on_rails/locales/base.rb +7 -1
  26. data/lib/react_on_rails/packer_utils.rb +23 -3
  27. data/lib/react_on_rails/packs_generator.rb +84 -11
  28. data/lib/react_on_rails/prerender_error.rb +10 -2
  29. data/lib/react_on_rails/react_component/render_options.rb +39 -3
  30. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +6 -2
  31. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +4 -2
  32. data/lib/react_on_rails/utils.rb +67 -23
  33. data/lib/react_on_rails/version.rb +1 -1
  34. data/lib/react_on_rails/version_checker.rb +34 -23
  35. data/lib/tasks/assets.rake +1 -1
  36. data/react_on_rails.gemspec +2 -2
  37. data/tsconfig.eslint.json +6 -0
  38. data/tsconfig.json +10 -6
  39. metadata +8 -7
data/PROJECTS.md CHANGED
@@ -1,58 +1,63 @@
1
1
  # Projects using React on Rails
2
2
 
3
- [Click here](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com/) for a search for public sites using React on Rails.
3
+ [Click here](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com/) for a search for public sites using React on Rails.
4
4
 
5
5
  Public Sites Using React on Rails:
6
6
 
7
7
  March 27, 2018: 2126<br>
8
8
  April 11, 2018: 2138
9
9
 
10
- *Please support the project by [emailing Justin Gordon](mailto:justin@shakacode.com) of any projects, yours or others, that use React on Rails. You can confirm a project uses React on Rails as the source will contain **`js-react-on-rails`**.*
10
+ _Please support the project by [emailing Justin Gordon](mailto:justin@shakacode.com) of any projects, yours or others, that use React on Rails. You can confirm a project uses React on Rails as the source will contain **`js-react-on-rails`**._
11
11
 
12
12
  ## Commercial Products Live
13
- * **[Hawaii Chee](https://www.hawaiichee.com/)**, the signature product of [ShakaCode](http://www.shakacode.com), which is a vacation rental site focusing on Hawaii.
14
- * **[RedFlagDeals](https://www.redflagdeals.com/)**, Canadian shopping site.
15
- * **[YourMechanic](https://www.yourmechanic.com/)**, home calls for mechanics.
16
- * **[Suntransfers](https://www.suntransfers.com/)**, airport car rides site.
17
- * **[Decanter](http://www.decanter.com/)**, wine site.
18
- * **[LocalWise](https://www.localwise.com/)**, local job site.
19
- * **[Ellevest](https://www.ellevest.com/)**, investments for women.
20
- * **[OppenheimerFunds](https://www.oppenheimerfunds.com/)**, investment site.
21
- * **[KissKissBankBank](https://www.kisskissbankbank.com/)**, large French crowdfunding platform.
22
- * **[HVMN](https://hvmn.com)**: Web ecommerce site for "biohacking" products.
23
- * **[GuavaPass](https://guavapass.com/)**: Coaching client of [ShakaCode](http://www.shakacode.com) and React on Rails fan!
24
- * **[Pivotal Tracker](http://www.pivotaltracker.com/)**: The first (and most-loved) agile project management tool built on Rails. React on Rails has greatly simplified integration and workflow for our React components in Rails!
25
- * **[Estately](https://www.estately.com)**: Home search.
26
- * **[Blink Inc](https://www.blinkinc.com)**: Website and more built by [ShakaCode](http://www.shakacode.com).
27
- * **[Madrone Analytics](http://madroneco.com/)**: The original client of [ShakaCode](http://www.shakacode.com) that led to the development of React on Rails, as described in [Fast Rich Client Rails Development With Webpack and the ES6 Transpiler](http://www.railsonmaui.com/blog/2014/10/03/integrating-webpack-and-the-es6-transpiler-into-an-existing-rails-project/).
28
- * **[Deliveroo](https://deliveroo.co.uk/)**: The leading food delivery site in Europe has gone live with React on Rails, with multi-lingual JavaScript support!
29
- ![2016-05-03_19-18-34](https://cloud.githubusercontent.com/assets/1118459/15027253/91fd151a-11de-11e6-93e3-720518995fe0.png)
30
- * **[Airgoat](https://airgoat.com/)**: Marketplace for sneakers.
31
- * **[Apprentus](https://www.apprentus.com/)**: A marketplace to find the best private teachers. Using react-on-rails from the homepage to infinity!
32
- * **[Confident Financial Solutions](https://www.mycfsapp.com/)**: Auto Repair Financing to help people get back on the road and back to life.
33
- * **[Flyhomes](https://www.flyhomes.com/)**: Real estate brokerage service that awards frequent flyer miles.
34
- * **[Undeveloped](https://undeveloped.com/)**: Buy and sell domain names. ![image](https://cloud.githubusercontent.com/assets/1118459/19623703/7c6d63d0-9870-11e6-83f2-8b83ca49daa9.png)
35
- * **[Foxford.ru](http://foxford.ru/)**: Online School ![2016-12-17_13-23-21](https://cloud.githubusercontent.com/assets/1118459/21290377/1adacdf2-c45c-11e6-97c1-f726ab749b2d.png)
36
- * **[CareerBuilder for Employers](https://hiring.careerbuilder.com/)**: CareerBuilder's marketing/ecommerce website. We've integrated React on Rails and have deployed the application via Cloud 66, and are busy integrating this into other projects!
37
- * **[first](https://first.io/)**: Data-driven Relational Marketing for Real Estate.
13
+
14
+ - **[Hawaii Chee](https://www.hawaiichee.com/)**, the signature product of [ShakaCode](http://www.shakacode.com), which is a vacation rental site focusing on Hawaii.
15
+ - **[RedFlagDeals](https://www.redflagdeals.com/)**, Canadian shopping site.
16
+ - **[YourMechanic](https://www.yourmechanic.com/)**, home calls for mechanics.
17
+ - **[Suntransfers](https://www.suntransfers.com/)**, airport car rides site.
18
+ - **[Decanter](http://www.decanter.com/)**, wine site.
19
+ - **[LocalWise](https://www.localwise.com/)**, local job site.
20
+ - **[Ellevest](https://www.ellevest.com/)**, investments for women.
21
+ - **[OppenheimerFunds](https://www.oppenheimerfunds.com/)**, investment site.
22
+ - **[KissKissBankBank](https://www.kisskissbankbank.com/)**, large French crowdfunding platform.
23
+ - **[HVMN](https://hvmn.com)**: Web ecommerce site for "biohacking" products.
24
+ - **[GuavaPass](https://guavapass.com/)**: Coaching client of [ShakaCode](http://www.shakacode.com) and React on Rails fan!
25
+ - **[Pivotal Tracker](http://www.pivotaltracker.com/)**: The first (and most-loved) agile project management tool built on Rails. React on Rails has greatly simplified integration and workflow for our React components in Rails!
26
+ - **[Estately](https://www.estately.com)**: Home search.
27
+ - **[Blink Inc](https://www.blinkinc.com)**: Website and more built by [ShakaCode](http://www.shakacode.com).
28
+ - **[Madrone Analytics](http://madroneco.com/)**: The original client of [ShakaCode](http://www.shakacode.com) that led to the development of React on Rails, as described in [Fast Rich Client Rails Development With Webpack and the ES6 Transpiler](http://www.railsonmaui.com/blog/2014/10/03/integrating-webpack-and-the-es6-transpiler-into-an-existing-rails-project/).
29
+ - **[Deliveroo](https://deliveroo.co.uk/)**: The leading food delivery site in Europe has gone live with React on Rails, with multi-lingual JavaScript support!
30
+ ![2016-05-03_19-18-34](https://cloud.githubusercontent.com/assets/1118459/15027253/91fd151a-11de-11e6-93e3-720518995fe0.png)
31
+ - **[Airgoat](https://airgoat.com/)**: Marketplace for sneakers.
32
+ - **[Apprentus](https://www.apprentus.com/)**: A marketplace to find the best private teachers. Using React on Rails from the homepage to infinity!
33
+ - **[Confident Financial Solutions](https://www.mycfsapp.com/)**: Auto Repair Financing to help people get back on the road and back to life.
34
+ - **[Flyhomes](https://www.flyhomes.com/)**: Real estate brokerage service that awards frequent flyer miles.
35
+ - **[Undeveloped](https://undeveloped.com/)**: Buy and sell domain names. ![image](https://cloud.githubusercontent.com/assets/1118459/19623703/7c6d63d0-9870-11e6-83f2-8b83ca49daa9.png)
36
+ - **[Foxford.ru](http://foxford.ru/)**: Online School ![2016-12-17_13-23-21](https://cloud.githubusercontent.com/assets/1118459/21290377/1adacdf2-c45c-11e6-97c1-f726ab749b2d.png)
37
+ - **[CareerBuilder for Employers](https://hiring.careerbuilder.com/)**: CareerBuilder's marketing/ecommerce website. We've integrated React on Rails and have deployed the application via Cloud 66, and are busy integrating this into other projects!
38
+ - **[first](https://first.io/)**: Data-driven Relational Marketing for Real Estate.
38
39
 
39
40
  ## Open Source Projects Live
40
- * [github.com/empirical-org/Empirical-Core](https://github.com/empirical-org/Empirical-Core): [Quill.org](https://quill.org/) Provides free tools to make your students better writers.
41
- * **[Coderwall](https://coderwall.com/)**: The latest development and design tips, tools, and projects from our developer community. Source at [github.com/coderwall/coderwall-next](https://github.com/coderwall/coderwall-next)
42
- * [department-of-veterans-affairs/caseflow](https://github.com/department-of-veterans-affairs/caseflow): Caseflow is a web application that enables the tracking and processing of appealed claims at the Board of Veterans' Appeals.
43
41
 
44
- ## Demos and Tutorials
45
- * [reactrails.com](http://www.reactrails.com), source code [github.com/shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/)
46
- * [Relay Rails Blog](https://github.com/gauravtiwari/relay-rails-blog): Tutorial to learn Relay with Rails.
47
- * [Hot Module Replacement with react_on_rails](https://medium.com/@hrishio/lesson-5-hot-module-replacement-for-react-in-rails-using-the-react-on-rails-gem-643c5b01f3d7#.ehevxok16) : Step-by-step tutorial for a quick basic set up of hot asset reloading with HMR in a Rails 5 app. [Code on Github](https://github.com/learnetto/calreact-hmr).....
42
+ - [github.com/empirical-org/Empirical-Core](https://github.com/empirical-org/Empirical-Core): [Quill.org](https://quill.org/) Provides free tools to make your students better writers.
43
+ - **[Coderwall](https://coderwall.com/)**: The latest development and design tips, tools, and projects from our developer community. Source at [github.com/coderwall/coderwall-next](https://github.com/coderwall/coderwall-next)
44
+ - [department-of-veterans-affairs/caseflow](https://github.com/department-of-veterans-affairs/caseflow): Caseflow is a web application that enables the tracking and processing of appealed claims at the Board of Veterans' Appeals.
48
45
 
49
- ## Per Github.
46
+ ## Demos and Tutorials
50
47
 
51
- --------
48
+ - [reactrails.com](http://www.reactrails.com), source code [github.com/shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/)
49
+ - [Relay Rails Blog](https://github.com/gauravtiwari/relay-rails-blog): Tutorial to learn Relay with Rails.
50
+ - [Hot Module Replacement with react_on_rails](https://medium.com/@hrishio/lesson-5-hot-module-replacement-for-react-in-rails-using-the-react-on-rails-gem-643c5b01f3d7#.ehevxok16) : Step-by-step tutorial for a quick basic set up of hot asset reloading with HMR in a Rails 5 app. [Code on Github](https://github.com/learnetto/calreact-hmr).....
52
51
 
53
52
  ## Projects Based on React on Rails
54
53
 
55
- * [github.com/Limenius/symfony-react-sandbox](https://github.com/Limenius/symfony-react-sandbox)
56
- * [github.com/tswayne/react-helper](https://github.com/tswayne/react-helper)
57
- * [github.com/KissKissBankBank/kitten](https://github.com/KissKissBankBank/kitten)
58
- * [github.com/sharetribe/sharetribe](https://github.com/sharetribe/sharetribe): Open source marketplace platform.
54
+ - [github.com/Limenius/symfony-react-sandbox](https://github.com/Limenius/symfony-react-sandbox)
55
+ - [github.com/tswayne/react-helper](https://github.com/tswayne/react-helper)
56
+ - [github.com/KissKissBankBank/kitten](https://github.com/KissKissBankBank/kitten)
57
+ - [github.com/sharetribe/sharetribe](https://github.com/sharetribe/sharetribe): Open source marketplace platform.
58
+ - [GitHub search for repos using `react_on_rails`](https://github.com/search?q=gem+react_on_rails&ref=advsearch&type=repositories&utf8=%E2%9C%93) (may include some false positives)
59
+
60
+ ## Reverse dependencies
61
+
62
+ - [Gems depending on `react_on_rails`](https://rubygems.org/gems/react_on_rails/reverse_dependencies)
63
+ - [NPM packages depending on `react-on-rails`](https://www.npmjs.com/browse/depended/react-on-rails)
data/README.md CHANGED
@@ -17,21 +17,24 @@
17
17
  [![Linting](https://github.com/shakacode/react_on_rails/actions/workflows/lint-js-and-ruby.yml/badge.svg)](https://github.com/shakacode/react_on_rails/actions/workflows/lint-js-and-ruby.yml)
18
18
 
19
19
  # News
20
- * [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/) supports the latest features of React 18, including [React Server Components](https://react.dev/reference/rsc/server-components) and [streaming](https://react.dev/reference/react-dom/server/renderToPipeableStream). Contact [Justin Gordon](mailto:justin@shakacode.com) for more information.
21
- * ShakaCode now maintains the official successor to `rails/webpacker`, [`shakapacker`](https://github.com/shakacode/shakapacker).
22
- * Project is updated to support Rails 7 and Shakapacker v6+!
23
20
 
24
- -----
21
+ - [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/) supports the latest features of React 18, including [React Server Components](https://react.dev/reference/rsc/server-components) and [streaming](https://react.dev/reference/react-dom/server/renderToPipeableStream). Contact [Justin Gordon](mailto:justin@shakacode.com) for more information.
22
+ - ShakaCode now maintains the official successor to `rails/webpacker`, [`shakapacker`](https://github.com/shakacode/shakapacker).
23
+ - Project is updated to support Rails 7 and Shakapacker v6+!
25
24
 
26
- *These are the docs for React on Rails 13. To see the older docs: [v12](https://github.com/shakacode/react_on_rails/tree/12.6.0) and [v11](https://github.com/shakacode/react_on_rails/tree/11.3.0).*
25
+ ---
26
+
27
+ _These are the docs for React on Rails 14. To see the older docs and code: [v13](https://github.com/shakacode/react_on_rails/tree/13.4.0), [v12](https://github.com/shakacode/react_on_rails/tree/12.6.0), and [v11](https://github.com/shakacode/react_on_rails/tree/11.3.0)._
27
28
 
28
29
  # About
30
+
29
31
  React on Rails integrates Rails with (server rendering of) [React](https://github.com/facebook/react).
30
32
 
31
- This project is maintained by [ShakaCode](https://www.shakacode.com).
33
+ This project is maintained by [ShakaCode](https://www.shakacode.com).
32
34
 
33
35
  ## ShakaCode Upgrade Support
34
- ShakaCode focuses on helping Ruby on Rails teams better use React and Webpack. We can upgrade your project and improve your development and customer experiences, allowing you to focus on building new features or fixing bugs instead.
36
+
37
+ ShakaCode focuses on helping Ruby on Rails teams better use React and Webpack. We can upgrade your project and improve your development and customer experiences, allowing you to focus on building new features or fixing bugs instead.
35
38
 
36
39
  For an overview of working with us, see our [Client Engagement Model](https://www.shakacode.com/blog/client-engagement-model/) article and [how we bill for time](https://www.shakacode.com/blog/shortcut-jira-trello-github-toggl-time-and-task-tracking/).
37
40
 
@@ -40,7 +43,8 @@ We also specialize in helping development teams lower infrastructure and CI cost
40
43
  If you think ShakaCode can help your project, [click here](https://meetings.hubspot.com/justingordon/30-minute-consultation) to book a call with [Justin Gordon](mailto:justin@shakacode.com), the creator of React on Rails.
41
44
 
42
45
  ## React on Rails Pro
43
- Are you interested in optimizing your webpack setup for React on Rails, including code splitting with [react-router](https://github.com/ReactTraining/react-router#readme) and [loadable-components](https://loadable-components.com/) with server-side rendering for SEO and hot-reloading for developers?
46
+
47
+ Are you interested in optimizing your Webpack setup for React on Rails, including code splitting with [React Router](https://reactrouter.com/) and [loadable-components](https://loadable-components.com/) with server-side rendering for SEO and hot-reloading for developers?
44
48
  We did this for Popmenu, [lowering Heroku costs 20-25% while getting a 73% decrease in average response times](https://www.shakacode.com/recent-work/popmenu/). Several years later, Popmenu serves tens of millions of SSR requests daily with React on Rails Pro.
45
49
 
46
50
  If you're interested, read more about [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/) and [book a call](https://meetings.hubspot.com/justingordon/30-minute-consultation).
@@ -60,10 +64,10 @@ Given that `shakacode/shakapacker` gem already provides basic React integration,
60
64
  1. Automatic configuration of what bundles are added to the page based on what React components are on the page. This results in faster browser loading time via smaller bundle sizes.
61
65
  1. Keep up with the latest changes in different versions of React. React 18 is supported.
62
66
  1. Easy passing of props directly from your Rails view to your React components rather than having your Rails view load and then make a separate request to your API.
63
- Tight integration with [shakapacker](https://github.com/shakacode/shakapacker) (or its predecessor [rails/webpacker](https://github.com/rails/webpacker)).
67
+ Tight integration with [shakapacker](https://github.com/shakacode/shakapacker) (or its predecessor [rails/webpacker](https://github.com/rails/webpacker)).
64
68
  1. Server-Side Rendering (SSR), often used for SEO crawler indexing and UX performance.
65
69
  1. [Automated optimized entry-point creation and bundle inclusion when placing a component on a page. With this feature, you no longer need to configure `javascript_pack_tags` and `stylesheet_pack_tags` on your layouts based on what’s shown. “It just works!”](https://www.shakacode.com/react-on-rails/docs/guides/file-system-based-automated-bundle-generation/)
66
- 1. [Redux](https://github.com/reactjs/redux) and [React Router](https://github.com/ReactTraining/react-router#readme) integration with server-side-rendering.
70
+ 1. [Redux](https://redux.js.org/) and [React Router](https://reactrouter.com/) integration with server-side-rendering.
67
71
  1. [Internationalization (I18n) and (localization)](https://www.shakacode.com/react-on-rails/docs/guides/i18n)
68
72
  1. A supportive community. This [web search shows how live public sites are using React on Rails](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com+depth%3Aall/).
69
73
  1. [ReScript Support](https://github.com/shakacode/rescript-react-on-rails-example).
@@ -71,14 +75,16 @@ Tight integration with [shakapacker](https://github.com/shakacode/shakapacker) (
71
75
  See [Rails/Webpacker React Integration Options](https://www.shakacode.com/react-on-rails/docs/guides/rails-webpacker-react-integration-options) for comparisons to other gems.
72
76
 
73
77
  ## Online demo
74
- * See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) for an example of a live implementation and code.
75
- * A deployed version of the project `spec/dummy`, which demonstrates several uses of `react_on_rails`, will soon be available on [Control Plane through this link](https://ror-spec-dummy.reactrails.com/)
78
+
79
+ - See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) for an example of a live implementation and code.
80
+ - A deployed version of the project `spec/dummy`, which demonstrates several uses of `react_on_rails`, will soon be available on [Control Plane through this link](https://ror-spec-dummy.reactrails.com/)
76
81
 
77
82
  ## ShakaCode Forum Premium Content
83
+
78
84
  _Requires creating a free account._
79
85
 
80
- * [How to use different versions of a file for client and server rendering](https://forum.shakacode.com/t/how-to-use-different-versions-of-a-file-for-client-and-server-rendering/1352)
81
- * [How to conditionally render server side based on the device type](https://forum.shakacode.com/t/how-to-conditionally-render-server-side-based-on-the-device-type/1473)
86
+ - [How to use different versions of a file for client and server rendering](https://forum.shakacode.com/t/how-to-use-different-versions-of-a-file-for-client-and-server-rendering/1352)
87
+ - [How to conditionally render server side based on the device type](https://forum.shakacode.com/t/how-to-conditionally-render-server-side-based-on-the-device-type/1473)
82
88
 
83
89
  ## Prerequisites
84
90
 
@@ -86,12 +92,13 @@ Ruby on Rails >=5, rails/webpacker >= 4.2 or shakapacker > 6, Ruby >= 3.0.0
86
92
 
87
93
  # Support
88
94
 
89
- * [Click to join **React + Rails Slack**](https://reactrails.slack.com/join/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE).
95
+ - [Click to join **React + Rails Slack**](https://reactrails.slack.com/join/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE).
96
+
90
97
  - [**Subscribe**](https://app.mailerlite.com/webforms/landing/l1d9x5) for announcements of new releases of React on Rails and of our latest [blog articles](https://blog.shakacode.com) and tutorials.
91
98
  - [Discussions](https://github.com/shakacode/react_on_rails/discussions): Post your questions regarding React on Rails
92
99
  - **[forum.shakacode.com](https://forum.shakacode.com)**: Other discussions
93
100
  - **[@railsonmaui on Twitter](https://twitter.com/railsonmaui)**
94
- - *See [NEWS.md](https://github.com/shakacode/react_on_rails/tree/master/NEWS.md) for more notes over time.*
101
+ - _See [NEWS.md](https://github.com/shakacode/react_on_rails/tree/master/NEWS.md) for more notes over time._
95
102
  - See [Projects](https://github.com/shakacode/react_on_rails/tree/master/PROJECTS.md) using and [KUDOS](https://github.com/shakacode/react_on_rails/tree/master/KUDOS.md) for React on Rails. Please submit yours! Please edit either page or [email us](mailto:contact@shakacode.com) and we'll add your info. We also **love stars** as it helps us attract new users and contributors.
96
103
 
97
104
  ## Contributing
@@ -99,6 +106,7 @@ Ruby on Rails >=5, rails/webpacker >= 4.2 or shakapacker > 6, Ruby >= 3.0.0
99
106
  Bug reports and pull requests are welcome. To get started, see [Contributing](https://github.com/shakacode/react_on_rails/tree/master/CONTRIBUTING.md) and the [list of help wanted issues](https://github.com/shakacode/react_on_rails/labels/contributions%3A%20up%20for%20grabs%21).
100
107
 
101
108
  # Work with Us
109
+
102
110
  ShakaCode is **[hiring passionate software engineers](http://www.shakacode.com/career)** to work on our projects, including [HiChee](https://hichee.com)!
103
111
 
104
112
  # License
data/SUMMARY.md CHANGED
@@ -6,73 +6,83 @@ Here is the new link:
6
6
 
7
7
  **[React on Rails Documentation Link](https://www.shakacode.com/react-on-rails/docs/)**
8
8
 
9
- -----
9
+ ---
10
10
 
11
11
  ## **OLD DOCS BELOW**
12
- + [Home](./README.md)
12
+
13
+ - [Home](./README.md)
13
14
 
14
15
  ## **Basics**
15
- + [React on Rails Basic Installation Tutorial](./docs/tutorial.md)
16
- + [Webpack Configuration](./docs/guides/webpack-configuration.md)
17
- + [How React on Rails Works](docs/outdated/how-react-on-rails-works.md)
18
- + [Client vs. Server Rendering](./docs/guides/client-vs-server-rendering.md)
19
- + [React Server Rendering](./docs/guides/react-server-rendering.md)
20
- + [🚀 Next-Gen Server Rendering: Streaming with React 18's Latest APIs](./docs/guides/streaming-server-rendering.md)
21
- + [Render-Functions and the RailsContext](docs/guides/render-functions-and-railscontext.md)
22
- + [Caching and Performance: React on Rails Pro](https://github.com/shakacode/react_on_rails/wiki).
23
- + [Deployment](docs/guides/deployment.md).
24
- + [React on Rails Internationalization (I18n, localization)](docs/guides/i18n.md)
25
- + [RSpec Test Helpers Configuration](docs/guides/rspec-configuration.md)
26
- + [Minitest Configuration](docs/guides/minitest-configuration.md)
27
- + [Upgrading React on Rails](docs/guides/upgrading-react-on-rails.md)
28
-
16
+
17
+ - [React on Rails Basic Installation Tutorial](./docs/tutorial.md)
18
+ - [Webpack Configuration](./docs/guides/webpack-configuration.md)
19
+ - [How React on Rails Works](docs/outdated/how-react-on-rails-works.md)
20
+ - [Client vs. Server Rendering](./docs/guides/client-vs-server-rendering.md)
21
+ - [React Server Rendering](./docs/guides/react-server-rendering.md)
22
+ - [🚀 Next-Gen Server Rendering: Streaming with React 18's Latest APIs](./docs/guides/streaming-server-rendering.md)
23
+ - [Render-Functions and the RailsContext](docs/guides/render-functions-and-railscontext.md)
24
+ - [Caching and Performance: React on Rails Pro](https://github.com/shakacode/react_on_rails/wiki).
25
+ - [Deployment](docs/guides/deployment.md).
26
+ - [React on Rails Internationalization (I18n, localization)](docs/guides/i18n.md)
27
+ - [RSpec Test Helpers Configuration](docs/guides/rspec-configuration.md)
28
+ - [Minitest Configuration](docs/guides/minitest-configuration.md)
29
+ - [Upgrading React on Rails](docs/guides/upgrading-react-on-rails.md)
30
+
29
31
  ## **API**
30
- - [View Helpers API](./docs/api/view-helpers-api.md)
31
- - [JavaScript API](./docs/api/javascript-api.md)
32
- - [Redux Store API](./docs/api/redux-store-api.md)
32
+
33
+ - [View Helpers API](./docs/api/view-helpers-api.md)
34
+ - [JavaScript API](./docs/api/javascript-api.md)
35
+ - [Redux Store API](./docs/api/redux-store-api.md)
33
36
 
34
37
  ## **Additional Details**
35
- + [Migration from react-rails](./docs/guides/migrating-from-react-rails.md)
36
- + [Generator Details](docs/guides/generator-details.md)
37
- + [Updating Dependencies](./docs/additional-reading/updating-dependencies.md)
38
- + [Manual Installation Overview](docs/outdated/manual-installation-overview.md)
39
- + [Upgrading from rails/webpacker v3 to v4](docs/additional-reading/upgrade-webpacker-v3-to-v4.md)
40
- + [Recommended Project Structure](docs/additional-reading/recommended-project-structure.md)
41
-
38
+
39
+ - [Migration from `react-rails`](./docs/guides/migrating-from-react-rails.md)
40
+ - [Generator Details](docs/guides/generator-details.md)
41
+ - [Updating Dependencies](./docs/additional-reading/updating-dependencies.md)
42
+ - [Manual Installation Overview](docs/outdated/manual-installation-overview.md)
43
+ - [Upgrading from rails/webpacker v3 to v4](docs/additional-reading/upgrade-webpacker-v3-to-v4.md)
44
+ - [Recommended Project Structure](docs/additional-reading/recommended-project-structure.md)
45
+
42
46
  ## **Rails**
43
- + [Rails Engine Integration](./docs/additional-reading/rails-engine-integration.md)
44
- + [Rails View Rendering from Inline JavaScript](./docs/additional-reading/rails_view_rendering_from_inline_javascript.md)
45
- + [Turbolinks](./docs/additional-reading/turbolinks.md)
46
- + [Converting a Rails 5 API only app to a Rails app](./docs/additional-reading/convert-rails-5-api-only-app.md)
47
+
48
+ - [Rails Engine Integration](./docs/additional-reading/rails-engine-integration.md)
49
+ - [Rails View Rendering from Inline JavaScript](./docs/additional-reading/rails_view_rendering_from_inline_javascript.md)
50
+ - [Turbolinks](./docs/additional-reading/turbolinks.md)
51
+ - [Converting a Rails 5 API only app to a Rails app](./docs/additional-reading/convert-rails-5-api-only-app.md)
47
52
 
48
53
  ## **Javascript**
49
- + [Node Dependencies, NPM, and Yarn](./docs/additional-reading/node-dependencies-and-npm.md)
50
- + [React Router](./docs/additional-reading/react-router.md)
51
- + [React & Redux](./docs/additional-reading/react-and-redux.md)
52
- + [Webpack Tips](./docs/additional-reading/webpack.md)
53
- + [Server Rendering Tips](./docs/additional-reading/server-rendering-tips.md)
54
- + [Code Splitting](docs/outdated/code-splitting.md)
55
- + [AngularJS Integration and Migration to React on Rails](./docs/additional-reading/angular-js-integration-migration.md)
54
+
55
+ - [Node Dependencies, NPM, and Yarn](./docs/additional-reading/node-dependencies-and-npm.md)
56
+ - [React Router](./docs/additional-reading/react-router.md)
57
+ - [React & Redux](./docs/additional-reading/react-and-redux.md)
58
+ - [Webpack Tips](./docs/additional-reading/webpack.md)
59
+ - [Server Rendering Tips](./docs/additional-reading/server-rendering-tips.md)
60
+ - [Code Splitting](docs/outdated/code-splitting.md)
61
+ - [AngularJS Integration and Migration to React on Rails](./docs/additional-reading/angular-js-integration-migration.md)
56
62
 
57
63
  ## **Deployment**
58
- + [Heroku Deployment](docs/guides/heroku-deployment.md)
59
- + [Elastic Beanstalk Deployment](./docs/additional-reading/elastic-beanstalk.md)
64
+
65
+ - [Heroku Deployment](docs/guides/heroku-deployment.md)
66
+ - [Elastic Beanstalk Deployment](./docs/additional-reading/elastic-beanstalk.md)
60
67
 
61
68
  ## Outdated Non-Webpack Docs
62
- + [Developing with the Webpack Dev Server](./docs/additional-reading/webpack-dev-server.md)
63
- + [Webpack, the Asset Pipeline, and Using Assets w/ React](./docs/outdated/rails-assets-relative-paths.md)
69
+
70
+ - [Developing with the Webpack Dev Server](./docs/additional-reading/webpack-dev-server.md)
71
+ - [Webpack, the Asset Pipeline, and Using Assets w/ React](./docs/outdated/rails-assets-relative-paths.md)
64
72
 
65
73
  ## **[CONTRIBUTING](CONTRIBUTING.md)**
66
- + [Generator Testing](./docs/contributor-info/generator-testing.md)
67
- + [Linting](./docs/contributor-info/linters.md)
68
- + [Releasing](./docs/contributor-info/releasing.md)
74
+
75
+ - [Generator Testing](./docs/contributor-info/generator-testing.md)
76
+ - [Linting](./docs/contributor-info/linters.md)
77
+ - [Releasing](./docs/contributor-info/releasing.md)
69
78
 
70
79
  ## **Misc**
71
- + [Tips](./docs/additional-reading/tips.md)
72
- + [Changelog](./CHANGELOG.md)
73
- + [Projects](./PROJECTS.md)
74
- + [Shaka Code Style](./docs/coding-style/style.md)
75
- + [React on Rails, Slides](http://www.slideshare.net/justingordon/react-on-rails-v61)
76
- + [Code of Conduct](./docs/misc/code_of_conduct.md)
77
- + [The React on Rails Doctrine](https://medium.com/@railsonmaui/the-react-on-rails-doctrine-3c59a778c724)
78
- + [React on Rails, 2000+ 🌟 Stars](https://medium.com/shakacode/react-on-rails-2000-stars-32ff5cfacfbf#.6gmfb2gpy)
80
+
81
+ - [Tips](./docs/additional-reading/tips.md)
82
+ - [Changelog](./CHANGELOG.md)
83
+ - [Projects](./PROJECTS.md)
84
+ - [Shaka Code Style](./docs/coding-style/style.md)
85
+ - [React on Rails, Slides](http://www.slideshare.net/justingordon/react-on-rails-v61)
86
+ - [Code of Conduct](./docs/misc/code_of_conduct.md)
87
+ - [The React on Rails Doctrine](https://medium.com/@railsonmaui/the-react-on-rails-doctrine-3c59a778c724)
88
+ - [React on Rails, 2000+ 🌟 Stars](https://medium.com/shakacode/react-on-rails-2000-stars-32ff5cfacfbf#.6gmfb2gpy)
data/eslint.config.ts ADDED
@@ -0,0 +1,213 @@
1
+ import path from 'node:path';
2
+ import { globalIgnores } from 'eslint/config';
3
+ import jest from 'eslint-plugin-jest';
4
+ import prettierRecommended from 'eslint-plugin-prettier/recommended';
5
+ import globals from 'globals';
6
+ import tsEslint from 'typescript-eslint';
7
+ import { includeIgnoreFile } from '@eslint/compat';
8
+ import js from '@eslint/js';
9
+ import { FlatCompat } from '@eslint/eslintrc';
10
+
11
+ const compat = new FlatCompat({
12
+ baseDirectory: __dirname,
13
+ recommendedConfig: js.configs.recommended,
14
+ allConfig: js.configs.all,
15
+ });
16
+
17
+ const config = tsEslint.config([
18
+ includeIgnoreFile(path.resolve(__dirname, '.gitignore')),
19
+ globalIgnores([
20
+ // compiled code
21
+ 'node_package/lib/',
22
+ // used for tests only
23
+ 'spec/react_on_rails/dummy-for-generators',
24
+ // temporary and generated files
25
+ 'spec/dummy/.yalc',
26
+ 'spec/dummy/public',
27
+ 'spec/dummy/vendor',
28
+ 'spec/dummy/tmp',
29
+ 'spec/dummy/app/assets/config/manifest.js',
30
+ 'spec/dummy/client/app/packs/server-bundle.js',
31
+ '**/*.res.js',
32
+ '**/coverage',
33
+ '**/assets/webpack/',
34
+ '**/public/webpack/',
35
+ '**/generated/',
36
+ '**/app/assets/javascripts/application.js',
37
+ '**/cable.js',
38
+ '**/public/packs*/',
39
+ '**/gen-examples/',
40
+ '**/bundle/',
41
+ // dependencies
42
+ '**/node_modules/',
43
+ // fixtures
44
+ '**/fixtures/',
45
+ '**/.yalc/**/*',
46
+ ]),
47
+ {
48
+ files: ['**/*.[jt]s', '**/*.[jt]sx', '**/*.[cm][jt]s'],
49
+ },
50
+ js.configs.recommended,
51
+ compat.extends('eslint-config-shakacode'),
52
+ {
53
+ languageOptions: {
54
+ globals: {
55
+ ...globals.browser,
56
+ ...globals.node,
57
+ },
58
+
59
+ parserOptions: {
60
+ requireConfigFile: false,
61
+
62
+ babelOptions: {
63
+ presets: ['@babel/preset-env', '@babel/preset-react'],
64
+ },
65
+ },
66
+ },
67
+
68
+ settings: {
69
+ 'import/core-modules': ['react-redux'],
70
+
71
+ 'import/resolver': {
72
+ alias: [['Assets', './spec/dummy/client/app/assets']],
73
+
74
+ node: {
75
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts'],
76
+ },
77
+ },
78
+ },
79
+
80
+ rules: {
81
+ 'no-shadow': 'off',
82
+ 'no-console': 'off',
83
+ 'function-paren-newline': 'off',
84
+ 'object-curly-newline': 'off',
85
+ 'no-restricted-syntax': ['error', 'SequenceExpression'],
86
+ 'no-void': [
87
+ 'error',
88
+ {
89
+ allowAsStatement: true,
90
+ },
91
+ ],
92
+
93
+ 'import/extensions': [
94
+ 'error',
95
+ 'ignorePackages',
96
+ {
97
+ js: 'never',
98
+ jsx: 'never',
99
+ ts: 'never',
100
+ tsx: 'never',
101
+ },
102
+ ],
103
+
104
+ 'import/first': 'off',
105
+ 'import/no-extraneous-dependencies': 'off',
106
+ // The rule seems broken: it's reporting errors on imports in files using `export` too,
107
+ // not just `module.exports`.
108
+ 'import/no-import-module-exports': 'off',
109
+ 'import/no-unresolved': [
110
+ 'error',
111
+ {
112
+ ignore: ['\\.res\\.js$'],
113
+ },
114
+ ],
115
+ 'react/destructuring-assignment': [
116
+ 'error',
117
+ 'always',
118
+ {
119
+ ignoreClassFields: true,
120
+ },
121
+ ],
122
+ 'react/forbid-prop-types': 'off',
123
+ 'react/function-component-definition': [
124
+ 'error',
125
+ {
126
+ namedComponents: ['arrow-function', 'function-declaration'],
127
+ unnamedComponents: 'arrow-function',
128
+ },
129
+ ],
130
+ 'react/jsx-props-no-spreading': 'off',
131
+ 'react/static-property-placement': 'off',
132
+ 'jsx-a11y/anchor-is-valid': 'off',
133
+ 'react/jsx-filename-extension': [
134
+ 'error',
135
+ {
136
+ extensions: ['.jsx', '.tsx'],
137
+ },
138
+ ],
139
+ },
140
+ },
141
+ {
142
+ files: ['node_package/**/*'],
143
+ rules: {
144
+ 'import/extensions': ['error', 'ignorePackages'],
145
+ },
146
+ },
147
+ {
148
+ files: ['lib/generators/react_on_rails/templates/**/*'],
149
+ rules: {
150
+ // It doesn't use package.json from the template
151
+ 'import/no-unresolved': 'off',
152
+ // We have `const [name, setName] = useState(props.name)` so can't just destructure props
153
+ 'react/destructuring-assignment': 'off',
154
+ },
155
+ },
156
+ {
157
+ files: ['**/*.ts{x,}', '**/*.[cm]ts'],
158
+
159
+ extends: tsEslint.configs.strictTypeChecked,
160
+
161
+ languageOptions: {
162
+ parserOptions: {
163
+ projectService: {
164
+ allowDefaultProject: ['eslint.config.ts', 'knip.ts', 'node_package/tests/*.test.{ts,tsx}'],
165
+ // Needed because `import * as ... from` instead of `import ... from` doesn't work in this file
166
+ // for some imports.
167
+ defaultProject: 'tsconfig.eslint.json',
168
+ },
169
+ },
170
+ },
171
+
172
+ rules: {
173
+ '@typescript-eslint/no-namespace': 'off',
174
+ '@typescript-eslint/no-shadow': 'error',
175
+ '@typescript-eslint/no-confusing-void-expression': [
176
+ 'error',
177
+ {
178
+ ignoreArrowShorthand: true,
179
+ },
180
+ ],
181
+ // Too many false positives
182
+ '@typescript-eslint/no-unnecessary-condition': 'off',
183
+ '@typescript-eslint/no-unused-vars': [
184
+ 'error',
185
+ {
186
+ caughtErrorsIgnorePattern: '^_',
187
+ },
188
+ ],
189
+ '@typescript-eslint/restrict-template-expressions': 'off',
190
+ },
191
+ },
192
+ {
193
+ files: ['**/app-react16/**/*'],
194
+ rules: {
195
+ 'react/no-deprecated': 'off',
196
+ },
197
+ },
198
+ {
199
+ files: ['node_package/tests/**', '**/*.test.{js,jsx,ts,tsx}'],
200
+
201
+ extends: [jest.configs['flat/recommended'], jest.configs['flat/style']],
202
+
203
+ rules: {
204
+ // Allows Jest mocks before import
205
+ 'import/first': 'off',
206
+ },
207
+ },
208
+ // must be the last config in the array
209
+ // https://github.com/prettier/eslint-plugin-prettier?tab=readme-ov-file#configuration-new-eslintconfigjs
210
+ prettierRecommended,
211
+ ]);
212
+
213
+ export default config;