Skip to content

Commit 4834dd6

Browse files
committed
Fixed code style, added more tests
1 parent e8cef50 commit 4834dd6

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

lib/rules/jsx-one-expression-per-line.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ module.exports = {
6565
return;
6666
}
6767

68-
if (options.allow === 'non-jsx'
69-
&& !children.find((child) => (child.type === 'JSXFragment' || child.type === 'JSXElement'))) {
68+
if (
69+
options.allow === 'non-jsx'
70+
&& !children.find((child) => (child.type === 'JSXFragment' || child.type === 'JSXElement'))
71+
) {
7072
return;
7173
}
7274

tests/lib/rules/jsx-one-expression-per-line.js

+21
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,27 @@ ruleTester.run('jsx-one-expression-per-line', rule, {
211211
</App>`,
212212
options: [{ allow: 'non-jsx' }],
213213
},
214+
{
215+
code: `
216+
<App>
217+
Hello {<Bar />} there!
218+
</App>`,
219+
options: [{ allow: 'non-jsx' }],
220+
},
221+
{
222+
code: `
223+
<App>
224+
Hello {(<Bar />)} there!
225+
</App>`,
226+
options: [{ allow: 'non-jsx' }],
227+
},
228+
{
229+
code: `
230+
<App>
231+
Hello {(() => <Bar />)()} there!
232+
</App>`,
233+
options: [{ allow: 'non-jsx' }],
234+
},
214235
]),
215236

216237
invalid: parsers.all([

0 commit comments

Comments
 (0)