Skip to content

Commit ed04c2f

Browse files
committed
Fix tests in eslint < 5
1 parent 0d1aaf8 commit ed04c2f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/lib/rules/jsx-key.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
const RuleTester = require('eslint').RuleTester;
1313
const rule = require('../../../lib/rules/jsx-key');
1414

15+
const parsers = require('../../helpers/parsers');
16+
1517
const parserOptions = {
1618
ecmaVersion: 2018,
1719
sourceType: 'module',
@@ -38,8 +40,8 @@ ruleTester.run('jsx-key', rule, {
3840
{code: 'var App = () => <div />;'},
3941
{code: '[1, 2, 3].map(function(x) { return; });'},
4042
{code: 'foo(() => <div />);'},
41-
{code: 'foo(() => <></>);'},
42-
{code: '<></>;'}
43+
{code: 'foo(() => <></>);', parser: parsers.BABEL_ESLINT},
44+
{code: '<></>;', parser: parsers.BABEL_ESLINT}
4345
],
4446
invalid: [{
4547
code: '[<App />];',
@@ -61,9 +63,11 @@ ruleTester.run('jsx-key', rule, {
6163
errors: [{message: 'Missing "key" prop for element in iterator'}]
6264
}, {
6365
code: '[1, 2, 3].map(x => <>{x}</>);',
66+
parser: parsers.BABEL_ESLINT,
6467
errors: [{message: 'Missing "key" prop for element in iterator. Shorthand fragment syntax does support providing keys'}]
6568
}, {
6669
code: '[<></>];',
70+
parser: parsers.BABEL_ESLINT,
6771
errors: [{message: 'Missing "key" prop for element in array. Shorthand fragment syntax does support providing keys'}]
6872
}]
6973
});

0 commit comments

Comments
 (0)