arminbro / generate-react-cli

A simple React CLI to generate components instantly and more.

Home Page:https://www.npmjs.com/package/generate-react-cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for .jsx extension

alexwileyy opened this issue · comments

Is your feature request related to a problem? Please describe.
Currently this generates .js files. It would be better if it by default exported .jsx files as this is the filetype that's supposed to be used for React components. Could an option be added to support this?

Describe the solution you'd like
A clear and concise description of what you want to happen.
Either:

  • JSX turned on by default
  • Option in config to allow JSX export

Hey @alexwileyy,

Actually the react team suggests not using the .jsx extension anymore. The distinction between .js and .jsx files were useful before Babel, but it’s not that useful anymore. You can read more about it here.

I'm going to close this ticket for now. I'll reopen it if you have a stronger use case for them.

@alexwileyy by resolving ticket #19, your request should also now be resolved with the new release of v5.1.0.

GRC now supports custom extensions via custom templates. You should now be able to declare a custom component template with its own extension (jsx) within your generate-react-cli.json config file.

Something like this:

{
  "usesTypeScript": false,
  "usesCssModule": true,
  "cssPreprocessor": "scss",
  "testLibrary": "Testing Library",
  "component": {
    "default": {
      "customTemplates": {
        "component": "templates/component/component.jsx"
      },
      "path": "src/components",
      "withStyle": true,
      "withTest": true,
      "withStory": true,
      "withLazy": false
    }
  }
}

Let me know if you run into any other problems. Thanks again for the request.