chore: tidy
This commit is contained in:
parent
a899cf627f
commit
6249effb69
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 = [];
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -50,7 +50,6 @@ const Number = ({
|
|||
input.removeEventListener('wheel', onWheel, {passive: false});
|
||||
};
|
||||
});
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
step = parser(step);
|
||||
return (
|
||||
<div className="number">
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user