私はコード内のエラーを解決するためにes-lintを使用しています。私は、このエラーに遭遇している:私は常に復帰後else文を使用していた'return'の後ろには不要な 'else'があります。 (No-else-return)
Unnecessary 'else' after 'return'. (No-else-return)
} else {
。私が見落としているかもしれないことはありますか?
if (cctot <= 3 && cctot > 0) {
alert('Credit under $3.00 not allowed');
return Number.MIN_SAFE_INTEGER; // important to return 0 so we can check for these conditions for validation
} else {
cctot *= -1;
}
}
return precise(cctot);
}
module.exports = calculateCredit;
完全なスニペットを投稿してください。それだけで助けてくれるでしょう –
'return'が実行されると、関数は終了します。 'else'を使うと、冗長で誤解を招くことがあります。 – Pointy
https://eslint.org/docs/rules/no-else-return – JLRishe