fix: lint
This commit is contained in:
parent
8eec34fd47
commit
6f7ec2e7ac
|
@ -26,6 +26,9 @@ module.exports = {
|
||||||
|
|
||||||
// Base config
|
// Base config
|
||||||
extends: ['eslint:recommended'],
|
extends: ['eslint:recommended'],
|
||||||
|
rules: {
|
||||||
|
'no-constant-condition': ['error', {checkLoops: false}],
|
||||||
|
},
|
||||||
|
|
||||||
overrides: [
|
overrides: [
|
||||||
// Tests
|
// Tests
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import Arbitrary from '@/ecs/arbitrary.js';
|
import Arbitrary from '@/ecs/arbitrary.js';
|
||||||
import Base from '@/ecs/base.js';
|
|
||||||
import Schema from '@/ecs/schema.js';
|
import Schema from '@/ecs/schema.js';
|
||||||
import gather from '@/util/gather.js';
|
import gather from '@/util/gather.js';
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,6 @@ export default class Ecs {
|
||||||
},
|
},
|
||||||
next: () => {
|
next: () => {
|
||||||
let result = it.next();
|
let result = it.next();
|
||||||
let satisfied = false;
|
|
||||||
while (!result.done) {
|
while (!result.done) {
|
||||||
for (const componentName of criteria) {
|
for (const componentName of criteria) {
|
||||||
if (!(componentName in result.value[1])) {
|
if (!(componentName in result.value[1])) {
|
||||||
|
|
|
@ -221,10 +221,11 @@ export default class Engine {
|
||||||
entity,
|
entity,
|
||||||
payload,
|
payload,
|
||||||
] of this.incomingActions) {
|
] of this.incomingActions) {
|
||||||
const {Ecs, Controlled, id, Inventory, Position, Ticking, Wielder} = entity;
|
const {Controlled, Inventory, Ticking, Wielder} = entity;
|
||||||
switch (payload.type) {
|
switch (payload.type) {
|
||||||
case 'changeSlot': {
|
case 'changeSlot': {
|
||||||
Wielder.activeSlot = payload.value - 1;
|
Wielder.activeSlot = payload.value - 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case 'moveUp':
|
case 'moveUp':
|
||||||
case 'moveRight':
|
case 'moveRight':
|
||||||
|
|
|
@ -12,5 +12,6 @@ export default function usePacket(type, fn, dependencies) {
|
||||||
return () => {
|
return () => {
|
||||||
client.removePacketListener(type, fn);
|
client.removePacketListener(type, fn);
|
||||||
};
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [client, ...dependencies]);
|
}, [client, ...dependencies]);
|
||||||
}
|
}
|
|
@ -24,7 +24,7 @@ export default function Dom({children}) {
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener('resize', onResize);
|
window.removeEventListener('resize', onResize);
|
||||||
}
|
}
|
||||||
}, [ref.current]);
|
});
|
||||||
return (
|
return (
|
||||||
<div className={styles.dom} ref={ref}>
|
<div className={styles.dom} ref={ref}>
|
||||||
{scale > 0 && (
|
{scale > 0 && (
|
||||||
|
|
|
@ -4,8 +4,6 @@ import {useState} from 'react';
|
||||||
import {RESOLUTION} from '@/constants.js';
|
import {RESOLUTION} from '@/constants.js';
|
||||||
import {useEcs} from '@/context/ecs.js';
|
import {useEcs} from '@/context/ecs.js';
|
||||||
import {useMainEntity} from '@/context/main-entity.js';
|
import {useMainEntity} from '@/context/main-entity.js';
|
||||||
import Components from '@/ecs-components/index.js';
|
|
||||||
import Systems from '@/ecs-systems/index.js';
|
|
||||||
import usePacket from '@/hooks/use-packet.js';
|
import usePacket from '@/hooks/use-packet.js';
|
||||||
|
|
||||||
import Entities from './entities.jsx';
|
import Entities from './entities.jsx';
|
||||||
|
|
|
@ -43,7 +43,7 @@ export default function PlaySpecific() {
|
||||||
if ('local' !== type) {
|
if ('local' !== type) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
async function onBeforeUnload(event) {
|
async function onBeforeUnload() {
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
function waitForSave() {
|
function waitForSave() {
|
||||||
return new Promise((resolve) => setTimeout(resolve, 0));
|
return new Promise((resolve) => setTimeout(resolve, 0));
|
||||||
|
|
|
@ -146,4 +146,4 @@ export default class Script {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import TickingPromise from './ticking-promise.js';
|
||||||
|
|
||||||
test('runs executor', async () => {
|
test('runs executor', async () => {
|
||||||
expect(
|
expect(
|
||||||
await new TickingPromise((resolve, reject) => {
|
await new TickingPromise((resolve) => {
|
||||||
resolve(32);
|
resolve(32);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user