ESLint tells me this error message inside my JS module: error no-unneeded-trernary Unnecessary use of conditional expression for default assignment
Error in get
method on return
return val ? val : defaultVal;
return val ? val : defaultVal;
?
import ls from 'local-storage'; export default { get(key, defaultVal = null) { var val = ls(key); return val ? val : defaultVal; }, set(key, val) { return ls(key, val); }, remove(key) { return ls.remove(key); }, };
Any idea why I am getting this error message? I found some resource on the ESLint website regarding this error message here , but it is applicable to boolean expressions, and I cannot understand why this is applicable to my code ...
source share