From a590c353a998d04be7daf93c5935a3d7c7aded38 Mon Sep 17 00:00:00 2001 From: IvarK Date: Thu, 4 Aug 2022 19:02:39 +0300 Subject: [PATCH] remove the no-bitwise rule and all the eslint-disable-rule stuff --- .eslintrc.json | 1 - build/check-npm.js | 2 +- .../core/achievements/normal-achievement.js | 5 ----- .../core/achievements/secret-achievement.js | 5 ----- javascripts/core/celestials/V.js | 1 - javascripts/core/celestials/effarig.js | 2 -- javascripts/core/celestials/enslaved.js | 3 --- javascripts/core/devtools.js | 4 ---- javascripts/core/eternity.js | 1 - .../core/game-mechanics/bit-purchasable.js | 3 --- .../core/game-mechanics/bit-upgrade-state.js | 2 -- javascripts/core/glyph-effects.js | 2 -- javascripts/core/glyphs/glyph-core.js | 4 ---- javascripts/core/glyphs/glyph-effects.js | 4 ---- javascripts/core/glyphs/glyph-generator.js | 1 - javascripts/core/imaginary-upgrades.js | 3 --- javascripts/core/infinity-challenges.js | 2 -- javascripts/core/math.js | 2 -- javascripts/core/news-ticker.js | 2 -- javascripts/core/normal-challenges.js | 2 -- javascripts/core/reality-upgrades.js | 3 --- javascripts/core/storage/base64-binary.js | 2 +- javascripts/core/storage/dev-migrations.js | 19 ------------------- javascripts/core/storage/migrations.js | 7 ------- .../core/time-studies/ec-time-study.js | 2 -- javascripts/core/ui/tab-notifications.js | 2 -- javascripts/core/ui/tabs.js | 6 ------ src/components/GlyphComponent.vue | 3 --- 28 files changed, 2 insertions(+), 93 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c2454acf9..545ec5291 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -200,7 +200,6 @@ ], "new-parens": "error", "no-array-constructor": "warn", - "no-bitwise": "warn", "no-inline-comments": "error", "no-lonely-if": "error", "no-mixed-spaces-and-tabs": "error", diff --git a/build/check-npm.js b/build/check-npm.js index c73651ee0..1843fcfbc 100644 --- a/build/check-npm.js +++ b/build/check-npm.js @@ -1,4 +1,4 @@ -/* eslint-disable no-bitwise, no-console */ +/* eslint-disable no-console */ const fs = require("fs"); const path = require("path"); diff --git a/javascripts/core/achievements/normal-achievement.js b/javascripts/core/achievements/normal-achievement.js index 6a7f4f55f..321c97714 100644 --- a/javascripts/core/achievements/normal-achievement.js +++ b/javascripts/core/achievements/normal-achievement.js @@ -5,9 +5,7 @@ class AchievementState extends GameMechanicState { super(config); this._row = Math.floor(this.id / 10); this._column = this.id % 10; - // eslint-disable-next-line no-bitwise this._bitmask = 1 << (this.column - 1); - // eslint-disable-next-line no-bitwise this._inverseBitmask = ~this._bitmask; this.registerEvents(config.checkEvent, args => this.tryUnlock(args)); } @@ -33,7 +31,6 @@ class AchievementState extends GameMechanicState { } get isUnlocked() { - // eslint-disable-next-line no-bitwise return (player.achievementBits[this.row - 1] & this._bitmask) !== 0; } @@ -52,13 +49,11 @@ class AchievementState extends GameMechanicState { } lock() { - // eslint-disable-next-line no-bitwise player.achievementBits[this.row - 1] &= this._inverseBitmask; } unlock(auto) { if (this.isUnlocked) return; - // eslint-disable-next-line no-bitwise player.achievementBits[this.row - 1] |= this._bitmask; if (this.id === 85 || this.id === 93) { Autobuyer.bigCrunch.bumpAmount(4); diff --git a/javascripts/core/achievements/secret-achievement.js b/javascripts/core/achievements/secret-achievement.js index 35d351738..02a8189a6 100644 --- a/javascripts/core/achievements/secret-achievement.js +++ b/javascripts/core/achievements/secret-achievement.js @@ -5,9 +5,7 @@ class SecretAchievementState extends GameMechanicState { super(config); this._row = Math.floor(this.id / 10); this._column = this.id % 10; - // eslint-disable-next-line no-bitwise this._bitmask = 1 << (this.column - 1); - // eslint-disable-next-line no-bitwise this._inverseBitmask = ~this._bitmask; this.registerEvents(config.checkEvent, args => this.tryUnlock(args)); } @@ -25,7 +23,6 @@ class SecretAchievementState extends GameMechanicState { } get isUnlocked() { - // eslint-disable-next-line no-bitwise return (player.secretAchievementBits[this.row - 1] & this._bitmask) !== 0; } @@ -37,14 +34,12 @@ class SecretAchievementState extends GameMechanicState { unlock() { if (this.isUnlocked) return; - // eslint-disable-next-line no-bitwise player.secretAchievementBits[this.row - 1] |= this._bitmask; GameUI.notify.success(`Secret Achievement: ${this.name}`); EventHub.dispatch(GAME_EVENT.ACHIEVEMENT_UNLOCKED); } lock() { - // eslint-disable-next-line no-bitwise player.secretAchievementBits[this.row - 1] &= this._inverseBitmask; } } diff --git a/javascripts/core/celestials/V.js b/javascripts/core/celestials/V.js index 9162320f6..2ed3f0b0f 100644 --- a/javascripts/core/celestials/V.js +++ b/javascripts/core/celestials/V.js @@ -176,7 +176,6 @@ export const V = { return VUnlocks.vAchievementUnlock.canBeUnlocked; }, unlockCelestial() { - // eslint-disable-next-line no-bitwise player.celestials.v.unlockBits |= (1 << VUnlocks.vAchievementUnlock.id); GameUI.notify.success("You have unlocked V, The Celestial Of Achievements!", 10000); V.quotes.unlock.show(); diff --git a/javascripts/core/celestials/effarig.js b/javascripts/core/celestials/effarig.js index b6b1fa197..8dc5410ad 100644 --- a/javascripts/core/celestials/effarig.js +++ b/javascripts/core/celestials/effarig.js @@ -53,11 +53,9 @@ export const Effarig = { get glyphEffectAmount() { const genEffectBitmask = Glyphs.activeList .filter(g => generatedTypes.includes(g.type)) - // eslint-disable-next-line no-bitwise .reduce((prev, curr) => prev | curr.effects, 0); const nongenEffectBitmask = Glyphs.activeList .filter(g => !generatedTypes.includes(g.type)) - // eslint-disable-next-line no-bitwise .reduce((prev, curr) => prev | curr.effects, 0); return countValuesFromBitmask(genEffectBitmask) + countValuesFromBitmask(nongenEffectBitmask); }, diff --git a/javascripts/core/celestials/enslaved.js b/javascripts/core/celestials/enslaved.js index b88e733c7..a2b03e545 100644 --- a/javascripts/core/celestials/enslaved.js +++ b/javascripts/core/celestials/enslaved.js @@ -204,12 +204,10 @@ class EnslavedProgressState extends BitUpgradeState { set bits(value) { player.celestials.enslaved.hintBits = value; } get hasProgress() { - // eslint-disable-next-line no-bitwise return Boolean(player.celestials.enslaved.progressBits & (1 << this.id)); } get hasHint() { - // eslint-disable-next-line no-bitwise return this.hasProgress || this.isUnlocked; } @@ -227,7 +225,6 @@ class EnslavedProgressState extends BitUpgradeState { player.celestials.enslaved.zeroHintTime -= Math.log(2) / Math.log(3) * TimeSpan.fromDays(1).totalMilliseconds; GameUI.notify.success("You found a crack in The Enslaved Ones' Reality!", 10000); } - // eslint-disable-next-line no-bitwise player.celestials.enslaved.progressBits |= (1 << this.id); } } diff --git a/javascripts/core/devtools.js b/javascripts/core/devtools.js index 06b17720e..a337bc2b5 100644 --- a/javascripts/core/devtools.js +++ b/javascripts/core/devtools.js @@ -417,19 +417,16 @@ dev.testReplicantiCode = function(singleId, useDebugger = false) { ], [ function() { - // eslint-disable-next-line no-bitwise player.achievementBits[8] |= 16; } ], [ function() { - // eslint-disable-next-line no-bitwise player.achievementBits[12] |= 8; } ], [ function() { - // eslint-disable-next-line no-bitwise player.achievementBits[12] |= 128; } ], @@ -459,7 +456,6 @@ dev.testReplicantiCode = function(singleId, useDebugger = false) { ], [ function() { - // eslint-disable-next-line no-bitwise player.reality.upgReqs = (1 << 6); player.reality.upgradeBits = 64; } diff --git a/javascripts/core/eternity.js b/javascripts/core/eternity.js index 11e3b24f7..148218d0d 100644 --- a/javascripts/core/eternity.js +++ b/javascripts/core/eternity.js @@ -35,7 +35,6 @@ function giveEternityRewards(auto) { AutomatorData.lastECCompletionCount = completionCount; if (Enslaved.isRunning && completionCount > 5) EnslavedProgress.ec1.giveProgress(); } - // eslint-disable-next-line no-bitwise player.challenge.eternity.requirementBits &= ~(1 << challenge.id); respecTimeStudies(auto); } diff --git a/javascripts/core/game-mechanics/bit-purchasable.js b/javascripts/core/game-mechanics/bit-purchasable.js index c2c339858..65610bede 100644 --- a/javascripts/core/game-mechanics/bit-purchasable.js +++ b/javascripts/core/game-mechanics/bit-purchasable.js @@ -20,16 +20,13 @@ export class BitPurchasableMechanicState extends PurchasableMechanicState { get bitIndex() { throw new NotImplementedError(); } get isBought() { - // eslint-disable-next-line no-bitwise return (this.bits & (1 << this.bitIndex)) !== 0; } set isBought(value) { if (value) { - // eslint-disable-next-line no-bitwise this.bits |= (1 << this.bitIndex); } else { - // eslint-disable-next-line no-bitwise this.bits &= ~(1 << this.bitIndex); } } diff --git a/javascripts/core/game-mechanics/bit-upgrade-state.js b/javascripts/core/game-mechanics/bit-upgrade-state.js index ff971913b..66a42e0ee 100644 --- a/javascripts/core/game-mechanics/bit-upgrade-state.js +++ b/javascripts/core/game-mechanics/bit-upgrade-state.js @@ -16,7 +16,6 @@ export class BitUpgradeState extends GameMechanicState { set bits(value) { throw new NotImplementedError(); } get isUnlocked() { - // eslint-disable-next-line no-bitwise return Boolean(this.bits & (1 << this.id)); } @@ -33,7 +32,6 @@ export class BitUpgradeState extends GameMechanicState { unlock() { if (!this.canBeUnlocked) return; - // eslint-disable-next-line no-bitwise this.bits |= (1 << this.id); this.onUnlock(); } diff --git a/javascripts/core/glyph-effects.js b/javascripts/core/glyph-effects.js index 4266c5e23..71bdcdd8e 100644 --- a/javascripts/core/glyph-effects.js +++ b/javascripts/core/glyph-effects.js @@ -201,14 +201,12 @@ export function findGlyphTypeEffects(glyphType) { } export function makeGlyphEffectBitmask(effectList) { - // eslint-disable-next-line no-bitwise return effectList.reduce((mask, eff) => mask + (1 << GlyphEffects[eff].bitmaskIndex), 0); } export function getGlyphEffectsFromBitmask(bitmask) { return orderedEffectList .map(effectName => GlyphEffects[effectName]) - // eslint-disable-next-line no-bitwise .filter(effect => (bitmask & (1 << effect.bitmaskIndex)) !== 0); } diff --git a/javascripts/core/glyphs/glyph-core.js b/javascripts/core/glyphs/glyph-core.js index c74405599..6cbd9e3ca 100644 --- a/javascripts/core/glyphs/glyph-core.js +++ b/javascripts/core/glyphs/glyph-core.js @@ -424,7 +424,6 @@ export const Glyphs = { }, sortByEffect() { function reverseBitstring(eff) { - // eslint-disable-next-line no-bitwise return parseInt(((1 << 30) + (eff >>> 0)).toString(2).split("").reverse().join(""), 2); } // The bitwise reversal is so that the effects with the LOWER id are valued higher in the sorting. @@ -449,7 +448,6 @@ export const Glyphs = { g.type === glyph.type && g.id !== glyph.id && (g.level >= glyph.level || g.strength >= glyph.strength) && - // eslint-disable-next-line no-bitwise ((g.effects & glyph.effects) === glyph.effects)); let compareThreshold = glyph.type === "effarig" || glyph.type === "reality" ? 1 : 5; compareThreshold = Math.clampMax(compareThreshold, threshold); @@ -614,10 +612,8 @@ export const Glyphs = { applyGamespeed(glyph) { if (!Ra.unlocks.allGamespeedGlyphs.canBeApplied) return; if (BASIC_GLYPH_TYPES.includes(glyph.type)) { - // eslint-disable-next-line no-bitwise glyph.effects |= (1 << GlyphEffects.timespeed.bitmaskIndex); if (glyph.type === "time") { - // eslint-disable-next-line no-bitwise glyph.effects |= (1 << GlyphEffects.timeshardpow.bitmaskIndex); } } diff --git a/javascripts/core/glyphs/glyph-effects.js b/javascripts/core/glyphs/glyph-effects.js index 180a08fbc..90a3d8607 100644 --- a/javascripts/core/glyphs/glyph-effects.js +++ b/javascripts/core/glyphs/glyph-effects.js @@ -66,7 +66,6 @@ export function getGlyphEffectValues(effectKey) { throw new Error(`Unknown Glyph effect requested "${effectKey}"'`); } return player.reality.glyphs.active - // eslint-disable-next-line no-bitwise .filter(glyph => ((1 << GlyphEffects[effectKey].bitmaskIndex) & glyph.effects) !== 0) .filter(glyph => generatedTypes.includes(glyph.type) === GlyphEffects[effectKey].isGenerated) .map(glyph => getSingleGlyphEffectFromBitmask(effectKey, glyph)); @@ -110,7 +109,6 @@ export function getGlyphEffectValuesFromBitmask(bitmask, level, baseStrength, ty // Pulls out a single effect value from a glyph's bitmask, returning just the value (nothing for missing effects) export function getSingleGlyphEffectFromBitmask(effectName, glyph) { const glyphEffect = GlyphEffects[effectName]; - // eslint-disable-next-line no-bitwise if ((glyph.effects & (1 << glyphEffect.bitmaskIndex)) === 0) { return undefined; } @@ -122,9 +120,7 @@ export function countValuesFromBitmask(bitmask) { let numEffects = 0; let bits = bitmask; while (bits !== 0) { - // eslint-disable-next-line no-bitwise numEffects += bits & 1; - // eslint-disable-next-line no-bitwise bits >>= 1; } return numEffects; diff --git a/javascripts/core/glyphs/glyph-generator.js b/javascripts/core/glyphs/glyph-generator.js index 622527325..ffa8a3e29 100644 --- a/javascripts/core/glyphs/glyph-generator.js +++ b/javascripts/core/glyphs/glyph-generator.js @@ -154,7 +154,6 @@ export const GlyphGenerator = { const effectList = GlyphEffects.all.filter(e => e.id.startsWith(type)); effectList.push(GlyphEffects.timespeed); let bitmask = 0; - // eslint-disable-next-line no-bitwise for (const effect of effectList) bitmask |= 1 << effect.bitmaskIndex; const glyphLevel = Math.max(player.records.bestReality.glyphLevel, 5000); return { diff --git a/javascripts/core/imaginary-upgrades.js b/javascripts/core/imaginary-upgrades.js index 1fffb4aff..221b4a18e 100644 --- a/javascripts/core/imaginary-upgrades.js +++ b/javascripts/core/imaginary-upgrades.js @@ -24,7 +24,6 @@ class ImaginaryUpgradeState extends BitPurchasableMechanicState { } get isAvailableForPurchase() { - // eslint-disable-next-line no-bitwise return (player.reality.imaginaryUpgReqs & (1 << this.id)) !== 0; } @@ -42,7 +41,6 @@ class ImaginaryUpgradeState extends BitPurchasableMechanicState { tryUnlock() { if (!MachineHandler.isIMUnlocked || this.isAvailableForPurchase || !this.config.checkRequirement()) return; - // eslint-disable-next-line no-bitwise player.reality.imaginaryUpgReqs |= (1 << this.id); GameUI.notify.reality(`You've unlocked an Imaginary Upgrade: ${this.config.name}`); } @@ -114,7 +112,6 @@ export const ImaginaryUpgrades = { return this.all.countWhere(u => u.isBought); }, get allBought() { - // eslint-disable-next-line no-bitwise return (player.reality.imaginaryUpgradeBits >> 6) + 1 === 1 << (GameDatabase.reality.imaginaryUpgrades.length - 5); } }; diff --git a/javascripts/core/infinity-challenges.js b/javascripts/core/infinity-challenges.js index 9b8ec26a2..328e866b0 100644 --- a/javascripts/core/infinity-challenges.js +++ b/javascripts/core/infinity-challenges.js @@ -64,12 +64,10 @@ class InfinityChallengeState extends GameMechanicState { } get isCompleted() { - // eslint-disable-next-line no-bitwise return (player.challenge.infinity.completedBits & (1 << this.id)) !== 0; } complete() { - // eslint-disable-next-line no-bitwise player.challenge.infinity.completedBits |= 1 << this.id; EventHub.dispatch(GAME_EVENT.INFINITY_CHALLENGE_COMPLETED); } diff --git a/javascripts/core/math.js b/javascripts/core/math.js index 1075d6364..e460fa003 100644 --- a/javascripts/core/math.js +++ b/javascripts/core/math.js @@ -516,13 +516,11 @@ window.logFactorial = (function() { /** 32 bit XORSHIFT generator */ window.xorshift32Update = function xorshift32Update(state) { - /* eslint-disable no-bitwise */ /* eslint-disable no-param-reassign */ state ^= state << 13; state ^= state >>> 17; state ^= state << 5; /* eslint-enable no-param-reassign */ - /* eslint-enable no-bitwise */ return state; }; diff --git a/javascripts/core/news-ticker.js b/javascripts/core/news-ticker.js index 34c894d62..93c000533 100644 --- a/javascripts/core/news-ticker.js +++ b/javascripts/core/news-ticker.js @@ -22,7 +22,6 @@ export const NewsHandler = { // If the bit array isn't large enough (ie. the numerical ID is the largest we've seen so far by a long shot), then // we pad the array with zeroes until we can fit the new ID in before actually adding it. while (this.BITS_PER_MASK * player.news.seen[type].length <= number) player.news.seen[type].push(0); - // eslint-disable-next-line no-bitwise player.news.seen[type][Math.floor(number / this.BITS_PER_MASK)] |= 1 << (number % this.BITS_PER_MASK); }, @@ -33,7 +32,6 @@ export const NewsHandler = { const bitArray = player.news.seen[type]; if (!bitArray || this.BITS_PER_MASK * bitArray.length < number) return false; - // eslint-disable-next-line no-bitwise return (bitArray[Math.floor(number / this.BITS_PER_MASK)] |= 1 << (number % this.BITS_PER_MASK)) !== 0; }, diff --git a/javascripts/core/normal-challenges.js b/javascripts/core/normal-challenges.js index 837acb074..4bc726937 100644 --- a/javascripts/core/normal-challenges.js +++ b/javascripts/core/normal-challenges.js @@ -94,12 +94,10 @@ class NormalChallengeState extends GameMechanicState { } get isCompleted() { - // eslint-disable-next-line no-bitwise return (player.challenge.normal.completedBits & (1 << this.id)) !== 0; } complete() { - // eslint-disable-next-line no-bitwise player.challenge.normal.completedBits |= 1 << this.id; // Since breaking infinity maxes even autobuyers that aren't unlocked, // it's possible to get r52 or r53 from completing a challenge diff --git a/javascripts/core/reality-upgrades.js b/javascripts/core/reality-upgrades.js index a1635a63e..5b0093b68 100644 --- a/javascripts/core/reality-upgrades.js +++ b/javascripts/core/reality-upgrades.js @@ -35,7 +35,6 @@ class RealityUpgradeState extends BitPurchasableMechanicState { } get isAvailableForPurchase() { - // eslint-disable-next-line no-bitwise return (player.reality.upgReqs & (1 << this.id)) !== 0; } @@ -46,7 +45,6 @@ class RealityUpgradeState extends BitPurchasableMechanicState { tryUnlock() { const realityReached = PlayerProgress.realityUnlocked() || TimeStudy.reality.isBought; if (!realityReached || this.isAvailableForPurchase || !this.config.checkRequirement()) return; - // eslint-disable-next-line no-bitwise player.reality.upgReqs |= (1 << this.id); GameUI.notify.reality(`You've unlocked a Reality Upgrade: ${this.config.name}`); } @@ -102,7 +100,6 @@ export const RealityUpgrades = { */ all: RealityUpgradeState.index.compact(), get allBought() { - // eslint-disable-next-line no-bitwise return (player.reality.upgradeBits >> 6) + 1 === 1 << (GameDatabase.reality.upgrades.length - 5); } }; diff --git a/javascripts/core/storage/base64-binary.js b/javascripts/core/storage/base64-binary.js index 4c667a750..9bc6371da 100644 --- a/javascripts/core/storage/base64-binary.js +++ b/javascripts/core/storage/base64-binary.js @@ -1,4 +1,4 @@ -/* eslint-disable no-bitwise,no-param-reassign */ +/* eslint-disable no-param-reassign */ // Copyright (c) 2011, Daniel Guerrero // All rights reserved. diff --git a/javascripts/core/storage/dev-migrations.js b/javascripts/core/storage/dev-migrations.js index 280213a76..8c8a76d1e 100644 --- a/javascripts/core/storage/dev-migrations.js +++ b/javascripts/core/storage/dev-migrations.js @@ -2,7 +2,6 @@ import { GameStorage } from "./storage"; function arrayToBits(array) { let bits = 0; - // eslint-disable-next-line no-bitwise for (const id of array) bits |= (1 << id); return bits; } @@ -288,7 +287,6 @@ GameStorage.devMigrations = { player.reality.upgradeBits = arrayToBits(player.reality.upg); delete player.reality.upg; } - // eslint-disable-next-line no-bitwise if ((player.reality.upgradeBits & (1 << 25)) === 0) { player.realityBuyer.isOn = false; } @@ -358,7 +356,6 @@ GameStorage.devMigrations = { for (const effect of orderedEffectList) { const typeEffect = separateEffectKey(effect); if (glyph.type === typeEffect[0] && glyph.effects[typeEffect[1]] !== undefined) { - // eslint-disable-next-line no-bitwise effectBitmask += 1 << GlyphEffects[effect].bitmaskIndex; } } @@ -751,7 +748,6 @@ GameStorage.devMigrations = { } }, player => { - // eslint-disable-next-line no-bitwise player.celestials.ra.unlockBits &= ~(1 << 29); }, player => { @@ -975,7 +971,6 @@ GameStorage.devMigrations = { let reqBitmask = 0; for (let i = 0; i <= player.reality.upgReqs.length; i++) { - // eslint-disable-next-line no-bitwise if (player.reality.upgReqs[i]) reqBitmask |= (1 << i); } player.reality.upgReqs = reqBitmask; @@ -1218,42 +1213,29 @@ GameStorage.devMigrations = { player.celestials.pelle.galaxyGenerator.unlocked = player.celestials.pelle.galaxyGenerator.generatedGalaxies > 0; }, player => { - // eslint-disable-next-line no-bitwise if (player.celestials.pelle.doomed) player.achievementBits[17] |= 1; - // eslint-disable-next-line no-bitwise if (player.celestials.pelle.upgrades.has(4)) player.achievementBits[17] |= 2; if (player.celestials.pelle.doomed && player.challenge.infinity.completedBits === 510) { - // eslint-disable-next-line no-bitwise player.achievementBits[17] |= (1 << 2); } - // eslint-disable-next-line no-bitwise if (player.timestudy.studies.compact().includes(181)) player.achievementBits[17] |= (1 << 5); }, player => { - // eslint-disable-next-line no-bitwise player.achievementBits[16] |= (player.achievementBits[16] & (1 << 4)) << 3; - // eslint-disable-next-line no-bitwise player.achievementBits[16] &= ~(1 << 4); - // eslint-disable-next-line no-bitwise player.achievementBits[16] |= (player.achievementBits[16] & (1 << 2)) << 2; - // eslint-disable-next-line no-bitwise player.achievementBits[16] &= ~(1 << 2); }, player => { - // eslint-disable-next-line no-bitwise player.achievementBits[17] &= ~(1 << 5); if (player.timestudy.studies.compact().includes(181) && player.celestials.pelle.doomed) { - // eslint-disable-next-line no-bitwise player.achievementBits[17] |= (1 << 5); } }, player => { - // eslint-disable-next-line no-bitwise if (player.celestials.pelle.doomed && (player.challenge.infinity.completedBits & (1 << 5)) !== 0) { - // eslint-disable-next-line no-bitwise player.achievementBits[17] |= (1 << 2); } else { - // eslint-disable-next-line no-bitwise player.achievementBits[17] &= ~(1 << 2); } }, @@ -1351,7 +1333,6 @@ GameStorage.devMigrations = { }, player => { const cel = player.celestials; - // eslint-disable-next-line no-bitwise const convToBit = x => x.toBitmask() >> 1; if (cel.teresa.quotes) player.celestials.teresa.quoteBits = convToBit(cel.teresa.quotes); if (cel.effarig.quotes) player.celestials.effarig.quoteBits = convToBit(cel.effarig.quotes); diff --git a/javascripts/core/storage/migrations.js b/javascripts/core/storage/migrations.js index 3d7b58119..464ba3fe8 100644 --- a/javascripts/core/storage/migrations.js +++ b/javascripts/core/storage/migrations.js @@ -325,7 +325,6 @@ GameStorage.migrations = { if (player.challenges) { for (const fullID of player.challenges) { const parsed = parseChallengeName(fullID); - // eslint-disable-next-line no-bitwise player.challenge[parsed.type].completedBits |= 1 << parsed.id; } delete player.challenges; @@ -665,7 +664,6 @@ GameStorage.migrations = { const number = parseInt(groups[2], 10); if (!player.news.seen[type]) player.news.seen[type] = []; while (maskLength * player.news.seen[type].length < number) player.news.seen[type].push(0); - // eslint-disable-next-line no-bitwise player.news.seen[type][Math.floor(number / maskLength)] |= 1 << (number % maskLength); } @@ -708,21 +706,17 @@ GameStorage.migrations = { if (!isSecret && [row, column].join(",") in swaps) { [row, column] = swaps[[row, column].join(",")].split(","); } - // eslint-disable-next-line no-bitwise newAchievements[row - 1] |= (1 << (column - 1)); } // Handle the changed achievement "No DLC Required" correctly (otherwise saves could miss it). if (!isSecret && (player.infinityUpgrades.size >= 16 || player.eternities.gt(0) || player.realities > 0)) { - // eslint-disable-next-line no-bitwise newAchievements[3] |= 1; } else { - // eslint-disable-next-line no-bitwise newAchievements[3] &= ~1; } // "Professional Bodybuilder" (s38) was changed and shouldn't be migrated if (isSecret) { - // eslint-disable-next-line no-bitwise newAchievements[2] &= ~128; } }; @@ -911,7 +905,6 @@ GameStorage.migrations = { }, etercreqConversion(player) { - // eslint-disable-next-line no-bitwise if (player.etercreq) player.challenge.eternity.requirementBits |= 1 << player.etercreq; delete player.etercreq; }, diff --git a/javascripts/core/time-studies/ec-time-study.js b/javascripts/core/time-studies/ec-time-study.js index 50a7cc826..ec1528582 100644 --- a/javascripts/core/time-studies/ec-time-study.js +++ b/javascripts/core/time-studies/ec-time-study.js @@ -33,7 +33,6 @@ export class ECTimeStudyState extends TimeStudyState { if (!auto) { Tab.challenges.eternity.show(); } - // eslint-disable-next-line no-bitwise player.challenge.eternity.requirementBits |= 1 << this.id; Currency.timeTheorems.subtract(this.cost); TimeStudyTree.commitToGameState([TimeStudy.eternityChallenge(this.id)]); @@ -118,7 +117,6 @@ export class ECTimeStudyState extends TimeStudyState { get wasRequirementPreviouslyMet() { if (this.id === 11 || this.id === 12) return false; - // eslint-disable-next-line no-bitwise return (player.challenge.eternity.requirementBits & (1 << this.id)) !== 0; } diff --git a/javascripts/core/ui/tab-notifications.js b/javascripts/core/ui/tab-notifications.js index 1c5836dab..b9826abef 100644 --- a/javascripts/core/ui/tab-notifications.js +++ b/javascripts/core/ui/tab-notifications.js @@ -9,7 +9,6 @@ class TabNotificationState { } get triggered() { - // eslint-disable-next-line no-bitwise return player.triggeredTabNotificationBits & (1 << this.config.id); } @@ -17,7 +16,6 @@ class TabNotificationState { if (!this.config.condition() || this.triggered) return; this.config.tabsToHighLight.map(t => t.parent + t.tab) .forEach(tab => player.tabNotifications.add(tab)); - // eslint-disable-next-line no-bitwise player.triggeredTabNotificationBits |= 1 << this.config.id; // Force all tabs and subtabs of this notification to be unhidden diff --git a/javascripts/core/ui/tabs.js b/javascripts/core/ui/tabs.js index f2ede0728..9804d7e2a 100644 --- a/javascripts/core/ui/tabs.js +++ b/javascripts/core/ui/tabs.js @@ -22,7 +22,6 @@ class SubtabState { get isHidden() { if (Enslaved.isRunning || Pelle.hasGalaxyGenerator) return false; - // eslint-disable-next-line no-bitwise return ((player.options.hiddenSubtabBits[this._parent.id] & (1 << this.id)) !== 0) && this.hidable; } @@ -53,13 +52,11 @@ class SubtabState { unhideTab() { this._parent.unhideTab(); - // eslint-disable-next-line no-bitwise player.options.hiddenSubtabBits[this._parent.id] &= ~(1 << this.id); } toggleVisibility() { if (this._parent.id === Tabs.current.id && this.id === Tabs.current._currentSubtab.id) return; - // eslint-disable-next-line no-bitwise player.options.hiddenSubtabBits[this._parent.id] ^= (1 << this.id); checkTabVisibilityForSecretAchievement(); @@ -111,7 +108,6 @@ class TabState { get isHidden() { if (Enslaved.isRunning || Pelle.hasGalaxyGenerator) return false; const hasVisibleSubtab = this.subtabs.some(t => t.isAvailable); - // eslint-disable-next-line no-bitwise return (((player.options.hiddenTabBits & (1 << this.id)) !== 0) || !hasVisibleSubtab) && this.hidable; } @@ -155,13 +151,11 @@ class TabState { } unhideTab() { - // eslint-disable-next-line no-bitwise player.options.hiddenTabBits &= ~(1 << this.id); } toggleVisibility() { if (this.id === Tabs.current.id) return; - // eslint-disable-next-line no-bitwise player.options.hiddenTabBits ^= (1 << this.id); checkTabVisibilityForSecretAchievement(); diff --git a/src/components/GlyphComponent.vue b/src/components/GlyphComponent.vue index 9b0173ef0..de8bf325a 100644 --- a/src/components/GlyphComponent.vue +++ b/src/components/GlyphComponent.vue @@ -230,12 +230,9 @@ export default { throw new Error(`Unrecognized glyph type "${this.glyph.type}" in glyph effect icons`); } const effectIDs = []; - // eslint-disable-next-line no-bitwise let remainingEffects = this.glyph.effects >> minEffectID; for (let id = 0; remainingEffects > 0; id++) { - // eslint-disable-next-line no-bitwise if ((remainingEffects & 1) === 1) effectIDs.push(id); - // eslint-disable-next-line no-bitwise remainingEffects >>= 1; } return effectIDs;