-
Notifications
You must be signed in to change notification settings - Fork 714
Fix JSX indentation in JavaScript output #1792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
5
commits into
main
Choose a base branch
from
copilot/fix-d7ff9038-c725-4834-ae27-52390ab7a09e
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fbb9ead
Initial plan
Copilot 73b9745
Add test case for JSX nested indentation issue
Copilot 97ac647
Accept initial baselines for jsxNestedIndentation test
Copilot b45754a
Fix JSX indentation by enabling EFStartOnNewLine flag
Copilot 7aabf91
Fix regression: preserve previous inJsxChild state in nested transforms
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
20 changes: 20 additions & 0 deletions
20
testdata/baselines/reference/compiler/jsxNestedIndentation.js
This file contains hidden or 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,20 @@ | ||
//// [tests/cases/compiler/jsxNestedIndentation.tsx] //// | ||
|
||
//// [jsxNestedIndentation.tsx] | ||
declare var React: any; | ||
declare function Child(props: { children?: any }): any; | ||
function Test() { | ||
return <Child> | ||
<Child> | ||
<Child></Child> | ||
</Child> | ||
</Child> | ||
} | ||
|
||
|
||
//// [jsxNestedIndentation.js] | ||
function Test() { | ||
return React.createElement(Child, null, | ||
React.createElement(Child, null, | ||
React.createElement(Child, null))); | ||
} |
31 changes: 31 additions & 0 deletions
31
testdata/baselines/reference/compiler/jsxNestedIndentation.symbols
This file contains hidden or 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,31 @@ | ||
//// [tests/cases/compiler/jsxNestedIndentation.tsx] //// | ||
|
||
=== jsxNestedIndentation.tsx === | ||
declare var React: any; | ||
>React : Symbol(React, Decl(jsxNestedIndentation.tsx, 0, 11)) | ||
|
||
declare function Child(props: { children?: any }): any; | ||
>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) | ||
>props : Symbol(props, Decl(jsxNestedIndentation.tsx, 1, 23)) | ||
>children : Symbol(children, Decl(jsxNestedIndentation.tsx, 1, 31)) | ||
|
||
function Test() { | ||
>Test : Symbol(Test, Decl(jsxNestedIndentation.tsx, 1, 55)) | ||
|
||
return <Child> | ||
>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) | ||
|
||
<Child> | ||
>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) | ||
|
||
<Child></Child> | ||
>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) | ||
>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) | ||
|
||
</Child> | ||
>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) | ||
|
||
</Child> | ||
>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) | ||
} | ||
|
34 changes: 34 additions & 0 deletions
34
testdata/baselines/reference/compiler/jsxNestedIndentation.types
This file contains hidden or 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,34 @@ | ||
//// [tests/cases/compiler/jsxNestedIndentation.tsx] //// | ||
|
||
=== jsxNestedIndentation.tsx === | ||
declare var React: any; | ||
>React : any | ||
|
||
declare function Child(props: { children?: any }): any; | ||
>Child : (props: { children?: any; }) => any | ||
>props : { children?: any; } | ||
>children : any | ||
|
||
function Test() { | ||
>Test : () => any | ||
|
||
return <Child> | ||
><Child> <Child> <Child></Child> </Child> </Child> : any | ||
>Child : (props: { children?: any; }) => any | ||
|
||
<Child> | ||
><Child> <Child></Child> </Child> : any | ||
>Child : (props: { children?: any; }) => any | ||
|
||
<Child></Child> | ||
><Child></Child> : any | ||
>Child : (props: { children?: any; }) => any | ||
>Child : (props: { children?: any; }) => any | ||
|
||
</Child> | ||
>Child : (props: { children?: any; }) => any | ||
|
||
</Child> | ||
>Child : (props: { children?: any; }) => any | ||
} | ||
|
This file contains hidden or 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
11 changes: 11 additions & 0 deletions
11
...mentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=auto).js.diff
This file contains hidden or 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,11 @@ | ||
--- old.commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=auto).js | ||
+++ new.commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=auto).js | ||
@@= skipped -24, +24 lines =@@ | ||
//// [commentsOnJSXExpressionsArePreserved.js] | ||
class Component { | ||
render() { | ||
- return React.createElement("div", null, null /* preserved */); | ||
+ return React.createElement("div", null, | ||
+ null /* preserved */); | ||
} | ||
} |
This file contains hidden or 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
11 changes: 11 additions & 0 deletions
11
...entsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js.diff
This file contains hidden or 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,11 @@ | ||
--- old.commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js | ||
+++ new.commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js | ||
@@= skipped -26, +26 lines =@@ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class Component { | ||
render() { | ||
- return React.createElement("div", null, null /* preserved */); | ||
+ return React.createElement("div", null, | ||
+ null /* preserved */); | ||
} | ||
} |
This file contains hidden or 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
11 changes: 11 additions & 0 deletions
11
...ntsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=legacy).js.diff
This file contains hidden or 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,11 @@ | ||
--- old.commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=legacy).js | ||
+++ new.commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=legacy).js | ||
@@= skipped -24, +24 lines =@@ | ||
//// [commentsOnJSXExpressionsArePreserved.js] | ||
class Component { | ||
render() { | ||
- return React.createElement("div", null, null /* preserved */); | ||
+ return React.createElement("div", null, | ||
+ null /* preserved */); | ||
} | ||
} |
This file contains hidden or 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
10 changes: 0 additions & 10 deletions
10
testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js.diff
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
13 changes: 0 additions & 13 deletions
13
testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js.diff
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
9 changes: 0 additions & 9 deletions
9
testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js.diff
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.