Skip to content

Commit

Permalink
Fix tests in eslint < 5
Browse files Browse the repository at this point in the history
  • Loading branch information
kaykayehnn committed Jun 22, 2019
1 parent 0d1aaf8 commit ed04c2f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/lib/rules/jsx-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
const RuleTester = require('eslint').RuleTester;
const rule = require('../../../lib/rules/jsx-key');

const parsers = require('../../helpers/parsers');

const parserOptions = {
ecmaVersion: 2018,
sourceType: 'module',
Expand All @@ -38,8 +40,8 @@ ruleTester.run('jsx-key', rule, {
{code: 'var App = () => <div />;'},
{code: '[1, 2, 3].map(function(x) { return; });'},
{code: 'foo(() => <div />);'},
{code: 'foo(() => <></>);'},
{code: '<></>;'}
{code: 'foo(() => <></>);', parser: parsers.BABEL_ESLINT},
{code: '<></>;', parser: parsers.BABEL_ESLINT}
],
invalid: [{
code: '[<App />];',
Expand All @@ -61,9 +63,11 @@ ruleTester.run('jsx-key', rule, {
errors: [{message: 'Missing "key" prop for element in iterator'}]
}, {
code: '[1, 2, 3].map(x => <>{x}</>);',
parser: parsers.BABEL_ESLINT,
errors: [{message: 'Missing "key" prop for element in iterator. Shorthand fragment syntax does support providing keys'}]
}, {
code: '[<></>];',
parser: parsers.BABEL_ESLINT,
errors: [{message: 'Missing "key" prop for element in array. Shorthand fragment syntax does support providing keys'}]
}]
});

0 comments on commit ed04c2f

Please sign in to comment.