jsdrupal / drupal-admin-ui

This is an admin UI for Drupal, built with JavaScript & React. ⬅️✌️➡️
Other
237 stars 91 forks source link

ts files should support react elements #604

Open martinfrances107 opened 5 years ago

martinfrances107 commented 5 years ago

As seen in this PR

https://github.com/jsdrupal/drupal-admin-ui/pull/538

We get compilation failures when including react elements in ts files.

As react elements are permitted in js files under our conventions we need to make similar adjustments for typescript.

lauriii commented 5 years ago

Wondering what was the reason for using .js instead of .jsx for files containing JSX, but for me it would make sense to add new extension .tsx for files that contain both, JSX and TypeScript.

martinfrances107 commented 5 years ago

Wondering what was the reason for using .js instead of .jsx for files containing JSX

When I look back through the issue queue ... I find I can only go back a step before I lose the link to the actual drupal-admin-ui discussion where the convention was adopted. [ I was not part of the conversation] ( https://github.com/jsdrupal/drupal-admin-ui/issues/556#issue-383872422 ) Sorry that is a mistake on my part for not documenting things well enough

Here I am just repeating a link

It looks like there is a disagreement between airbnb and people working on react itself, see facebook/create-react-app#87 (comment)

dawehner commented 5 years ago

Given the other comment on the other issue/the comment on create-react-app this issue seems totally sensible. From my point of view components are in their own folder anyway, so there doesn't have to be a way to distinct normal files from components.