简体   繁体   English

错误:在条件表达式中不必要地使用布尔文字

[英]Error: Unnecessary use of boolean literals in conditional expression

I am trying this code with ESLint我正在用 ESLint 尝试这个代码

Code snippet:代码片段:

if (disableFutureDates) {
    return isActiveDate < 0 ? true : false; //error
  }

Got this ESLint error: error Unnecessary use of boolean literals in conditional expression.得到这个 ESLint 错误:错误在条件表达式中不必要地使用布尔文字。

Just return the result of the condition.只需返回条件的结果。 The comparison returns a boolean value.比较返回一个布尔值。

return isActiveDate < 0;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Javascript ESLint错误-条件表达式中不必要使用布尔文字 - Javascript ESLint Error - Unnecessary use of boolean literals in conditional expression 错误在条件表达式中不必要地使用布尔文字 no-unneeded-ternary - error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary Eslint:在条件表达式中不必要使用布尔文字 - Eslint: Unnecessary use of boolean literals in conditional expression 在条件表达式中不必要地使用 Boolean 文字 - Unnecessary use of Boolean literals in conditional expression Javascript:错误在条件表达式 no-unneeded-ternary 中不必要地使用 boolean 文字 - Javascript: error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary 为何使用!! 将变量强制转换为布尔值以用于条件表达式? - Why use !! to coerce a variable to boolean for use in a conditional expression? FlowJS:如何使用联合类型和布尔文字 - FlowJS: How to use union types and boolean literals 在 hasura GQL 突变中使用具有条件逻辑的模板文字 - Use template literals with conditional logic in hasura GQL mutation 如何在条件中更改表达式的求值以检查Javascript中的布尔值? - How do I change the evaluation of the expression in the conditional to check for a boolean in Javascript? 不使用关系运算符的 JavaScript 条件表达式 - JavaScript Conditional expression without the use of Relational operator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM