From 6249effb6918eeb98a1f139f4fdbe19b82a788a9 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sat, 2 Dec 2023 06:02:56 -0600 Subject: [PATCH] chore: tidy --- packages/code/src/walk.js | 2 -- packages/dialog/src/parser.js | 2 -- packages/dialog/src/traits/dialog.js | 1 - packages/dialog/src/wordize.js | 2 -- packages/ecs/src/component/arbitrary.js | 4 +--- packages/ecs/src/serializer.js | 2 -- packages/entity/src/resources/entity-list.js | 2 -- packages/entity/src/traits/spawner.js | 2 -- packages/graphics/src/components/stage/index.jsx | 4 ---- packages/graphics/src/container.js | 1 - packages/graphics/src/traits/pictured.js | 1 - packages/input/src/packets/input.js | 2 -- packages/math/src/vector/packer.js | 2 -- packages/math/src/vector/vector.js | 6 ++---- packages/physics/src/abstract/world.js | 2 -- packages/physics/src/dummy/world.js | 2 -- packages/physics/src/resources/decorators/entity-list.js | 2 -- packages/physics/src/resources/decorators/room.js | 2 -- packages/physics/src/traits/emitter.js | 2 -- packages/react/src/components/number/index.jsx | 1 - packages/s13n/src/packets/synchronized-create.js | 2 -- packages/s13n/src/packets/synchronized-update.js | 2 -- packages/timing/src/traits/animated.js | 2 -- packages/topdown/src/components/room/renderable.jsx | 1 - packages/topdown/src/components/room/ui.jsx | 2 -- packages/topdown/src/persea/room-sides/tiles-side/index.jsx | 1 - packages/topdown/src/resources/room.js | 2 -- 27 files changed, 3 insertions(+), 53 deletions(-) diff --git a/packages/code/src/walk.js b/packages/code/src/walk.js index 8e9b2d6..d183ed1 100644 --- a/packages/code/src/walk.js +++ b/packages/code/src/walk.js @@ -9,13 +9,11 @@ export function replaceInParent(parent, replaced, replacing) { if (Array.isArray(parent[key])) { for (let j = 0; j < parent[key].length; ++j) { if (replaced === parent[key][j]) { - // eslint-disable-next-line no-param-reassign parent[key][j] = replacing; } } } else if (replaced === parent[key]) { - // eslint-disable-next-line no-param-reassign parent[key] = replacing; } } diff --git a/packages/dialog/src/parser.js b/packages/dialog/src/parser.js index ec0dbbf..dc772c2 100644 --- a/packages/dialog/src/parser.js +++ b/packages/dialog/src/parser.js @@ -15,7 +15,6 @@ const letterCount = (node) => { }; const decorateWithLetters = (resolver) => (node, ancestors) => { - /* eslint-disable no-param-reassign */ if ('text' === node.type) { const letters = node.value .replace(/\s/g, '\u00A0') @@ -89,7 +88,6 @@ const decorateWithLetters = (resolver) => (node, ancestors) => { }); }; } - /* eslint-enable no-param-reassign */ }; const lettersFor = (node) => { diff --git a/packages/dialog/src/traits/dialog.js b/packages/dialog/src/traits/dialog.js index 04b6bae..79b87a4 100644 --- a/packages/dialog/src/traits/dialog.js +++ b/packages/dialog/src/traits/dialog.js @@ -49,7 +49,6 @@ export default (flecks) => { if (this.$$letters.length > 0) { this.showThisLetter(); this.$$words.forEach((word) => { - // eslint-disable-next-line no-param-reassign word.parentNode = this.entity.node; }); } diff --git a/packages/dialog/src/wordize.js b/packages/dialog/src/wordize.js index 6cfddea..2ba5c44 100644 --- a/packages/dialog/src/wordize.js +++ b/packages/dialog/src/wordize.js @@ -12,10 +12,8 @@ const createWord = async (letters, flecks) => { }, }); for (let i = 0; i < letters.length; ++i) { - /* eslint-disable no-param-reassign */ letters[i].parentNode = word.node; letters[i].isBehaving = true; - /* eslint-enable no-param-reassign */ } const {tick} = word; word.tick = function T(elapsed) { diff --git a/packages/ecs/src/component/arbitrary.js b/packages/ecs/src/component/arbitrary.js index 7b51b73..79c3d10 100644 --- a/packages/ecs/src/component/arbitrary.js +++ b/packages/ecs/src/component/arbitrary.js @@ -13,9 +13,7 @@ export default class ArbitraryComponent extends BaseComponent { } const results = super.allocateMany(count); // eslint-disable-next-line no-param-reassign - count -= results.length; - // eslint-disable-next-line no-param-reassign - while (count--) { + count -= results.length; while (count--) { results.push(this.data.push(new this.Instance()) - 1); } return results; diff --git a/packages/ecs/src/serializer.js b/packages/ecs/src/serializer.js index b34e0ce..bbeba30 100644 --- a/packages/ecs/src/serializer.js +++ b/packages/ecs/src/serializer.js @@ -13,7 +13,6 @@ export default class Serializer { const viewMethod = Schema.viewMethodFromType(type); let value; if (viewMethod) { - // eslint-disable-next-line no-param-reassign value = view[`get${viewMethod}`](cursor, true); cursor += Schema.sizeOfType(type); } @@ -31,7 +30,6 @@ export default class Serializer { default: break; } } - // eslint-disable-next-line no-param-reassign destination[key] = value; } } diff --git a/packages/entity/src/resources/entity-list.js b/packages/entity/src/resources/entity-list.js index 83587b4..c2da4e3 100644 --- a/packages/entity/src/resources/entity-list.js +++ b/packages/entity/src/resources/entity-list.js @@ -46,7 +46,6 @@ export default (flecks) => { if (entity.hasTickers()) { this.$$entityTickers.push(entity.tick); } - // eslint-disable-next-line no-param-reassign entity.list = this; entity.emit('addedToList'); entity.once('destroying', () => this.onEntityDestroying(entity)); @@ -161,7 +160,6 @@ export default (flecks) => { if ('web' !== process.env.FLECKS_CORE_BUILD_TARGET) { this.$$informedEntities.delete(entity); } - // eslint-disable-next-line no-param-reassign entity.list = null; entity.emit('removedFromList', this); delete this.$$entities[uuid]; diff --git a/packages/entity/src/traits/spawner.js b/packages/entity/src/traits/spawner.js index 4a3db3f..f6d1d77 100644 --- a/packages/entity/src/traits/spawner.js +++ b/packages/entity/src/traits/spawner.js @@ -25,7 +25,6 @@ export default (flecks) => class Spawner extends decorate(Trait) { // eslint-disable-next-line class-methods-use-this augmentJSONWithPosition(json, position) { - /* eslint-disable no-param-reassign */ if (!json.traits) { json.traits = {}; } @@ -39,7 +38,6 @@ export default (flecks) => class Spawner extends decorate(Trait) { json.traits.Positioned.state.x, json.traits.Positioned.state.y, ] = position; - /* eslint-enable no-param-reassign */ return json; } diff --git a/packages/graphics/src/components/stage/index.jsx b/packages/graphics/src/components/stage/index.jsx index 72dd5a5..66579f7 100644 --- a/packages/graphics/src/components/stage/index.jsx +++ b/packages/graphics/src/components/stage/index.jsx @@ -28,14 +28,12 @@ const Stage = forwardRef(({ deltaX, deltaY, } = event; - /* eslint-disable no-param-reassign */ if (-1 !== ['touchstart', 'touchmove'].indexOf(event.type)) { clientX = event.touches[0].clientX; deltaX = event.touches[0].deltaX; clientY = event.touches[0].clientY; deltaY = event.touches[0].deltaY; } - /* eslint-enable no-param-reassign */ const {left, top} = event.target.getBoundingClientRect(); Object.defineProperty( event, @@ -73,12 +71,10 @@ const Stage = forwardRef(({ if (!renderable) { return; } - /* eslint-disable no-param-reassign */ renderable.scale = [scale, scale]; if (centered) { renderable.position = Vector.scale(size, 0.5); } - /* eslint-enable no-param-reassign */ }, [centered, renderable, scale, size]); useEffect(() => { if (!renderer) { diff --git a/packages/graphics/src/container.js b/packages/graphics/src/container.js index 641235c..e8481c1 100644 --- a/packages/graphics/src/container.js +++ b/packages/graphics/src/container.js @@ -32,7 +32,6 @@ export default class Container extends Renderable { return; } const {parent} = child; - // eslint-disable-next-line no-param-reassign child.parent = this; child.emit('parentChanged', parent, child.parent); this.isDirty = true; diff --git a/packages/graphics/src/traits/pictured.js b/packages/graphics/src/traits/pictured.js index 6e4f822..f8a0061 100644 --- a/packages/graphics/src/traits/pictured.js +++ b/packages/graphics/src/traits/pictured.js @@ -153,7 +153,6 @@ export default (flecks) => { this.$$images = images; this.$$sprites = await mapValuesAsync(this.$$images, async (image) => new Sprite(image)); Object.keys(this.$$sprites).forEach((key) => { - // eslint-disable-next-line no-param-reassign this.$$sprites[key].position = this.offsetFor(key); }); } diff --git a/packages/input/src/packets/input.js b/packages/input/src/packets/input.js index 7a5d84e..fd02ccf 100644 --- a/packages/input/src/packets/input.js +++ b/packages/input/src/packets/input.js @@ -16,7 +16,6 @@ export default class InputPacket extends Packet { for (let i = 0; i < data.length; i++) { const {action} = data[i]; const actionId = this.actionIds[action]; - // eslint-disable-next-line no-param-reassign data[i].action = actionId; } return data; @@ -29,7 +28,6 @@ export default class InputPacket extends Packet { static unpack(data) { for (let i = 0; i < data.length; i++) { const actionId = data[i].action; - // eslint-disable-next-line no-param-reassign data[i].action = this.idActions[actionId]; } return data; diff --git a/packages/math/src/vector/packer.js b/packages/math/src/vector/packer.js index 960e258..9b0f8c1 100644 --- a/packages/math/src/vector/packer.js +++ b/packages/math/src/vector/packer.js @@ -34,14 +34,12 @@ export default (key) => (Superclass) => { ); PackedVectorPacket.pack = key ? (data) => { - // eslint-disable-next-line no-param-reassign data[key] = packToUint32(data[key]); return Superclass.pack(data); } : (data) => packToUint32(data); PackedVectorPacket.unpack = key ? (data) => { - // eslint-disable-next-line no-param-reassign data[key] = unpackFromUint32(data[key]); return Superclass.unpack(data); } diff --git a/packages/math/src/vector/vector.js b/packages/math/src/vector/vector.js index f10cc88..b5fc253 100644 --- a/packages/math/src/vector/vector.js +++ b/packages/math/src/vector/vector.js @@ -153,10 +153,8 @@ export function cross(l, r) { // avocado> Vector.dot [2, 3], [4, 5] // 23 export function dot(l, r) { - if (!r) { - // eslint-disable-next-line no-param-reassign - r = l; - } + // eslint-disable-next-line no-param-reassign + if (!r) r = l; return l[0] * r[0] + l[1] * r[1]; } diff --git a/packages/physics/src/abstract/world.js b/packages/physics/src/abstract/world.js index 98b49c4..1a89caf 100644 --- a/packages/physics/src/abstract/world.js +++ b/packages/physics/src/abstract/world.js @@ -22,7 +22,6 @@ export default class AbstractWorld extends decorate(Class) { associateBodyWithEntity(body, entity) { this.entities.set(body, entity); this.entitiesList.push(entity); - // eslint-disable-next-line no-param-reassign body.position = entity.position; } @@ -35,7 +34,6 @@ export default class AbstractWorld extends decorate(Class) { this.entitiesList.splice(index, 1); } } - // eslint-disable-next-line no-param-reassign body.world = null; } diff --git a/packages/physics/src/dummy/world.js b/packages/physics/src/dummy/world.js index 54f1fec..6d37b3a 100644 --- a/packages/physics/src/dummy/world.js +++ b/packages/physics/src/dummy/world.js @@ -27,7 +27,6 @@ export default class World extends AbstractWorld { addToQuadTree(body) { const {aabb} = body; const expandedAabb = Rectangle.expand(aabb, [32, 32]); - // eslint-disable-next-line no-param-reassign body.quadTreeAabb = expandedAabb; this.quadTree.add(body, expandedAabb); } @@ -48,7 +47,6 @@ export default class World extends AbstractWorld { removeFromQuadTree(body) { this.quadTree.remove(body); - // eslint-disable-next-line no-param-reassign body.quadTreeAabb = []; } diff --git a/packages/physics/src/resources/decorators/entity-list.js b/packages/physics/src/resources/decorators/entity-list.js index 0f987e7..15bb5d2 100644 --- a/packages/physics/src/resources/decorators/entity-list.js +++ b/packages/physics/src/resources/decorators/entity-list.js @@ -9,13 +9,11 @@ export default (EntityList) => class PhysicsEntityList extends EntityList { } onEntityAdded(entity) { - // eslint-disable-next-line no-param-reassign entity.world = this.$$world; } // eslint-disable-next-line class-methods-use-this onEntityRemoved(entity) { - // eslint-disable-next-line no-param-reassign entity.world = null; } diff --git a/packages/physics/src/resources/decorators/room.js b/packages/physics/src/resources/decorators/room.js index 3a957b4..78a2768 100644 --- a/packages/physics/src/resources/decorators/room.js +++ b/packages/physics/src/resources/decorators/room.js @@ -25,7 +25,6 @@ export default (Room) => class PhysicsRoom extends Room { this.world = world; this.entityList.world = world; this.tiles.forEach((tiles) => { - // eslint-disable-next-line no-param-reassign tiles.world = world; }); if (Vector.isZero(this.size)) { @@ -54,7 +53,6 @@ export default (Room) => class PhysicsRoom extends Room { })), ]; bounds.forEach((bound) => { - // eslint-disable-next-line no-param-reassign bound.static = true; world.addBody(bound); }); diff --git a/packages/physics/src/traits/emitter.js b/packages/physics/src/traits/emitter.js index 077a7ce..67b93b6 100644 --- a/packages/physics/src/traits/emitter.js +++ b/packages/physics/src/traits/emitter.js @@ -261,13 +261,11 @@ export default (flecks) => class Emitter extends decorate(Trait) { return; } particle.body.setPosition([particle.p.x, particle.p.y]); - /* eslint-disable no-param-reassign */ particle.body.opacity = particle.alpha; if (particle.particle.scale) { particle.body.visibleScale = [particle.scale, particle.scale]; } particle.body.rotation = particle.rotation * PI_180; - /* eslint-enable no-param-reassign */ } packetsFor() { diff --git a/packages/react/src/components/number/index.jsx b/packages/react/src/components/number/index.jsx index 62495b5..2fa05a1 100644 --- a/packages/react/src/components/number/index.jsx +++ b/packages/react/src/components/number/index.jsx @@ -50,7 +50,6 @@ const Number = ({ input.removeEventListener('wheel', onWheel, {passive: false}); }; }); - // eslint-disable-next-line no-param-reassign step = parser(step); return (
diff --git a/packages/s13n/src/packets/synchronized-create.js b/packages/s13n/src/packets/synchronized-create.js index 3776436..ce13ccf 100644 --- a/packages/s13n/src/packets/synchronized-create.js +++ b/packages/s13n/src/packets/synchronized-create.js @@ -5,7 +5,6 @@ import SynchronizedPacket from './synchronized'; export default class SynchronizedCreatePacket extends SynchronizedPacket { static pack(data) { - // eslint-disable-next-line no-param-reassign data.spec = msgpack.encode(data.spec); return data; } @@ -21,7 +20,6 @@ export default class SynchronizedCreatePacket extends SynchronizedPacket { } static unpack(data) { - // eslint-disable-next-line no-param-reassign data.spec = msgpack.decode(data.spec); return data; } diff --git a/packages/s13n/src/packets/synchronized-update.js b/packages/s13n/src/packets/synchronized-update.js index 60a2765..8dbf018 100644 --- a/packages/s13n/src/packets/synchronized-update.js +++ b/packages/s13n/src/packets/synchronized-update.js @@ -4,7 +4,6 @@ export default (flecks) => class SynchronizedUpdatePacket extends SynchronizedPa static pack(data) { const {Bundle} = flecks.get('$flecks/socket.packets'); - // eslint-disable-next-line no-param-reassign data.packets = Bundle.encode(data.packets); return data; } @@ -21,7 +20,6 @@ export default (flecks) => class SynchronizedUpdatePacket extends SynchronizedPa static unpack(data) { const {Bundle} = flecks.get('$flecks/socket.packets'); - // eslint-disable-next-line no-param-reassign data.packets = Bundle.decode(data.packets); return data; } diff --git a/packages/timing/src/traits/animated.js b/packages/timing/src/traits/animated.js index a9005e7..abdf367 100644 --- a/packages/timing/src/traits/animated.js +++ b/packages/timing/src/traits/animated.js @@ -175,7 +175,6 @@ export default (flecks) => class Animated extends decorate(Trait) { : 'hideAnimation'; this[method](key); if (this.entity.is('Directional')) { - // eslint-disable-next-line no-param-reassign animation.direction = this.entity.direction; } }); @@ -203,7 +202,6 @@ export default (flecks) => class Animated extends decorate(Trait) { (animation) => new AnimationView(animation), ); Object.entries(animationViews).forEach(([key, animationView]) => { - // eslint-disable-next-line no-param-reassign animationView.position = this.offsetFor(key); }); this.$$animations = animations; diff --git a/packages/topdown/src/components/room/renderable.jsx b/packages/topdown/src/components/room/renderable.jsx index c6a43c9..0388527 100644 --- a/packages/topdown/src/components/room/renderable.jsx +++ b/packages/topdown/src/components/room/renderable.jsx @@ -39,7 +39,6 @@ const RoomRenderable = ({camera, styles, room}) => { return undefined; } const halfViewport = Vector.scale(viewSize, 0.5); - // eslint-disable-next-line no-param-reassign camera.realPosition = camera.position; const onCameraRealOffsetChanged = () => { roomRenderable.renderChunksForExtent(camera.rectangle); diff --git a/packages/topdown/src/components/room/ui.jsx b/packages/topdown/src/components/room/ui.jsx index 3b8496c..d79b786 100644 --- a/packages/topdown/src/components/room/ui.jsx +++ b/packages/topdown/src/components/room/ui.jsx @@ -24,10 +24,8 @@ const RoomUi = forwardRef( // Manage entities' relationship with the DOM. const onEntityAdded = async (entity) => { if (entity.is('DomNode')) { - /* eslint-disable no-param-reassign */ [entity.domScaleX, entity.domScaleY] = domScale; entity.parentNode = ref.current.querySelector(`.${styles.entities}`); - /* eslint-enable no-param-reassign */ } }; // Existing entities. diff --git a/packages/topdown/src/persea/room-sides/tiles-side/index.jsx b/packages/topdown/src/persea/room-sides/tiles-side/index.jsx index 02d8465..5b05119 100644 --- a/packages/topdown/src/persea/room-sides/tiles-side/index.jsx +++ b/packages/topdown/src/persea/room-sides/tiles-side/index.jsx @@ -92,7 +92,6 @@ function TilesPage({ }; const visibility = calculateVisibility(mute, solo); for (let i = 0; i < visibility.length; i++) { - // eslint-disable-next-line no-param-reassign roomRenderable.tilesRenderables[i].alpha = visibility[i] ? 1 : 0; } }, [mute, roomRenderable, solo]); diff --git a/packages/topdown/src/resources/room.js b/packages/topdown/src/resources/room.js index 5267a4f..cacc6cc 100644 --- a/packages/topdown/src/resources/room.js +++ b/packages/topdown/src/resources/room.js @@ -75,14 +75,12 @@ export default (flecks) => { } onEntityAdded(entity) { - // eslint-disable-next-line no-param-reassign entity.room = this; entity.emit('addedToRoom'); this.emit('entityAdded', entity); } onEntityRemoved(entity) { - // eslint-disable-next-line no-param-reassign entity.room = null; entity.emit('removedFromRoom', this); this.emit('entityRemoved', entity);