Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanwullems committed Aug 30, 2020
1 parent a5b7dcf commit 0a9c2cb
Showing 1 changed file with 69 additions and 1 deletion.
70 changes: 69 additions & 1 deletion tests/lib/rules/function-component-definition.js
Expand Up @@ -166,8 +166,76 @@ ruleTester.run('function-component-definition', rule, {
code: 'function Hello(props): ReactNode { return <p/> }',
options: [{namedComponents: 'function-declaration'}],
parser: parsers.TYPESCRIPT_ESLINT
},
// https://github.com/yannickcr/eslint-plugin-react/issues/2765
{
code: [
'const obj = {',
' serialize: (el) => {',
' return <p/>',
' }',
'}'
].join('\n'),
options: [{namedComponents: 'function-declaration'}]
}, {
code: [
'const obj = {',
' serialize: (el) => {',
' return <p/>',
' }',
'}'
].join('\n'),
options: [{namedComponents: 'function-expression'}]
},
{
code: [
'const obj = {',
' serialize: function (el) {',
' return <p/>',
' }',
'}'
].join('\n'),
options: [{namedComponents: 'function-declaration'}]
}, {
// https://github.com/yannickcr/eslint-plugin-react/issues/2765
code: [
'const obj = {',
' serialize: function (el) {',
' return <p/>',
' }',
'}'
].join('\n'),
options: [{namedComponents: 'arrow-function'}]
},
{
code: [
'const obj = {',
' serialize(el) {',
' return <p/>',
' }',
'}'
].join('\n'),
options: [{namedComponents: 'function-expression'}]
}, {
code: [
'const obj = {',
' serialize(el) {',
' return <p/>',
' }',
'}'
].join('\n'),
options: [{namedComponents: 'arrow-function'}]
},
{
code: [
'const obj = {',
' serialize: (el) => {',
' return <p/>',
' }',
'}'
].join('\n'),
options: [{unnamedComponents: 'function-expression'}]
},
{
code: [
'const obj = {',
' serialize(el) {',
Expand Down

0 comments on commit 0a9c2cb

Please sign in to comment.