@@ -327,6 +327,78 @@ ruleTester.run('prefer-stateless-function', rule, {
327
327
` ,
328
328
options : [ { ignorePureComponents : true } ] ,
329
329
} ,
330
+ {
331
+ code : `
332
+ import React, {PureComponent, PropTypes} from 'react'
333
+
334
+ export default function errorDecorator (options) {
335
+ return WrappedComponent => {
336
+ class Wrapper extends PureComponent {
337
+ static propTypes = {
338
+ error: PropTypes.string
339
+ }
340
+ render () {
341
+ const {error, ...props} = this.props
342
+ if (error) {
343
+ return <div>Error! {error}</div>
344
+ } else {
345
+ return <WrappedComponent {...props} />
346
+ }
347
+ }
348
+ }
349
+ return Wrapper
350
+ }
351
+ }
352
+ ` ,
353
+ features : [ 'class fields' ] ,
354
+ options : [ { ignorePureComponents : true } ] ,
355
+ } ,
356
+ {
357
+ code : `
358
+ import React, {PureComponent, PropTypes} from 'react'
359
+
360
+ export default function errorDecorator (options) {
361
+ return WrappedComponent =>
362
+ class Wrapper extends PureComponent {
363
+ static propTypes = {
364
+ error: PropTypes.string
365
+ }
366
+ render () {
367
+ const {error, ...props} = this.props
368
+ if (error) {
369
+ return <div>Error! {error}</div>
370
+ } else {
371
+ return <WrappedComponent {...props} />
372
+ }
373
+ }
374
+ }
375
+ }
376
+ ` ,
377
+ features : [ 'class fields' ] ,
378
+ options : [ { ignorePureComponents : true } ] ,
379
+ } ,
380
+ {
381
+ code : `
382
+ export default function errorDecorator (options) {
383
+ return WrappedComponent =>
384
+ class Wrapper extends React.PureComponent {
385
+ static propTypes = {
386
+ error: PropTypes.string
387
+ }
388
+ render () {
389
+ const {error, ...props} = this.props
390
+ if (error) {
391
+ return <div>Error! {error}</div>
392
+ } else {
393
+ return <WrappedComponent {...props} />
394
+ }
395
+ }
396
+ }
397
+ }
398
+ ` ,
399
+ features : [ 'class fields' ] ,
400
+ options : [ { ignorePureComponents : true } ] ,
401
+ } ,
330
402
] ) ,
331
403
332
404
invalid : parsers . all ( [
0 commit comments