Skip to content

Commit 2165858

Browse files
committed
jsx-curly-spacing: support shorthand fragments
1 parent 6cf535a commit 2165858

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/rules/jsx-curly-spacing.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ module.exports = {
331331
break;
332332

333333
case 'JSXElement':
334+
case 'JSXFragment':
334335
config = childrenConfig;
335336
break;
336337

tests/lib/rules/jsx-curly-spacing.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,9 @@ ruleTester.run('jsx-curly-spacing', rule, {
677677
'`}</App>'
678678
].join('\n'),
679679
options: [{children: {when: 'never', allowMultiline: false}}]
680+
}, {
681+
code: '<>{bar} {baz}</>;',
682+
parser: 'babel-eslint'
680683
}],
681684

682685
invalid: [{
@@ -738,6 +741,16 @@ ruleTester.run('jsx-curly-spacing', rule, {
738741
}, {
739742
message: 'There should be no space before \'}\''
740743
}]
744+
}, {
745+
code: '<>{ bar }</>;',
746+
output: '<>{bar}</>;',
747+
parser: 'babel-eslint',
748+
options: [{children: true}],
749+
errors: [{
750+
message: 'There should be no space after \'{\''
751+
}, {
752+
message: 'There should be no space before \'}\''
753+
}]
741754
}, {
742755
code: '<App>{ { bar: true, baz: true } }</App>;',
743756
output: '<App>{{ bar: true, baz: true }}</App>;',

0 commit comments

Comments
 (0)