On this code lines I get an error from ESLint. The code works but ESLint is throwing an error. This code lines should toggle my boolean value.
var show = false;
function toggleVisible () {
return show ? false : true;
}
Error:
error Unnecessary use of boolean literals
in conditional expression no-unneeded-ternary
The error comes up because you are using a short hand statement which is not needed here. Simply try it this way by using boolean negation:
var show = false;
function toggleVisible () {
return !show;
}