File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
javascript/ql/test/query-tests/React/UnusedOrUndefinedStateProperty Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,10 @@ class C1 extends React.Component {
99 }
1010}
1111
12- class C2 extends React . Component {
12+ class C2 extends React . Component { // $ Alert
1313
1414 state = {
15- p1 : ''
15+ p1 : '' // $ RelatedLocation
1616 }
1717
1818 static getDerivedStateFromProps_unmodeled ( props , state ) {
Original file line number Diff line number Diff line change 1- class C1 extends React . Component {
1+ class C1 extends React . Component { // $ Alert
22 constructor ( ) {
33 this . state . writtenDirectly = 42 ;
44 this . setState ( {
55 writtenInSetState : 42
66 } ) ;
77 this . state . writtenInOtherMethod ;
8- this . state . notWritten ; // $ MISSING: Alert
9- this . state . notWrittenButReadInChain ; // $ MISSING: Alert
8+ this . state . notWritten ; // $ RelatedLocation
9+ this . state . notWrittenButReadInChain ; // $ RelatedLocation
1010 this . state . writtenDirectly ;
1111 this . state . writtenInSetState ;
1212
@@ -29,10 +29,10 @@ class C2 extends React.Component {
2929}
3030
3131
32- class C3 extends React . Component {
32+ class C3 extends React . Component { // $ Alert
3333 constructor ( ) {
3434 this . state . writtenThrougExternalPropertyAccess ;
35- this . state . notWrittenThrougExternalPropertyAccess ; // $ MISSING: Alert
35+ this . state . notWrittenThrougExternalPropertyAccess ; // $ RelatedLocation
3636 }
3737}
3838
Original file line number Diff line number Diff line change 1- class C1 extends React . Component {
1+ class C1 extends React . Component { // $ Alert
22 constructor ( ) {
33 this . state . readDirectly = 42 ;
44 this . state . readInChain = { } ;
55 this . state . readInOtherMethod = { } ;
6- this . state . notRead = 42 ; // $ MISSING: Alert
6+ this . state . notRead = 42 ; // $ RelatedLocation
77 this . state . readDirectly ;
88 this . state . readInChain . foo ;
99 }
@@ -24,10 +24,10 @@ class C2 extends React.Component {
2424}
2525
2626
27- class C3 extends React . Component {
27+ class C3 extends React . Component { // $ Alert
2828 constructor ( ) {
2929 this . state . readThrougExternaPropertyAccess = 42 ;
30- this . state . notReadThrougExternaPropertyAccess = 42 ; // $ MISSING: Alert
30+ this . state . notReadThrougExternaPropertyAccess = 42 ; // $ RelatedLocation
3131 }
3232}
3333
You can’t perform that action at this time.
0 commit comments