Enable the unicorn/prefer-ternary ESLint plugin rule

To limit the readability impact of these changes, the `only-single-line` option was used; please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-ternary.md

These changes were done automatically, using the `gulp lint --fix` command.
This commit is contained in:
Jonas Jenwald 2023-07-27 09:18:26 +02:00
parent 8f83a1359e
commit 674e7ee381
31 changed files with 123 additions and 265 deletions

View file

@ -147,11 +147,9 @@ class AForm {
} catch {}
if (!date) {
date = Date.parse(cDate);
if (isNaN(date)) {
date = this._tryToGuessDate(cFormat, cDate);
} else {
date = new Date(date);
}
date = isNaN(date)
? this._tryToGuessDate(cFormat, cDate)
: new Date(date);
}
return date;
}
@ -348,11 +346,7 @@ class AForm {
const formatStr = `%,${sepStyle}.${nDec}f`;
value = this._util.printf(formatStr, value * 100);
if (percentPrepend) {
event.value = `%${value}`;
} else {
event.value = `${value}%`;
}
event.value = percentPrepend ? `%${value}` : `${value}%`;
}
AFPercent_Keystroke(nDec, sepStyle) {
@ -541,11 +535,10 @@ class AForm {
formatStr = "99999-9999";
break;
case 2:
if (this._util.printx("9999999999", event.value).length >= 10) {
formatStr = "(999) 999-9999";
} else {
formatStr = "999-9999";
}
formatStr =
this._util.printx("9999999999", event.value).length >= 10
? "(999) 999-9999"
: "999-9999";
break;
case 3:
formatStr = "999-99-9999";
@ -648,11 +641,10 @@ class AForm {
break;
case 2:
const value = this.AFMergeChange(event);
if (value.length > 8 || value.startsWith("(")) {
formatStr = "(999) 999-9999";
} else {
formatStr = "999-9999";
}
formatStr =
value.length > 8 || value.startsWith("(")
? "(999) 999-9999"
: "999-9999";
break;
case 3:
formatStr = "999-99-9999";