diff --git a/internal/printer/printer.go b/internal/printer/printer.go index f9581f9e10..dacb7af178 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -783,10 +783,9 @@ func (p *Printer) shouldEmitBlockFunctionBodyOnSingleLine(body *ast.Block) bool } func (p *Printer) shouldEmitOnNewLine(node *ast.Node, format ListFormat) bool { - // !!! TODO: enable multiline emit - // if p.emitContext.EmitFlags(node)&EFStartOnNewLine != 0 { - // return true - // } + if p.emitContext.EmitFlags(node)&EFStartOnNewLine != 0 { + return true + } return format&LFPreferNewLine != 0 } diff --git a/internal/transformers/jsxtransforms/jsx.go b/internal/transformers/jsxtransforms/jsx.go index 1b8be9984f..68abc0ba49 100644 --- a/internal/transformers/jsxtransforms/jsx.go +++ b/internal/transformers/jsxtransforms/jsx.go @@ -319,8 +319,9 @@ func (tx *JSXTransformer) convertJsxChildrenToChildrenPropObject(children []*ast } func (tx *JSXTransformer) transformJsxChildToExpression(node *ast.Node) *ast.Node { + prev := tx.inJsxChild tx.setInChild(true) - defer tx.setInChild(false) + defer tx.setInChild(prev) return tx.Visitor().Visit(node) } @@ -688,14 +689,18 @@ func (tx *JSXTransformer) visitJsxOpeningLikeElementCreateElement(element *ast.N for _, c := range children.Nodes { res := tx.transformJsxChildToExpression(c) if res != nil { - if len(children.Nodes) > 1 { - tx.EmitContext().AddEmitFlags(res, printer.EFStartOnNewLine) - } newChildren = append(newChildren, res) } } } + // Add StartOnNewLine flag only if there are multiple actual children (after filtering) + if len(newChildren) > 1 { + for _, child := range newChildren { + tx.EmitContext().AddEmitFlags(child, printer.EFStartOnNewLine) + } + } + args := make([]*ast.Expression, 0, len(newChildren)+2) args = append(args, tagName) args = append(args, objectProperties) @@ -725,14 +730,18 @@ func (tx *JSXTransformer) visitJsxOpeningFragmentCreateElement(fragment *ast.Jsx for _, c := range children.Nodes { res := tx.transformJsxChildToExpression(c) if res != nil { - if len(children.Nodes) > 1 { - tx.EmitContext().AddEmitFlags(res, printer.EFStartOnNewLine) - } newChildren = append(newChildren, res) } } } + // Add StartOnNewLine flag only if there are multiple actual children (after filtering) + if len(newChildren) > 1 { + for _, child := range newChildren { + tx.EmitContext().AddEmitFlags(child, printer.EFStartOnNewLine) + } + } + args := make([]*ast.Expression, 0, len(newChildren)+2) args = append(args, tagName) args = append(args, tx.Factory().NewKeywordExpression(ast.KindNullKeyword)) diff --git a/testdata/baselines/reference/compiler/jsxNestedIndentation.js b/testdata/baselines/reference/compiler/jsxNestedIndentation.js new file mode 100644 index 0000000000..24315ed9a2 --- /dev/null +++ b/testdata/baselines/reference/compiler/jsxNestedIndentation.js @@ -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 + + + + +} + + +//// [jsxNestedIndentation.js] +function Test() { + return React.createElement(Child, null, + React.createElement(Child, null, + React.createElement(Child, null))); +} diff --git a/testdata/baselines/reference/compiler/jsxNestedIndentation.symbols b/testdata/baselines/reference/compiler/jsxNestedIndentation.symbols new file mode 100644 index 0000000000..630e254a6c --- /dev/null +++ b/testdata/baselines/reference/compiler/jsxNestedIndentation.symbols @@ -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 : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) + + +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) + + +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) + + +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) + + +>Child : Symbol(Child, Decl(jsxNestedIndentation.tsx, 0, 23)) +} + diff --git a/testdata/baselines/reference/compiler/jsxNestedIndentation.types b/testdata/baselines/reference/compiler/jsxNestedIndentation.types new file mode 100644 index 0000000000..f910202c49 --- /dev/null +++ b/testdata/baselines/reference/compiler/jsxNestedIndentation.types @@ -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 +> : any +>Child : (props: { children?: any; }) => any + + +> : any +>Child : (props: { children?: any; }) => any + + +> : any +>Child : (props: { children?: any; }) => any +>Child : (props: { children?: any; }) => any + + +>Child : (props: { children?: any; }) => any + + +>Child : (props: { children?: any; }) => any +} + diff --git a/testdata/baselines/reference/compiler/jsxUnicodeEscapeSequence.js b/testdata/baselines/reference/compiler/jsxUnicodeEscapeSequence.js index a179ad9931..107acc3fb6 100644 --- a/testdata/baselines/reference/compiler/jsxUnicodeEscapeSequence.js +++ b/testdata/baselines/reference/compiler/jsxUnicodeEscapeSequence.js @@ -34,7 +34,9 @@ export const InlineUnicodeChar = () => { }; export const StandaloneUnicodeChar = () => { // This should reproduce the issue - unicode character on its own line - return (_jsxs("div", { children: [_jsx("span", { children: "\u26A0" }), "\u26A0"] })); + return (_jsxs("div", { children: [ + _jsx("span", { children: "\u26A0" }), + "\u26A0"] })); }; export const MultipleUnicodeChars = () => { // Test multiple unicode characters diff --git a/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js b/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js index 63ec409b0b..81595327fa 100644 --- a/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js +++ b/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js @@ -18,4 +18,6 @@ let Foo = { Bar() { } }; let Baz = () => { }; -let x = React.createElement(Foo.Bar, null, "Hello let y = ", React.createElement(Baz, null, "Hello")); +let x = React.createElement(Foo.Bar, null, + "Hello let y = ", + React.createElement(Baz, null, "Hello")); diff --git a/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js.diff b/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js.diff deleted file mode 100644 index d071260647..0000000000 --- a/testdata/baselines/reference/submodule/compiler/errorSpanForUnclosedJsxTag.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.errorSpanForUnclosedJsxTag.js -+++ new.errorSpanForUnclosedJsxTag.js -@@= skipped -17, +17 lines =@@ - Bar() { } - }; - let Baz = () => { }; --let x = React.createElement(Foo.Bar, null, -- "Hello let y = ", -- React.createElement(Baz, null, "Hello")); -+let x = React.createElement(Foo.Bar, null, "Hello let y = ", React.createElement(Baz, null, "Hello")); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js b/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js index b6e2180083..13fd6616f4 100644 --- a/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js +++ b/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js @@ -48,6 +48,8 @@ configureStore({ }); const Component = () => { const categories = ['Fruit', 'Vegetables']; - return (React.createElement("ul", null, React.createElement("li", null, "All"), categories.map((category) => (React.createElement("li", { key: category }, category) // Error about 'key' only - )))); + return (React.createElement("ul", null, + React.createElement("li", null, "All"), + categories.map((category) => (React.createElement("li", { key: category }, category) // Error about 'key' only + )))); }; diff --git a/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js.diff b/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js.diff deleted file mode 100644 index 0fd96a87b2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/excessiveStackDepthFlatArray.js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.excessiveStackDepthFlatArray.js -+++ new.excessiveStackDepthFlatArray.js -@@= skipped -47, +47 lines =@@ - }); - const Component = () => { - const categories = ['Fruit', 'Vegetables']; -- return (React.createElement("ul", null, -- React.createElement("li", null, "All"), -- categories.map((category) => (React.createElement("li", { key: category }, category) // Error about 'key' only -- )))); -+ return (React.createElement("ul", null, React.createElement("li", null, "All"), categories.map((category) => (React.createElement("li", { key: category }, category) // Error about 'key' only -+ )))); - }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js b/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js index 7444e18d4a..c537ca89a1 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js +++ b/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js @@ -11,4 +11,5 @@ declare var React: any; //// [jsxAttributeWithoutExpressionReact.js] -React.createElement(View, null, React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); +React.createElement(View, null, + React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); diff --git a/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js.diff b/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js.diff deleted file mode 100644 index d422561af4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxAttributeWithoutExpressionReact.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.jsxAttributeWithoutExpressionReact.js -+++ new.jsxAttributeWithoutExpressionReact.js -@@= skipped -10, +10 lines =@@ - - - //// [jsxAttributeWithoutExpressionReact.js] --React.createElement(View, null, -- React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); -+React.createElement(View, null, React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js b/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js index e98f1efae1..d434ef7198 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js +++ b/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js @@ -15,4 +15,6 @@ const a = ( //// [index.js] /// /// -const a = (React.createElement("main", null, (React.createElement("div", null)), React.createElement("span", null))); +const a = (React.createElement("main", null, + (React.createElement("div", null)), + React.createElement("span", null))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js.diff index 60fa1c536d..df3d91292e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxChildWrongType.js.diff @@ -7,7 +7,4 @@ -"use strict"; /// /// --const a = (React.createElement("main", null, -- (React.createElement("div", null)), -- React.createElement("span", null))); -+const a = (React.createElement("main", null, (React.createElement("div", null)), React.createElement("span", null))); \ No newline at end of file + const a = (React.createElement("main", null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js b/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js index 3c3753387f..a01e4ceeae 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js @@ -20,4 +20,6 @@ const b = ( //// [index.js] /// /// -const b = (React.createElement(Foo, null, React.createElement("div", null), "aa")); +const b = (React.createElement(Foo, null, + React.createElement("div", null), + "aa")); diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js.diff index 0f17e08fc4..d2845cf221 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenArrayWrongType.js.diff @@ -7,7 +7,4 @@ -"use strict"; /// /// --const b = (React.createElement(Foo, null, -- React.createElement("div", null), -- "aa")); -+const b = (React.createElement(Foo, null, React.createElement("div", null), "aa")); \ No newline at end of file + const b = (React.createElement(Foo, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js b/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js index 0570331206..9d0abff513 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js @@ -94,7 +94,9 @@ var a = React.createElement(Blah, null, x => x); // Blah components don't accept text as child elements var a = React.createElement(Blah, null, "Hello unexpected text!"); // Blah components don't accept multiple children. -var a = React.createElement(Blah, null, x => "" + x, x => "" + x); +var a = React.createElement(Blah, null, + x => "" + x, + x => "" + x); function Blah2(props) { return React.createElement(React.Fragment, null); } @@ -103,7 +105,9 @@ var a = React.createElement(Blah2, null, x => x); // Blah2 components don't accept text as child elements var a = React.createElement(Blah2, null, "Hello unexpected text!"); // Blah2 components don't accept multiple children of the wrong type. -var a = React.createElement(Blah2, null, x => x, x => x); +var a = React.createElement(Blah2, null, + x => x, + x => x); function Blah3(props) { return React.createElement(React.Fragment, null); } @@ -112,4 +116,6 @@ var a = React.createElement(Blah3, null, x => x); // Blah3 components don't accept text as child elements var a = React.createElement(Blah3, null, "Hello unexpected text!"); // Blah3 components don't accept multiple children of the wrong type. -var a = React.createElement(Blah3, null, x => x, x => x); +var a = React.createElement(Blah3, null, + x => x, + x => x); diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff index 9240c8544f..cb4108a499 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenIndividualErrorElaborations.js.diff @@ -8,34 +8,4 @@ +const React = require("react"); function Blah(props) { return React.createElement(React.Fragment, null); - } -@@= skipped -9, +9 lines =@@ - // Blah components don't accept text as child elements - var a = React.createElement(Blah, null, "Hello unexpected text!"); - // Blah components don't accept multiple children. --var a = React.createElement(Blah, null, -- x => "" + x, -- x => "" + x); -+var a = React.createElement(Blah, null, x => "" + x, x => "" + x); - function Blah2(props) { - return React.createElement(React.Fragment, null); - } -@@= skipped -11, +9 lines =@@ - // Blah2 components don't accept text as child elements - var a = React.createElement(Blah2, null, "Hello unexpected text!"); - // Blah2 components don't accept multiple children of the wrong type. --var a = React.createElement(Blah2, null, -- x => x, -- x => x); -+var a = React.createElement(Blah2, null, x => x, x => x); - function Blah3(props) { - return React.createElement(React.Fragment, null); - } -@@= skipped -11, +9 lines =@@ - // Blah3 components don't accept text as child elements - var a = React.createElement(Blah3, null, "Hello unexpected text!"); - // Blah3 components don't accept multiple children of the wrong type. --var a = React.createElement(Blah3, null, -- x => x, -- x => x); -+var a = React.createElement(Blah3, null, x => x, x => x); \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js b/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js index a4dc7e7d0d..4ae637d1c4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js @@ -19,4 +19,6 @@ const b = ( //// [other.js] /// /// -const b = (React.createElement(Foo, null, React.createElement("div", null), "aa")); +const b = (React.createElement(Foo, null, + React.createElement("div", null), + "aa")); diff --git a/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js.diff b/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js.diff index a6b8208467..130688bec5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxChildrenWrongType.js.diff @@ -7,7 +7,4 @@ -"use strict"; /// /// --const b = (React.createElement(Foo, null, -- React.createElement("div", null), -- "aa")); -+const b = (React.createElement(Foo, null, React.createElement("div", null), "aa")); \ No newline at end of file + const b = (React.createElement(Foo, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js index 9961ba8b5a..6272ca29c6 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js +++ b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js @@ -27,4 +27,5 @@ const React = require("react"); function Wrapper(props) { return React.createElement("div", null, props.children); } -const element = (React.createElement(Wrapper, null, React.createElement("div", null, "Hello"))); +const element = (React.createElement(Wrapper, null, + React.createElement("div", null, "Hello"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff index e75b72d689..f92e43abf4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxEmptyExpressionNotCountedAsChild(jsx=react).js.diff @@ -8,7 +8,4 @@ +const React = require("react"); function Wrapper(props) { return React.createElement("div", null, props.children); - } --const element = (React.createElement(Wrapper, null, -- React.createElement("div", null, "Hello"))); -+const element = (React.createElement(Wrapper, null, React.createElement("div", null, "Hello"))); \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js index faba591900..18800eb73b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js @@ -9,4 +9,8 @@ declare var Frag: any; //// [jsxFactoryAndJsxFragmentFactory.js] h(Frag, null); -h(Frag, null, h("span", null, "1"), h(Frag, null, h("span", null, "2.1"), h("span", null, "2.2"))); +h(Frag, null, + h("span", null, "1"), + h(Frag, null, + h("span", null, "2.1"), + h("span", null, "2.2"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js.diff deleted file mode 100644 index 7b47493d91..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactory.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.jsxFactoryAndJsxFragmentFactory.js -+++ new.jsxFactoryAndJsxFragmentFactory.js -@@= skipped -8, +8 lines =@@ - - //// [jsxFactoryAndJsxFragmentFactory.js] - h(Frag, null); --h(Frag, null, -- h("span", null, "1"), -- h(Frag, null, -- h("span", null, "2.1"), -- h("span", null, "2.2"))); -+h(Frag, null, h("span", null, "1"), h(Frag, null, h("span", null, "2.1"), h("span", null, "2.2"))); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js index a724406b71..b6882ec8ec 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js @@ -8,4 +8,8 @@ declare var h: any; //// [jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js] h(React.Fragment, null); -h(React.Fragment, null, h("span", null, "1"), h(React.Fragment, null, h("span", null, "2.1"), h("span", null, "2.2"))); +h(React.Fragment, null, + h("span", null, "1"), + h(React.Fragment, null, + h("span", null, "2.1"), + h("span", null, "2.2"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js.diff deleted file mode 100644 index 77b56ccfe3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js -+++ new.jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js -@@= skipped -7, +7 lines =@@ - - //// [jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js] - h(React.Fragment, null); --h(React.Fragment, null, -- h("span", null, "1"), -- h(React.Fragment, null, -- h("span", null, "2.1"), -- h("span", null, "2.2"))); -+h(React.Fragment, null, h("span", null, "1"), h(React.Fragment, null, h("span", null, "2.1"), h("span", null, "2.2"))); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js index a9d22fd0db..83b4e2ee67 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js @@ -8,4 +8,8 @@ declare var h: any; //// [jsxFactoryAndJsxFragmentFactoryNull.js] h(null, null); -h(null, null, h("span", null, "1"), h(null, null, h("span", null, "2.1"), h("span", null, "2.2"))); +h(null, null, + h("span", null, "1"), + h(null, null, + h("span", null, "2.1"), + h("span", null, "2.2"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js.diff deleted file mode 100644 index 4069a9e30f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryAndJsxFragmentFactoryNull.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.jsxFactoryAndJsxFragmentFactoryNull.js -+++ new.jsxFactoryAndJsxFragmentFactoryNull.js -@@= skipped -7, +7 lines =@@ - - //// [jsxFactoryAndJsxFragmentFactoryNull.js] - h(null, null); --h(null, null, -- h("span", null, "1"), -- h(null, null, -- h("span", null, "2.1"), -- h("span", null, "2.2"))); -+h(null, null, h("span", null, "1"), h(null, null, h("span", null, "2.1"), h("span", null, "2.2"))); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js b/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js index de9f387250..a62a05ca0b 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js @@ -8,4 +8,8 @@ declare var h: any; //// [jsxFactoryButNoJsxFragmentFactory.js] h(React.Fragment, null); -h(React.Fragment, null, h("span", null, "1"), h(React.Fragment, null, h("span", null, "2.1"), h("span", null, "2.2"))); +h(React.Fragment, null, + h("span", null, "1"), + h(React.Fragment, null, + h("span", null, "2.1"), + h("span", null, "2.2"))); diff --git a/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js.diff deleted file mode 100644 index 4456fecc25..0000000000 --- a/testdata/baselines/reference/submodule/compiler/jsxFactoryButNoJsxFragmentFactory.js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.jsxFactoryButNoJsxFragmentFactory.js -+++ new.jsxFactoryButNoJsxFragmentFactory.js -@@= skipped -7, +7 lines =@@ - - //// [jsxFactoryButNoJsxFragmentFactory.js] - h(React.Fragment, null); --h(React.Fragment, null, -- h("span", null, "1"), -- h(React.Fragment, null, -- h("span", null, "2.1"), -- h("span", null, "2.2"))); -+h(React.Fragment, null, h("span", null, "1"), h(React.Fragment, null, h("span", null, "2.1"), h("span", null, "2.2"))); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js b/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js index 72870d3a61..56a90bc5f3 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js +++ b/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js @@ -24,5 +24,7 @@ exports.Counter = Counter; const react_1 = require("react"); function Counter({ count = 0 }) { const [cnt, setCnt] = null; - return (0, react_1.createElement)(react_1.Fragment, null, (0, react_1.createElement)("p", null, cnt), (0, react_1.createElement)("button", { onClick: () => setCnt((prev) => prev + 1), type: "button" }, "Update")); + return (0, react_1.createElement)(react_1.Fragment, null, + (0, react_1.createElement)("p", null, cnt), + (0, react_1.createElement)("button", { onClick: () => setCnt((prev) => prev + 1), type: "button" }, "Update")); } diff --git a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff b/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff index c831aea953..48fafba0da 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxFragmentFactoryNoUnusedLocals.js.diff @@ -8,8 +8,4 @@ +const react_1 = require("react"); function Counter({ count = 0 }) { const [cnt, setCnt] = null; -- return (0, react_1.createElement)(react_1.Fragment, null, -- (0, react_1.createElement)("p", null, cnt), -- (0, react_1.createElement)("button", { onClick: () => setCnt((prev) => prev + 1), type: "button" }, "Update")); -+ return (0, react_1.createElement)(react_1.Fragment, null, (0, react_1.createElement)("p", null, cnt), (0, react_1.createElement)("button", { onClick: () => setCnt((prev) => prev + 1), type: "button" }, "Update")); - } \ No newline at end of file + return (0, react_1.createElement)(react_1.Fragment, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js index 314be06f5a..4caa67cbbc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js @@ -43,7 +43,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [two.js] "use strict"; @@ -78,7 +79,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js.diff b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js.diff index 856c8d095f..69d7992f5e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react).js.diff @@ -8,11 +8,8 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [two.js] + exports.frag = React.createElement(React.Fragment, null, +@@= skipped -10, +10 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.selfClosing = exports.frag = exports.HelloWorld = void 0; @@ -46,7 +43,7 @@ //// [four.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -36, +35 lines =@@ +@@= skipped -26, +26 lines =@@ /// /* @jsxRuntime automatic */ /* @jsxRuntime classic */ @@ -54,9 +51,4 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [index.js] - "use strict"; \ No newline at end of file + exports.frag = React.createElement(React.Fragment, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js index 314be06f5a..4caa67cbbc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js @@ -43,7 +43,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [two.js] "use strict"; @@ -78,7 +79,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js.diff b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js.diff index 613dd4f759..d267f42d42 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsx).js.diff @@ -8,11 +8,8 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [two.js] + exports.frag = React.createElement(React.Fragment, null, +@@= skipped -10, +10 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.selfClosing = exports.frag = exports.HelloWorld = void 0; @@ -46,7 +43,7 @@ //// [four.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -36, +35 lines =@@ +@@= skipped -26, +26 lines =@@ /// /* @jsxRuntime automatic */ /* @jsxRuntime classic */ @@ -54,9 +51,4 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [index.js] - "use strict"; \ No newline at end of file + exports.frag = React.createElement(React.Fragment, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js index a0409f1a58..a7b5fb849c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js @@ -43,7 +43,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [two.js] "use strict"; @@ -78,7 +79,8 @@ exports.selfClosing = exports.frag = exports.HelloWorld = void 0; const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; -exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); +exports.frag = React.createElement(React.Fragment, null, + React.createElement("div", null)); exports.selfClosing = React.createElement("img", { src: "./image.png" }); //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js.diff b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js.diff index 5f21695144..20bf9be5a4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=react-jsxdev).js.diff @@ -8,11 +8,8 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [two.js] + exports.frag = React.createElement(React.Fragment, null, +@@= skipped -10, +10 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.selfClosing = exports.frag = exports.HelloWorld = void 0; @@ -48,7 +45,7 @@ //// [four.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -38, +35 lines =@@ +@@= skipped -28, +26 lines =@@ /// /* @jsxRuntime automatic */ /* @jsxRuntime classic */ @@ -56,9 +53,4 @@ +const React = require("react"); const HelloWorld = () => React.createElement("h1", null, "Hello world"); exports.HelloWorld = HelloWorld; --exports.frag = React.createElement(React.Fragment, null, -- React.createElement("div", null)); -+exports.frag = React.createElement(React.Fragment, null, React.createElement("div", null)); - exports.selfClosing = React.createElement("img", { src: "./image.png" }); - //// [index.js] - "use strict"; \ No newline at end of file + exports.frag = React.createElement(React.Fragment, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js b/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js index 5eacef6509..f4c4b661aa 100644 --- a/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js +++ b/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js @@ -44,7 +44,10 @@ const MY_STRING = 'Ceci n\'est pas une string.'; const MY_CLASSNAME = 'jeclass'; class RenderString extends React.PureComponent { render() { - return (React.createElement(React.Fragment, null, React.createElement(my_component_1.MyComponent, null), React.createElement("span", null, MY_STRING), React.createElement("span", { className: MY_CLASSNAME }))); + return (React.createElement(React.Fragment, null, + React.createElement(my_component_1.MyComponent, null), + React.createElement("span", null, MY_STRING), + React.createElement("span", { className: MY_CLASSNAME }))); } } exports.default = RenderString; diff --git a/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js.diff b/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js.diff index faf9661d65..ee5d7d029c 100644 --- a/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js.diff +++ b/testdata/baselines/reference/submodule/compiler/tsxFragmentChildrenCheck.js.diff @@ -10,13 +10,4 @@ +const my_component_1 = require("./my-component"); const MY_STRING = 'Ceci n\'est pas une string.'; const MY_CLASSNAME = 'jeclass'; - class RenderString extends React.PureComponent { - render() { -- return (React.createElement(React.Fragment, null, -- React.createElement(my_component_1.MyComponent, null), -- React.createElement("span", null, MY_STRING), -- React.createElement("span", { className: MY_CLASSNAME }))); -+ return (React.createElement(React.Fragment, null, React.createElement(my_component_1.MyComponent, null), React.createElement("span", null, MY_STRING), React.createElement("span", { className: MY_CLASSNAME }))); - } - } - exports.default = RenderString; \ No newline at end of file + class RenderString extends React.PureComponent { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js index be699a9cb6..71b865abce 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js +++ b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js @@ -33,5 +33,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); const react_1 = __importDefault(require("react")); class ResizablePanel extends react_1.default.Component { } -const test = react_1.default.createElement(ResizablePanel, null, react_1.default.createElement("div", null), react_1.default.createElement("div", null)); -const testErr = react_1.default.createElement(ResizablePanel, null, react_1.default.createElement("div", null), react_1.default.createElement("div", null), react_1.default.createElement("div", null)); +const test = react_1.default.createElement(ResizablePanel, null, + react_1.default.createElement("div", null), + react_1.default.createElement("div", null)); +const testErr = react_1.default.createElement(ResizablePanel, null, + react_1.default.createElement("div", null), + react_1.default.createElement("div", null), + react_1.default.createElement("div", null)); diff --git a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff index f7faf5c777..50f0de8e3c 100644 --- a/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff +++ b/testdata/baselines/reference/submodule/conformance/checkJsxChildrenCanBeTupleType.js.diff @@ -14,12 +14,4 @@ +const react_1 = __importDefault(require("react")); class ResizablePanel extends react_1.default.Component { } --const test = react_1.default.createElement(ResizablePanel, null, -- react_1.default.createElement("div", null), -- react_1.default.createElement("div", null)); --const testErr = react_1.default.createElement(ResizablePanel, null, -- react_1.default.createElement("div", null), -- react_1.default.createElement("div", null), -- react_1.default.createElement("div", null)); -+const test = react_1.default.createElement(ResizablePanel, null, react_1.default.createElement("div", null), react_1.default.createElement("div", null)); -+const testErr = react_1.default.createElement(ResizablePanel, null, react_1.default.createElement("div", null), react_1.default.createElement("div", null), react_1.default.createElement("div", null)); \ No newline at end of file + const test = react_1.default.createElement(ResizablePanel, null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences1.js b/testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences1.js index c75b9dfe77..7816881f4a 100644 --- a/testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences1.js +++ b/testdata/baselines/reference/submodule/conformance/correctlyMarkAliasAsReferences1.js @@ -19,4 +19,5 @@ let k =