Skip to content

Commit fbb1e0f

Browse files
mdjermanovicljharb
authored andcommitted
[Tests] jsx-no-useless-fragment, jsx-fragments, function-component-definition: use output: null to assert no autofix
1 parent 3533e26 commit fbb1e0f

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

tests/lib/rules/function-component-definition.js

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -807,11 +807,7 @@ ruleTester.run('function-component-definition', rule, {
807807
return <div/>;
808808
}
809809
`,
810-
output: `
811-
var Hello: React.FC<Test> = function(props) {
812-
return <div/>;
813-
}
814-
`,
810+
output: null,
815811
options: [{ namedComponents: 'function-declaration' }],
816812
errors: [{ messageId: 'function-declaration' }],
817813
features: ['types'],
@@ -822,11 +818,7 @@ ruleTester.run('function-component-definition', rule, {
822818
return <div/>;
823819
};
824820
`,
825-
output: `
826-
var Hello: React.FC<Test> = (props) => {
827-
return <div/>;
828-
};
829-
`,
821+
output: null,
830822
options: [{ namedComponents: 'function-declaration' }],
831823
errors: [{ messageId: 'function-declaration' }],
832824
features: ['types'],
@@ -852,11 +844,7 @@ ruleTester.run('function-component-definition', rule, {
852844
return <div/>;
853845
}
854846
`,
855-
output: `
856-
function Hello<Test>(props: Test) {
857-
return <div/>;
858-
}
859-
`,
847+
output: null,
860848
options: [{ namedComponents: 'arrow-function' }],
861849
errors: [{ messageId: 'arrow-function' }],
862850
features: ['types'],
@@ -963,13 +951,7 @@ ruleTester.run('function-component-definition', rule, {
963951
}
964952
}
965953
`,
966-
output: `
967-
function wrap(Component) {
968-
return function<Test>(props) {
969-
return <div><Component {...props}/></div>
970-
}
971-
}
972-
`,
954+
output: null,
973955
errors: [{ messageId: 'arrow-function' }],
974956
options: [{ unnamedComponents: 'arrow-function' }],
975957
features: ['types'],

tests/lib/rules/jsx-fragments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ ruleTester.run('jsx-fragments', rule, {
142142
},
143143
{
144144
code: '<><Foo /></>',
145-
output: '<><Foo /></>', // should get '<Act.Frag><Foo /></Act.Frag>', but the old TS parser lacks opening/closing Fragment info
145+
output: null, // should get '<Act.Frag><Foo /></Act.Frag>', but the old TS parser lacks opening/closing Fragment info
146146
features: ['fragment', 'no-babel', 'ts', 'no-ts-new'],
147147
options: ['element'],
148148
settings,

tests/lib/rules/jsx-no-useless-fragment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ ruleTester.run('jsx-no-useless-fragment', rule, {
194194
},
195195
{
196196
code: '<div><>{"a"}{"b"}</></div>',
197-
output: '<div><>{"a"}{"b"}</></div>',
197+
output: null,
198198
errors: [{ messageId: 'ChildOfHtmlElement', type: 'JSXFragment' }],
199199
features: ['fragment', 'ts-old', 'no-ts-new', 'no-babel', 'no-default'],
200200
},

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy