-
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.
Even better best effort comment preservation in JSX comments
- Loading branch information
Showing
32 changed files
with
502 additions
and
258 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
25 changes: 14 additions & 11 deletions
25
...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 |
---|---|---|
@@ -1,24 +1,27 @@ | ||
=== tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx === | ||
// file is interntionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX { | ||
// 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)) | ||
|
||
interface IntrsinsicElements { [index: string]: any } | ||
>IntrsinsicElements : Symbol(IntrsinsicElements, Decl(commentsOnJSXExpressionsArePreserved.tsx, 1, 15)) | ||
>index : Symbol(index, Decl(commentsOnJSXExpressionsArePreserved.tsx, 2, 36)) | ||
|
||
type JSXElement = any; | ||
>JSXElement : Symbol(JSXElement, Decl(commentsOnJSXExpressionsArePreserved.tsx, 2, 57)) | ||
} | ||
class Component { | ||
>Component : Symbol(Component, Decl(commentsOnJSXExpressionsArePreserved.tsx, 4, 1)) | ||
>Component : Symbol(Component, Decl(commentsOnJSXExpressionsArePreserved.tsx, 1, 16)) | ||
|
||
render() { | ||
>render : Symbol(Component.render, Decl(commentsOnJSXExpressionsArePreserved.tsx, 5, 17)) | ||
>render : Symbol(Component.render, Decl(commentsOnJSXExpressionsArePreserved.tsx, 2, 17)) | ||
|
||
return <div> | ||
{/* missing */} | ||
{null/* preserved */} | ||
{ | ||
// ??? 1 | ||
} | ||
{ // ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */} | ||
</div>; | ||
} | ||
} |
23 changes: 13 additions & 10 deletions
23
...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
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
25 changes: 14 additions & 11 deletions
25
...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 |
---|---|---|
@@ -1,24 +1,27 @@ | ||
=== tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx === | ||
// file is interntionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX { | ||
// 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)) | ||
|
||
interface IntrsinsicElements { [index: string]: any } | ||
>IntrsinsicElements : Symbol(IntrsinsicElements, Decl(commentsOnJSXExpressionsArePreserved.tsx, 1, 15)) | ||
>index : Symbol(index, Decl(commentsOnJSXExpressionsArePreserved.tsx, 2, 36)) | ||
|
||
type JSXElement = any; | ||
>JSXElement : Symbol(JSXElement, Decl(commentsOnJSXExpressionsArePreserved.tsx, 2, 57)) | ||
} | ||
class Component { | ||
>Component : Symbol(Component, Decl(commentsOnJSXExpressionsArePreserved.tsx, 4, 1)) | ||
>Component : Symbol(Component, Decl(commentsOnJSXExpressionsArePreserved.tsx, 1, 16)) | ||
|
||
render() { | ||
>render : Symbol(Component.render, Decl(commentsOnJSXExpressionsArePreserved.tsx, 5, 17)) | ||
>render : Symbol(Component.render, Decl(commentsOnJSXExpressionsArePreserved.tsx, 2, 17)) | ||
|
||
return <div> | ||
{/* missing */} | ||
{null/* preserved */} | ||
{ | ||
// ??? 1 | ||
} | ||
{ // ??? 2 | ||
} | ||
{// ??? 3 | ||
} | ||
{ | ||
// ??? 4 | ||
/* ??? 5 */} | ||
</div>; | ||
} | ||
} |
23 changes: 13 additions & 10 deletions
23
...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
19 changes: 13 additions & 6 deletions
19
...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 |
---|---|---|
@@ -1,19 +1,26 @@ | ||
tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx(8,17): error TS2304: Cannot find name 'React'. | ||
tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name 'React'. | ||
|
||
|
||
==== tests/cases/compiler/commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== | ||
// file is interntionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs | ||
namespace JSX { | ||
interface IntrsinsicElements { [index: string]: any } | ||
type JSXElement = any; | ||
} | ||
// 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>; | ||
} | ||
} |
17 changes: 12 additions & 5 deletions
17
tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react,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
Oops, something went wrong.