-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Under jsx: preserve, actually preserve expressions which contain only…
… comments (#41757) * Under jsx: preserve, actually preserve expressions which contain only comments * Even better best effort comment preservation in JSX comments
- Loading branch information
Showing
40 changed files
with
1,034 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//// [commentsOnJSXExpressionsArePreserved.tsx] | ||
// file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX {} | ||
class Component { | ||
render() { | ||
return <div> | ||
{/* missing */} | ||
{null/* preserved */} | ||
{ | ||
// ??? 1 | ||
} | ||
{ // ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */} | ||
</div>; | ||
} | ||
} | ||
|
||
//// [commentsOnJSXExpressionsArePreserved.jsx] | ||
var Component = /** @class */ (function () { | ||
function Component() { | ||
} | ||
Component.prototype.render = function () { | ||
return <div> | ||
{/* missing */} | ||
{null /* preserved */} | ||
{ | ||
// ??? 1 | ||
} | ||
{// ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */ } | ||
</div>; | ||
}; | ||
return Component; | ||
}()); |
27 changes: 27 additions & 0 deletions
27
...ines/reference/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
=== tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx === | ||
// file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX {} | ||
>JSX : Symbol(JSX, Decl(commentsOnJSXExpressionsArePreserved.tsx, 0, 0)) | ||
|
||
class Component { | ||
>Component : Symbol(Component, Decl(commentsOnJSXExpressionsArePreserved.tsx, 1, 16)) | ||
|
||
render() { | ||
>render : Symbol(Component.render, Decl(commentsOnJSXExpressionsArePreserved.tsx, 2, 17)) | ||
|
||
return <div> | ||
{/* missing */} | ||
{null/* preserved */} | ||
{ | ||
// ??? 1 | ||
} | ||
{ // ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */} | ||
</div>; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...elines/reference/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs).types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
=== tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx === | ||
// file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX {} | ||
class Component { | ||
>Component : Component | ||
|
||
render() { | ||
>render : () => any | ||
|
||
return <div> | ||
><div> {/* missing */} {null/* preserved */} { // ??? 1 } { // ??? 2 } {// ??? 3 } { // ??? 4 /* ??? 5 */} </div> : error | ||
>div : any | ||
|
||
{/* missing */} | ||
{null/* preserved */} | ||
>null : null | ||
{ | ||
// ??? 1 | ||
} | ||
{ // ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */} | ||
</div>; | ||
>div : any | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...s/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//// [commentsOnJSXExpressionsArePreserved.tsx] | ||
// file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX {} | ||
class Component { | ||
render() { | ||
return <div> | ||
{/* missing */} | ||
{null/* preserved */} | ||
{ | ||
// ??? 1 | ||
} | ||
{ // ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */} | ||
</div>; | ||
} | ||
} | ||
|
||
//// [commentsOnJSXExpressionsArePreserved.jsx] | ||
var Component = /** @class */ (function () { | ||
function Component() { | ||
} | ||
Component.prototype.render = function () { | ||
return <div> | ||
{/* missing */} | ||
{null /* preserved */} | ||
{ | ||
// ??? 1 | ||
} | ||
{// ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */ } | ||
</div>; | ||
}; | ||
return Component; | ||
}()); |
27 changes: 27 additions & 0 deletions
27
...elines/reference/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
=== tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx === | ||
// file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX {} | ||
>JSX : Symbol(JSX, Decl(commentsOnJSXExpressionsArePreserved.tsx, 0, 0)) | ||
|
||
class Component { | ||
>Component : Symbol(Component, Decl(commentsOnJSXExpressionsArePreserved.tsx, 1, 16)) | ||
|
||
render() { | ||
>render : Symbol(Component.render, Decl(commentsOnJSXExpressionsArePreserved.tsx, 2, 17)) | ||
|
||
return <div> | ||
{/* missing */} | ||
{null/* preserved */} | ||
{ | ||
// ??? 1 | ||
} | ||
{ // ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */} | ||
</div>; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...aselines/reference/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system).types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
=== tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx === | ||
// file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX {} | ||
class Component { | ||
>Component : Component | ||
|
||
render() { | ||
>render : () => any | ||
|
||
return <div> | ||
><div> {/* missing */} {null/* preserved */} { // ??? 1 } { // ??? 2 } {// ??? 3 } { // ??? 4 /* ??? 5 */} </div> : error | ||
>div : any | ||
|
||
{/* missing */} | ||
{null/* preserved */} | ||
>null : null | ||
{ | ||
// ??? 1 | ||
} | ||
{ // ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */} | ||
</div>; | ||
>div : any | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ines/reference/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs).errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name 'React'. | ||
|
||
|
||
==== tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== | ||
// file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX {} | ||
class Component { | ||
render() { | ||
return <div> | ||
~~~ | ||
!!! error TS2304: Cannot find name 'React'. | ||
{/* missing */} | ||
{null/* preserved */} | ||
{ | ||
// ??? 1 | ||
} | ||
{ // ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */} | ||
</div>; | ||
} | ||
} |
Oops, something went wrong.