Skip to content

Commit f87646f

Browse files
author
Roy Sutton
committed
Add tests for non-react class
1 parent ab1631d commit f87646f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/lib/rules/sort-comp.js

+28
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,34 @@ ruleTester.run('sort-comp', rule, {
248248
'render'
249249
]
250250
}]
251+
}, {
252+
// Non-react classes should be ignored, even in expressions
253+
code: [
254+
'return class Hello {',
255+
' render() {',
256+
' return <div>{this.props.text}</div>;',
257+
' }',
258+
' props: { text: string };',
259+
' constructor() {}',
260+
' state: Object = {};',
261+
'}'
262+
].join('\n'),
263+
parser: 'babel-eslint',
264+
parserOptions: parserOptions
265+
}, {
266+
// Non-react classes should be ignored, even in expressions
267+
code: [
268+
'return class {',
269+
' render() {',
270+
' return <div>{this.props.text}</div>;',
271+
' }',
272+
' props: { text: string };',
273+
' constructor() {}',
274+
' state: Object = {};',
275+
'}'
276+
].join('\n'),
277+
parser: 'babel-eslint',
278+
parserOptions: parserOptions
251279
}],
252280

253281
invalid: [{

0 commit comments

Comments
 (0)