@@ -829,10 +829,10 @@ ruleTester.run('no-unused-prop-types', rule, {
829
829
type PropsA = { a: string }
830
830
type PropsB = { b: string }
831
831
type Props = PropsA & PropsB;
832
-
832
+
833
833
class MyComponent extends React.Component {
834
834
props: Props;
835
-
835
+
836
836
render() {
837
837
return <div>{this.props.a} - {this.props.b}</div>
838
838
}
@@ -848,7 +848,7 @@ ruleTester.run('no-unused-prop-types', rule, {
848
848
849
849
class Bar extends React.Component {
850
850
props: Props & PropsC;
851
-
851
+
852
852
render() {
853
853
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap}</div>
854
854
}
@@ -864,7 +864,7 @@ ruleTester.run('no-unused-prop-types', rule, {
864
864
865
865
class Bar extends React.Component {
866
866
props: Props & PropsC;
867
-
867
+
868
868
render() {
869
869
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap}</div>
870
870
}
@@ -876,12 +876,12 @@ ruleTester.run('no-unused-prop-types', rule, {
876
876
type PropsB = { foo: string };
877
877
type PropsC = { bar: string };
878
878
type Props = PropsB & {
879
- zap: string
879
+ zap: string
880
880
};
881
881
882
882
class Bar extends React.Component {
883
883
props: Props & PropsC;
884
-
884
+
885
885
render() {
886
886
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap}</div>
887
887
}
@@ -893,12 +893,12 @@ ruleTester.run('no-unused-prop-types', rule, {
893
893
type PropsB = { foo: string };
894
894
type PropsC = { bar: string };
895
895
type Props = {
896
- zap: string
896
+ zap: string
897
897
} & PropsB;
898
898
899
899
class Bar extends React.Component {
900
900
props: Props & PropsC;
901
-
901
+
902
902
render() {
903
903
return <div>{this.props.foo} - {this.props.bar} - {this.props.zap}</div>
904
904
}
@@ -2110,6 +2110,24 @@ ruleTester.run('no-unused-prop-types', rule, {
2110
2110
] . join ( '\n' ) ,
2111
2111
parser : 'babel-eslint' ,
2112
2112
options : [ { skipShapeProps : false } ]
2113
+ } , {
2114
+ // issue #1506
2115
+ code : [
2116
+ 'class MyComponent extends React.Component {' ,
2117
+ ' onFoo() {' ,
2118
+ ' this.setState((prevState, props) => {' ,
2119
+ ' props.doSomething();' ,
2120
+ ' });' ,
2121
+ ' }' ,
2122
+ ' render() {' ,
2123
+ ' return (' ,
2124
+ ' <div onClick={this.onFoo}>Test</div>' ,
2125
+ ' );' ,
2126
+ ' }' ,
2127
+ '}'
2128
+ ] . join ( '\n' ) ,
2129
+ parser : 'babel-eslint' ,
2130
+ options : [ { skipShapeProps : false } ]
2113
2131
} , {
2114
2132
// issue #106
2115
2133
code : `
@@ -2796,10 +2814,10 @@ ruleTester.run('no-unused-prop-types', rule, {
2796
2814
type PropsA = { a: string }
2797
2815
type PropsB = { b: string }
2798
2816
type Props = PropsA & PropsB;
2799
-
2817
+
2800
2818
class MyComponent extends React.Component {
2801
2819
props: Props;
2802
-
2820
+
2803
2821
render() {
2804
2822
return <div>{this.props.a}</div>
2805
2823
}
@@ -2818,7 +2836,7 @@ ruleTester.run('no-unused-prop-types', rule, {
2818
2836
2819
2837
class Bar extends React.Component {
2820
2838
props: Props & PropsC;
2821
-
2839
+
2822
2840
render() {
2823
2841
return <div>{this.props.foo} - {this.props.bar}</div>
2824
2842
}
@@ -2833,12 +2851,12 @@ ruleTester.run('no-unused-prop-types', rule, {
2833
2851
type PropsB = { foo: string };
2834
2852
type PropsC = { bar: string };
2835
2853
type Props = PropsB & {
2836
- zap: string
2854
+ zap: string
2837
2855
};
2838
2856
2839
2857
class Bar extends React.Component {
2840
2858
props: Props & PropsC;
2841
-
2859
+
2842
2860
render() {
2843
2861
return <div>{this.props.foo} - {this.props.bar}</div>
2844
2862
}
@@ -2853,12 +2871,12 @@ ruleTester.run('no-unused-prop-types', rule, {
2853
2871
type PropsB = { foo: string };
2854
2872
type PropsC = { bar: string };
2855
2873
type Props = {
2856
- zap: string
2874
+ zap: string
2857
2875
} & PropsB;
2858
2876
2859
2877
class Bar extends React.Component {
2860
2878
props: Props & PropsC;
2861
-
2879
+
2862
2880
render() {
2863
2881
return <div>{this.props.foo} - {this.props.bar}</div>
2864
2882
}
0 commit comments