diff --git a/tests/lib/rules/jsx-curly-brace-presence.js b/tests/lib/rules/jsx-curly-brace-presence.js
index 259b9538b2..70fd884030 100755
--- a/tests/lib/rules/jsx-curly-brace-presence.js
+++ b/tests/lib/rules/jsx-curly-brace-presence.js
@@ -483,14 +483,14 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
invalid: parsers.all([].concat(
{
code: '',
- output: '',
options: [{ props: 'never' }],
+ output: '',
errors: [{ messageId: 'unnecessaryCurly' }],
},
{
code: '{}',
- output: '',
options: [{ children: 'never' }],
+ output: '',
errors: [{ messageId: 'unnecessaryCurly' }],
},
{
@@ -500,21 +500,21 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
},
{
code: 'foo',
- output: 'foo',
options: [{ props: 'never' }],
+ output: 'foo',
errors: [{ messageId: 'unnecessaryCurly' }],
},
{
code: '{`foo`}',
- output: 'foo',
options: [{ children: 'never' }],
+ output: 'foo',
errors: [{ messageId: 'unnecessaryCurly' }],
},
{
code: '<>{`foo`}>',
- output: '<>foo>',
- features: ['fragment'],
options: [{ children: 'never' }],
+ features: ['fragment'],
+ output: '<>foo>',
errors: [{ messageId: 'unnecessaryCurly' }],
},
{
@@ -529,14 +529,14 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
},
{
code: `{'foo'}`,
- output: 'foo',
options: [{ children: 'never' }],
+ output: 'foo',
errors: [{ messageId: 'unnecessaryCurly' }],
},
{
code: `foo`,
- output: 'foo',
options: [{ props: 'never' }],
+ output: 'foo',
errors: [{ messageId: 'unnecessaryCurly' }],
},
{
@@ -545,12 +545,12 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
{'%'}
`,
+ options: [{ children: 'never' }],
output: `
%
`,
- options: [{ children: 'never' }],
errors: [{ messageId: 'unnecessaryCurly' }],
},
{
@@ -563,6 +563,7 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
{'baz'}
`,
+ options: [{ children: 'never' }],
output: `
foo
@@ -572,7 +573,6 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
baz
`,
- options: [{ children: 'never' }],
errors: [
{ messageId: 'unnecessaryCurly' },
{ messageId: 'unnecessaryCurly' },
@@ -600,8 +600,8 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
{'some-complicated-exp'}
`,
- features: ['no-default', 'no-ts-new', 'no-babel-new'], // TODO: FIXME: remove no-default and no-ts-new and fix
options: [{ children: 'never' }],
+ features: ['no-default', 'no-ts-new', 'no-babel-new'], // TODO: FIXME: remove no-default and no-ts-new and fix
errors: [
{ messageId: 'unnecessaryCurly', line: 3 },
{ messageId: 'unnecessaryCurly', line: 5 },
@@ -619,6 +619,9 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
{'some-complicated-exp'}
`,
+ options: [{ children: 'never' }],
+ parser: parsers['@BABEL_ESLINT'],
+ parserOptions: parsers.babelParserOptions({}, new Set()),
output: `
foo
@@ -629,9 +632,6 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
some-complicated-exp
`,
- parser: parsers['@BABEL_ESLINT'],
- parserOptions: parsers.babelParserOptions({}, new Set()),
- options: [{ children: 'never' }],
errors: [
{ messageId: 'unnecessaryCurly', line: 3 },
{ messageId: 'unnecessaryCurly', line: 5 },
@@ -641,143 +641,147 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
} : [],
{
code: `foo`,
- output: 'foo',
options: [{ props: 'always' }],
+ output: 'foo',
errors: [{ messageId: 'missingCurly' }],
},
{
code: `foo`,
- output: `foo`,
options: [{ props: 'always' }],
+ output: `foo`,
errors: [{ messageId: 'missingCurly' }],
},
{
code: `foo`,
- output: `foo`,
options: [{ props: 'always' }],
+ output: `foo`,
errors: [{ messageId: 'missingCurly' }],
},
{
code: 'foo bar ',
- output: `{"foo bar "}`,
options: [{ children: 'always' }],
+ output: `{"foo bar "}`,
errors: [{ messageId: 'missingCurly' }],
},
{
code: `foo`,
- output: `foo`,
options: [{ props: 'always' }],
+ output: `foo`,
errors: [{ messageId: 'missingCurly' }],
},
{
code: 'foo bar \\r ',
- output: '{"foo bar \\\\r "}',
options: [{ children: 'always' }],
+ output: '{"foo bar \\\\r "}',
errors: [{ messageId: 'missingCurly' }],
},
{
code: `foo bar 'foo'`,
- output: `{"foo bar 'foo'"}`,
options: [{ children: 'always' }],
+ output: `{"foo bar 'foo'"}`,
errors: [{ messageId: 'missingCurly' }],
},
{
code: 'foo bar "foo"',
- output: '{"foo bar \\"foo\\""}',
options: [{ children: 'always' }],
+ output: '{"foo bar \\"foo\\""}',
errors: [{ messageId: 'missingCurly' }],
},
{
code: 'foo bar ',
- output: '{"foo bar "}',
options: [{ children: 'always' }],
+ output: '{"foo bar "}',
errors: [{ messageId: 'missingCurly' }],
},
{
code: 'foo \\n bar',
- output: '{"foo \\\\n bar"}',
options: [{ children: 'always' }],
+ output: '{"foo \\\\n bar"}',
errors: [{ messageId: 'missingCurly' }],
},
{
code: 'foo \\u1234 bar',
- output: '{"foo \\\\u1234 bar"}',
options: [{ children: 'always' }],
+ output: '{"foo \\\\u1234 bar"}',
errors: [{ messageId: 'missingCurly' }],
},
{
code: ``,
- output: '',
options: [{ props: 'always' }],
+ output: '',
errors: [{ messageId: 'missingCurly' }],
},
{
code: `{'foo'}`,
- output: 'foo',
options: ['never'],
+ output: 'foo',
errors: [
- { messageId: 'unnecessaryCurly' }, { messageId: 'unnecessaryCurly' },
+ { messageId: 'unnecessaryCurly' },
+ { messageId: 'unnecessaryCurly' },
],
},
{
code: `foo`,
- output: '{"foo"}',
options: ['always'],
+ output: '{"foo"}',
errors: [
- { messageId: 'missingCurly' }, { messageId: 'missingCurly' },
+ { messageId: 'missingCurly' },
+ { messageId: 'missingCurly' },
],
},
{
code: ``,
+ options: [{ props: 'never' }],
output: '',
errors: [
- { messageId: 'unnecessaryCurly' }, { messageId: 'unnecessaryCurly' },
+ { messageId: 'unnecessaryCurly' },
+ { messageId: 'unnecessaryCurly' },
],
- options: [{ props: 'never' }],
},
{
code: ``,
+ options: [{ props: 'always' }],
output: '',
errors: [
- { messageId: 'missingCurly' }, { messageId: 'missingCurly' },
+ { messageId: 'missingCurly' },
+ { messageId: 'missingCurly' },
],
- options: [{ props: 'always' }],
},
{
code: ``,
+ options: [{ props: 'always' }],
output: ``,
errors: [{ messageId: 'missingCurly' }],
- options: [{ props: 'always' }],
},
{
code: ``,
+ options: [{ props: 'always' }],
output: ``,
errors: [{ messageId: 'missingCurly' }],
- options: [{ props: 'always' }],
},
{
code: ``,
- errors: [{ messageId: 'missingCurly' }],
options: [{ props: 'always' }],
output: ``,
+ errors: [{ messageId: 'missingCurly' }],
},
{
code: 'foo · bar',
- errors: [{ messageId: 'missingCurly' }],
options: [{ children: 'always' }],
output: '{"foo · bar"}',
+ errors: [{ messageId: 'missingCurly' }],
},
{
code: `{'foo "bar"'}`,
+ options: [{ children: 'never' }],
output: `foo "bar"`,
errors: [{ messageId: 'unnecessaryCurly' }],
- options: [{ children: 'never' }],
},
{
code: `{"foo 'bar'"}`,
+ options: [{ children: 'never' }],
output: `foo 'bar'`,
errors: [{ messageId: 'unnecessaryCurly' }],
- options: [{ children: 'never' }],
},
{
code: `
@@ -791,9 +795,6 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
d${' '}
`,
- errors: [
- { messageId: 'missingCurly' }, { messageId: 'missingCurly' },
- ],
options: ['always'],
output: `
`,
+ errors: [
+ { messageId: 'missingCurly' },
+ { messageId: 'missingCurly' },
+ ],
},
{
code: `
@@ -819,9 +824,6 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
d${' '}
`,
- errors: [
- { messageId: 'missingCurly' }, { messageId: 'missingCurly' },
- ],
options: ['always'],
output: `
`,
+ errors: [
+ { messageId: 'missingCurly' },
+ { messageId: 'missingCurly' },
+ ],
},
{
code: `
@@ -848,6 +854,7 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
`,
+ options: [{ children: 'always' }],
output: `
{"foo bar"}
@@ -867,7 +874,6 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
{ messageId: 'missingCurly' },
{ messageId: 'missingCurly' },
],
- options: [{ children: 'always' }],
},
{
code: `
@@ -877,6 +883,7 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
`,
+ options: [{ children: 'always' }],
output: `
<{"Component"}>
@@ -885,61 +892,58 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
`,
errors: [{ messageId: 'missingCurly' }],
- options: [{ children: 'always' }],
},
{
code: `
`,
+ options: [{ props: 'never' }],
output: `
`,
- errors: [
- { messageId: 'unnecessaryCurly' },
- ],
- options: [{ props: 'never' }],
+ errors: [{ messageId: 'unnecessaryCurly' }],
},
{
code: `
`,
+ options: ['never'],
output: `
`,
errors: [{ messageId: 'unnecessaryCurly' }],
- options: ['never'],
},
{
code: 'bar',
+ options: ['never'],
output: 'bar',
errors: [{ messageId: 'unnecessaryCurly' }],
- options: ['never'],
},
{
code: '"}>foo',
+ options: ['never'],
output: 'foo',
errors: [{ messageId: 'unnecessaryCurly' }],
- options: ['never'],
},
{
code: ` />`,
- output: `} />`,
- errors: [{ messageId: 'missingCurly' }],
options: [{ props: 'always', children: 'always', propElementValues: 'always' }],
features: ['no-ts'],
+ output: `} />`,
+ errors: [{ messageId: 'missingCurly' }],
},
{
code: `} />`,
- output: ` />`,
- errors: [{ messageId: 'unnecessaryCurly' }],
options: [{ props: 'never', children: 'never', propElementValues: 'never' }],
features: ['no-ts'],
+ output: ` />`,
+ errors: [{ messageId: 'unnecessaryCurly' }],
},
{
code: ``,
+ options: [{ props: 'never', children: 'never', propElementValues: 'never' }],
output: ``,
errors: [{ messageId: 'unnecessaryCurly' }],
- options: [{ props: 'never', children: 'never', propElementValues: 'never' }],
- }
+ },
)),
});