Skip to content

Commit

Permalink
Tests: use babel-eslint because eslint@4 cannot parse fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
golopot committed May 5, 2019
1 parent 47f693c commit 45c895b
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions tests/lib/rules/jsx-no-useless-fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,40 @@ const ruleTester = new RuleTester({parserOptions});

ruleTester.run('jsx-no-uselses-fragment', rule, {
valid: [
'<><Foo /><Bar /></>',
'<>foo<div /></>',
'<> <div /></>',
'<>{"moo"} </>',
{
code: '<><Foo /><Bar /></>',
parser: parsers.BABEL_ESLINT
},
{
code: '<>foo<div /></>',
parser: parsers.BABEL_ESLINT
},
{
code: '<> <div /></>',
parser: parsers.BABEL_ESLINT
},
{
code: '<>{"moo"} </>',
parser: parsers.BABEL_ESLINT
},
'<NotFragment />',
'<React.NotFragment />'
],
invalid: [
{
code: '<></>',
errors: [{messageId: 'NeedsMoreChidren', type: 'JSXFragment'}]
errors: [{messageId: 'NeedsMoreChidren', type: 'JSXFragment'}],
parser: parsers.BABEL_ESLINT
},
{
code: '<>foo</>',
errors: [{messageId: 'NeedsMoreChidren'}]
errors: [{messageId: 'NeedsMoreChidren'}],
parser: parsers.BABEL_ESLINT
},
{
code: '<><div/></>',
errors: [{messageId: 'NeedsMoreChidren'}]
errors: [{messageId: 'NeedsMoreChidren'}],
parser: parsers.BABEL_ESLINT
},
{
code: '<Fragment />',
Expand Down

0 comments on commit 45c895b

Please sign in to comment.