Open SyMind opened 2 years ago
https://eslint.org/docs/rules/no-unneeded-ternary
no-unneeded-ternary 检查非必要的三元表达式。
no-unneeded-ternary
// Bad var isYes = answer === 1 ? true : false; // Good var isYes = answer === 1; // Bad var isNo = answer === 1 ? false : true; // Good var isNo = answer !== 1; // Bad foo(bar ? bar : 1); // Good foo(bar || 1);
@otakustay
https://eslint.org/docs/rules/no-unneeded-ternary
no-unneeded-ternary
检查非必要的三元表达式。