mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Enable eslint rule 'no-extra-boolean-cast'
Enable https://eslint.org/docs/latest/rules/no-extra-boolean-cast Ref: #8068 Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
parent
6a62dae166
commit
8b98a7a27c
16 changed files with 19 additions and 19 deletions
|
|
@ -98,7 +98,7 @@ function loadMods()
|
|||
*/
|
||||
function getMod(folder)
|
||||
{
|
||||
return !!g_Mods[folder] ? g_Mods[folder] : g_FakeMod;
|
||||
return g_Mods[folder] ? g_Mods[folder] : g_FakeMod;
|
||||
}
|
||||
|
||||
function loadEnabledMods()
|
||||
|
|
@ -248,7 +248,7 @@ function disableMod()
|
|||
break;
|
||||
}
|
||||
|
||||
if (!!g_Mods[disabledMod])
|
||||
if (g_Mods[disabledMod])
|
||||
g_ModsDisabled.push(disabledMod);
|
||||
|
||||
// Remove mods that required the removed mod and cascade
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ GameSettings.prototype.Attributes.MapPreview = class MapPreview extends GameSett
|
|||
|
||||
fromInitAttributes(attribs)
|
||||
{
|
||||
if (!!this.getLegacySetting(attribs, "mapPreview"))
|
||||
if (this.getLegacySetting(attribs, "mapPreview"))
|
||||
this.value = this.getLegacySetting(attribs, "mapPreview");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ GameSettings.prototype.Attributes.MapSize = class MapSize extends GameSetting
|
|||
|
||||
fromInitAttributes(attribs)
|
||||
{
|
||||
if (!!this.getLegacySetting(attribs, "Size"))
|
||||
if (this.getLegacySetting(attribs, "Size"))
|
||||
this.setSize(this.getLegacySetting(attribs, "Size"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ GameSettings.prototype.Attributes.PlayerCiv = class PlayerCiv extends GameSettin
|
|||
_set(playerIndex, value)
|
||||
{
|
||||
const map = this._getMapData(playerIndex);
|
||||
if (!!map)
|
||||
if (map)
|
||||
{
|
||||
this.values[playerIndex] = map;
|
||||
this.locked[playerIndex] = true;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ GameSettings.prototype.Attributes.PlayerPlacement = class PlayerPlacement extend
|
|||
|
||||
fromInitAttributes(attribs)
|
||||
{
|
||||
if (!!this.getLegacySetting(attribs, "PlayerPlacement"))
|
||||
if (this.getLegacySetting(attribs, "PlayerPlacement"))
|
||||
this.value = this.getLegacySetting(attribs, "PlayerPlacement");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ GameSettings.prototype.Attributes.Relic = class Relic extends GameSetting
|
|||
|
||||
fromInitAttributes(attribs)
|
||||
{
|
||||
if (!!this.getLegacySetting(attribs, "RelicCount"))
|
||||
if (this.getLegacySetting(attribs, "RelicCount"))
|
||||
this.setCount(this.getLegacySetting(attribs, "RelicCount"));
|
||||
if (!!this.getLegacySetting(attribs, "RelicDuration"))
|
||||
if (this.getLegacySetting(attribs, "RelicDuration"))
|
||||
this.setDuration(this.getLegacySetting(attribs, "RelicDuration"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ GameSettings.prototype.Attributes.SeaLevelRise = class SeaLevelRise extends Game
|
|||
|
||||
fromInitAttributes(attribs)
|
||||
{
|
||||
if (!!this.getLegacySetting(attribs, "SeaLevelRiseTime"))
|
||||
if (this.getLegacySetting(attribs, "SeaLevelRiseTime"))
|
||||
this.setValue(this.getLegacySetting(attribs, "SeaLevelRiseTime"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ GameSettings.prototype.Attributes.TriggerScripts = class TriggerScripts extends
|
|||
|
||||
fromInitAttributes(attribs)
|
||||
{
|
||||
if (!!this.getLegacySetting(attribs, "TriggerScripts"))
|
||||
if (this.getLegacySetting(attribs, "TriggerScripts"))
|
||||
this.customScripts = new Set(this.getLegacySetting(attribs, "TriggerScripts"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class AIDescription
|
|||
render()
|
||||
{
|
||||
let AI = g_GameSettings.playerAI.get(this.playerIndex);
|
||||
if (!!AI)
|
||||
if (AI)
|
||||
AI = g_Settings.AIDescriptions.find(desc => desc.id == AI.bot);
|
||||
this.aiDescription.caption = AI ? AI.data.description : this.NoAIDescription;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ AIGameSettingControls.AIBehavior = class extends AIGameSettingControlDropdown
|
|||
|
||||
const ai = g_GameSettings.playerAI.get(this.playerIndex);
|
||||
this.setHidden(!ai);
|
||||
if (!!ai)
|
||||
if (ai)
|
||||
this.setSelectedValue(ai.behavior);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ AIGameSettingControls.AIDifficulty = class extends AIGameSettingControlDropdown
|
|||
|
||||
const ai = g_GameSettings.playerAI.get(this.playerIndex);
|
||||
this.setHidden(!ai);
|
||||
if (!!ai)
|
||||
if (ai)
|
||||
this.setSelectedValue(ai.difficulty);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ AIGameSettingControls.AISelection = class extends AIGameSettingControlDropdown
|
|||
{
|
||||
const ai = g_GameSettings.playerAI.get(this.playerIndex);
|
||||
this.setHidden(!ai);
|
||||
if (!!ai)
|
||||
if (ai)
|
||||
this.setSelectedValue(ai.bot);
|
||||
else
|
||||
this.setSelectedValue(undefined);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ StatusEffectsReceiver.prototype.AddStatus = function(baseCode, data, attacker =
|
|||
let temp;
|
||||
do
|
||||
temp = statusCode + "_" + i++;
|
||||
while (!!this.activeStatusEffects[temp]);
|
||||
while (this.activeStatusEffects[temp]);
|
||||
statusCode = temp;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ AttackHelper.prototype.HandleAttackEffects = function(target, data, bonusMultipl
|
|||
});
|
||||
|
||||
// We do not want an entity to get XP from active Status Effects.
|
||||
if (!!data.attackData.StatusEffect)
|
||||
if (data.attackData.StatusEffect)
|
||||
return true;
|
||||
|
||||
const cmpPromotion = Engine.QueryInterface(data.attacker, IID_Promotion);
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ function InitGame(settings)
|
|||
|
||||
if (settings.PlayerData[i])
|
||||
{
|
||||
if(!!settings.PlayerData[i].Removed)
|
||||
if(settings.PlayerData[i].Removed)
|
||||
{
|
||||
cmpPlayer.Defeat(undefined);
|
||||
continue;
|
||||
}
|
||||
else if (!!settings.PlayerData[i].AI)
|
||||
else if (settings.PlayerData[i].AI)
|
||||
{
|
||||
cmpAIManager.AddPlayer(settings.PlayerData[i].AI, i, +settings.PlayerData[i].AIDiff, settings.PlayerData[i].AIBehavior || "random");
|
||||
cmpPlayer.SetAI(true);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const configEslintRecommended = {
|
|||
"no-dupe-keys": "warn",
|
||||
"no-duplicate-case": "warn",
|
||||
"no-empty": "warn",
|
||||
"no-extra-boolean-cast": "off",
|
||||
"no-extra-boolean-cast": "warn",
|
||||
"no-func-assign": "warn",
|
||||
"no-irregular-whitespace": "warn",
|
||||
"no-obj-calls": "warn",
|
||||
|
|
|
|||
Loading…
Reference in a new issue