the js/use-of-returnless-function query now support multiple callees

This commit is contained in:
Erik Krogh Kristensen
2019-10-02 15:37:24 +02:00
parent 7025ba36c0
commit 1bbe1ecdba
3 changed files with 18 additions and 6 deletions

View File

@@ -1,3 +1,5 @@
| tst.js:20:17:20:33 | onlySideEffects() | the function $@ does not return anything, yet the return value is used. | tst.js:11:5:13:5 | functio ... )\\n } | onlySideEffects |
| tst.js:24:13:24:29 | onlySideEffects() | the function $@ does not return anything, yet the return value is used. | tst.js:11:5:13:5 | functio ... )\\n } | onlySideEffects |
| tst.js:30:20:30:36 | onlySideEffects() | the function $@ does not return anything, yet the return value is used. | tst.js:11:5:13:5 | functio ... )\\n } | onlySideEffects |
| tst.js:53:10:53:34 | bothOnl ... fects() | the function $@ does not return anything, yet the return value is used. | tst.js:11:5:13:5 | functio ... )\\n } | bothOnlyHaveSideEffects |
| tst.js:53:10:53:34 | bothOnl ... fects() | the function $@ does not return anything, yet the return value is used. | tst.js:48:2:50:5 | functio ... )\\n } | bothOnlyHaveSideEffects |

View File

@@ -44,4 +44,16 @@
var e = myObj.onlySideEffects.apply(this, arguments); // NOT OK!
console.log(e);
function onlySideEffects2() {
console.log("Boo!")
}
var bothOnlyHaveSideEffects = Math.random() > 0.5 ? onlySideEffects : onlySideEffects2;
var f = bothOnlyHaveSideEffects(); // NOT OK!
console.log(f);
var oneOfEach = Math.random() > 0.5 ? onlySideEffects : returnsValue;
var g = oneOfEach(); // OK
console.log(g);
})();