-
Notifications
You must be signed in to change notification settings - Fork 36
feat: support .tsx files with JSX syntax #96
Conversation
This allows oclif to parse jsx found in .tsx files.
Notably does _not_ add support for .jsx files yet since this will require a separate tool chain to work with something like Babel as a transpiler for JSX in Javascript files. Also ensures that test files that are .tsx are still ignored.
|
This should just work out of the box, I'm working on an example repo that uses this branch to confirm as much. |
Codecov Report
@@ Coverage Diff @@
## master #96 +/- ##
========================================
- Coverage 66.81% 0% -66.82%
========================================
Files 7 2 -5
Lines 452 12 -440
Branches 127 3 -124
========================================
- Hits 302 0 -302
+ Misses 101 12 -89
+ Partials 49 0 -49
Continue to review full report at Codecov.
|
| sourceMap: true, | ||
| rootDirs, | ||
| typeRoots, | ||
| jsx: 'react', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsx: tsconfig.compilerOptions.jsx || 'react' Is anyone going to want to use preserve mode?
https://www.typescriptlang.org/docs/handbook/jsx.html#basic-usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preserve mode would typically be used if
- Your JS environment has native support for JSX syntax
- You're going to pass it through another transpile step
Since oclif is managing the transpilation here, I don't think it's something that we have to worry about. Anyone who would currently be using JSX with Oclif would have had to put their own transpilation process in front of it anyways, and so would be unaffected.
RasPhilCo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏄
|
What’s the best way to use this in practice? Do I replace the oclif/config dependency with a git URL to get the latest? Or will there be a release? |
|
I'll release this tomorrow. |
Fixes oclif/oclif#309
Provides support for
.tsxfiles that contain JSX syntax in them in an attempt to makeoclifcompatible withinkand solve vadimdemedes/ink#239Configures the pattern discovery in the plugin module to also search for
.tsxfiles. Instructsts-nodeto use "react" mode when dealing with JSX, based on the options in https://www.typescriptlang.org/docs/handbook/jsx.html