Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make generator es6 and ts usable at same time #1299

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

ippachi
Copy link
Contributor

@ippachi ippachi commented Aug 16, 2023

Summary

Thank you for great integration rails and react. I use react-rails recently and I notice that I can't use --ts and --es6 same time. What about making these two available at the same time?

Other Information

This is actual generated file

rails g react:component HelloWorld greeting:string --ts --es6

import * as React from "react"

interface IHelloWorldProps {
  greeting: string;
}

const HelloWorld = (props: IHelloWorldProps) => {
  return (
    <React.Fragment>
      Greeting: {props.greeting}
    </React.Fragment>
  )
}

export default HelloWorld

Pull Request checklist

  • Add/update test to cover these changes
  • Update documentation
  • Update CHANGELOG file

@ippachi ippachi force-pushed the use-ts-es6-same-time branch 2 times, most recently from 1a0da7b to c1791e6 Compare August 16, 2023 13:26
@ippachi ippachi changed the title Make es6 and ts usable at same time Make generator es6 and ts usable at same time Aug 16, 2023
Comment on lines 1 to 12
<%= file_header %>
interface I<%= component_name %>Props {
<% if attributes.size > 0 -%>
<% attributes.each do | attribute | -%>
<% if attribute[:union] -%>
<%= attribute[:name].camelize(:lower) %>: <%= attribute[:name].titleize %>;
<% else -%>
<%= attribute[:name].camelize(:lower) %>: <%= attribute[:type] %>;
<% end -%>
<% end -%>
<% end -%>
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think It would be good to use indentation here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ahangarha
Do you mean this?

interface I<%= component_name %>Props {
  <% if attributes.size > 0 -%>
  <% attributes.each do | attribute | -%>
  <% if attribute[:union] -%>
  <%= attribute[:name].camelize(:lower) %>: <%= attribute[:name].titleize %>;
  <% else -%>
  <%= attribute[:name].camelize(:lower) %>: <%= attribute[:type] %>;
  <% end -%>
  <% end -%>
  <% end -%>
}

But All <% in template have no indentation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I can say the indentations there are not ideal. Better to make a little improvement in each PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ahangarha
OK. I have tried fixing indentation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it can still be improved, but also the issue is beyond the changes in this particular PR.

So, I don't want to block the PR for this specific reason.

@Judahmeek If there is no other issue except this one, I think we are good to move forward.

Copy link
Collaborator

@Judahmeek Judahmeek left a comment

Choose a reason for hiding this comment

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

@ippachi Please resolve @ahangarha's comment & also please rebase to address the Changelog conflict.

@ippachi ippachi force-pushed the use-ts-es6-same-time branch from c1791e6 to 961c793 Compare August 20, 2023 23:39
@ippachi ippachi requested review from ahangarha and Judahmeek August 20, 2023 23:42
@justin808 justin808 merged commit f59b5b3 into reactjs:master Aug 25, 2023
@justin808
Copy link
Collaborator

Thank you @ippachi for your contribution.

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.

4 participants