@@ -179,7 +179,7 @@ ruleTester.run('forbid-prop-types', rule, {
179
179
} , {
180
180
// Proptypes declared with a spread property
181
181
code : [
182
- 'class Test extends react .component {' ,
182
+ 'class Test extends React .component {' ,
183
183
' static propTypes = {' ,
184
184
' intl: React.propTypes.number,' ,
185
185
' ...propTypes' ,
@@ -190,7 +190,7 @@ ruleTester.run('forbid-prop-types', rule, {
190
190
} , {
191
191
// Proptypes declared with a spread property
192
192
code : [
193
- 'class Test extends react .component {' ,
193
+ 'class Test extends React .component {' ,
194
194
' static get propTypes() {' ,
195
195
' return {' ,
196
196
' intl: React.propTypes.number,' ,
@@ -351,7 +351,7 @@ ruleTester.run('forbid-prop-types', rule, {
351
351
} , {
352
352
// Proptypes declared with a spread property
353
353
code : [
354
- 'class Test extends react .component {' ,
354
+ 'class Test extends React .component {' ,
355
355
' static childContextTypes = {' ,
356
356
' intl: React.childContextTypes.number,' ,
357
357
' ...childContextTypes' ,
@@ -363,7 +363,7 @@ ruleTester.run('forbid-prop-types', rule, {
363
363
} , {
364
364
// Proptypes declared with a spread property
365
365
code : [
366
- 'class Test extends react .component {' ,
366
+ 'class Test extends React .component {' ,
367
367
' static get childContextTypes() {' ,
368
368
' return {' ,
369
369
' intl: React.childContextTypes.number,' ,
@@ -525,7 +525,7 @@ ruleTester.run('forbid-prop-types', rule, {
525
525
} , {
526
526
// Proptypes declared with a spread property
527
527
code : [
528
- 'class Test extends react .component {' ,
528
+ 'class Test extends React .component {' ,
529
529
' static childContextTypes = {' ,
530
530
' intl: React.childContextTypes.number,' ,
531
531
' ...childContextTypes' ,
@@ -537,7 +537,7 @@ ruleTester.run('forbid-prop-types', rule, {
537
537
} , {
538
538
// Proptypes declared with a spread property
539
539
code : [
540
- 'class Test extends react .component {' ,
540
+ 'class Test extends React .component {' ,
541
541
' static get childContextTypes() {' ,
542
542
' return {' ,
543
543
' intl: React.childContextTypes.number,' ,
@@ -547,6 +547,28 @@ ruleTester.run('forbid-prop-types', rule, {
547
547
'}'
548
548
] . join ( '\n' ) ,
549
549
options : [ { checkChildContextTypes : true } ]
550
+ } , {
551
+ code : [
552
+ 'class TestComponent extends React.Component {' ,
553
+ ' static defaultProps = function () {' ,
554
+ ' const date = new Date();' ,
555
+ ' return {' ,
556
+ ' date' ,
557
+ ' };' ,
558
+ ' }();' ,
559
+ '}'
560
+ ] . join ( '\n' ) ,
561
+ parser : 'babel-eslint'
562
+ } , {
563
+ code : [
564
+ 'class HeroTeaserList extends React.Component {' ,
565
+ ' render() { return null; }' ,
566
+ '}' ,
567
+ 'HeroTeaserList.propTypes = Object.assign({' ,
568
+ ' heroIndex: PropTypes.number,' ,
569
+ ' preview: PropTypes.bool,' ,
570
+ '}, componentApi, teaserListProps);'
571
+ ] . join ( '\n' )
550
572
} ] ,
551
573
552
574
invalid : [ {
0 commit comments