Skip to content

Commit 87ed86e

Browse files
committed
JS: Update UnusedOrUndefinedStateProperty
Using RelatedLocations to add clarity
1 parent 6059994 commit 87ed86e

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

javascript/ql/test/query-tests/Expressions/ImplicitOperandConversion/tst.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function l() {
7474
x ** 2; // $ Alert
7575
}
7676

77-
1n + 1; // $ MISSED: Alert
77+
1n + 1; // $ MISSING: Alert
7878

7979
(function(){
8080
let sum = 0;

javascript/ql/test/query-tests/Expressions/MissingAwait/tst.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function useThingPossiblySync(b) {
5959

6060
if (thing == null) {}
6161

62-
return thing + "bar"; // $ MISSED: Alert
62+
return thing + "bar"; // $ MISSING: Alert
6363
}
6464

6565
function useThingInVoid() {

javascript/ql/test/query-tests/Expressions/SuspiciousInvocation/eval.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function foo() {
66

77
function bar() {
88
var g;
9-
g(); // $ MISSED: Alert
9+
g(); // $ MISSING: Alert
1010
eval("g = alert");
1111
}
1212

javascript/ql/test/query-tests/LanguageFeatures/IllegalInvocation/tst.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let c = new C();
1212
C(); // $ Alert
1313
new (x=>x); // $ Alert
1414
c.m();
15-
new c.m(); // $ MISSED: Alert
15+
new c.m(); // $ MISSING: Alert
1616

1717
var o = {
1818
f: function() {},
@@ -21,7 +21,7 @@ var o = {
2121
o.f();
2222
new o.f();
2323
o.g();
24-
new o.g(); // $ MISSED: Alert
24+
new o.g(); // $ MISSING: Alert
2525

2626
function f(b) {
2727
var g;

javascript/ql/test/query-tests/React/UnusedOrUndefinedStateProperty/issue7506.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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) {

javascript/ql/test/query-tests/React/UnusedOrUndefinedStateProperty/undefined.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
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; // $ Alert
9-
this.state.notWrittenButReadInChain; // $ 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; // $ Alert
35+
this.state.notWrittenThrougExternalPropertyAccess; // $ RelatedLocation
3636
}
3737
}
3838

javascript/ql/test/query-tests/React/UnusedOrUndefinedStateProperty/unused.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
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; // $ Alert
6+
this.state.notRead = 42; // $ RelatedLocation
77
this.state.readDirectly;
88
this.state.readInChain.foo;
99
}
@@ -18,16 +18,16 @@ function f(s){
1818
}
1919
class C2 extends React.Component {
2020
constructor() {
21-
this.state.readWhenEscaped = 42; // $ Alert
21+
this.state.readWhenEscaped = 42; // $ MISSING: Alert
2222
f(this.state);
2323
}
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; // $ Alert
30+
this.state.notReadThrougExternaPropertyAccess = 42; // $ RelatedLocation
3131
}
3232
}
3333

0 commit comments

Comments
 (0)