install and configure eslint, bow before eslint

This commit is contained in:
2023-10-12 17:20:28 +02:00
parent b6bf355750
commit eb78ce7b6f
13 changed files with 1739 additions and 155 deletions
+53 -52
View File
@@ -1,12 +1,13 @@
<template>
<div class="node-list">
<GatheringNode
<div class="node-list">
<GatheringNode
v-for="node in displayNodes"
:gathering-node="node"
:eorzeaTime="eorzeaTime"
:key="`${node.location.x}-${node.location.y}-${node.location.zone}`"
:gathering-node="node as Node"
:eorzea-time="eorzeaTime"
:zones="zones"
/>
</div>
/>
</div>
</template>
<script lang="ts">
@@ -17,56 +18,56 @@ import GatheringNode from "@/components/GatheringNode.vue";
import Zone from "@/entities/Zone";
export default defineComponent(
{
name: "SortedNodeList",
components: {GatheringNode},
props: {
nodes: {
type: Array as PropType<Node[]>,
required: true
},
eorzeaTime: {
type: Object as PropType<EorzeaTime>,
required: true
},
zones: {
type: Object as PropType<{ [key: string]: Zone }>,
required: true
},
{
name: "SortedNodeList",
components: {GatheringNode},
props: {
nodes: {
type: Array as PropType<Node[]>,
required: true
},
watch: {
nodes: {
immediate: true,
handler() {
this.displayNodes = this.nodes;
}
},
eorzeaTime: {
immediate: true,
handler(newValue, oldValue) {
if (oldValue === undefined) return;
if (newValue?.getMinutes() === oldValue?.getMinutes()) return;
this.sortListByTime();
}
eorzeaTime: {
type: Object as PropType<EorzeaTime>,
required: true
},
zones: {
type: Object as PropType<{ [key: string]: Zone }>,
required: true
},
},
watch: {
nodes: {
immediate: true,
handler() {
this.displayNodes = this.nodes;
}
},
data: () => ({
displayNodes: [] as Node[],
}),
methods: {
sortListByTime() {
this.displayNodes.sort((a, b) => {
const aSeconds = a.getSecondsToNextActiveTime(this.eorzeaTime);
const bSeconds = b.getSecondsToNextActiveTime(this.eorzeaTime);
if (aSeconds === bSeconds) return a;
return aSeconds - bSeconds;
});
},
eorzeaTime: {
immediate: true,
handler(newValue, oldValue) {
if (oldValue === undefined) return;
if (newValue?.getMinutes() === oldValue?.getMinutes()) return;
this.sortListByTime();
}
}
},
data: () => ({
displayNodes: [] as Node[],
}),
methods: {
sortListByTime() {
this.displayNodes.sort((a, b): number => {
const aSeconds = a.getSecondsToNextActiveTime(this.eorzeaTime);
const bSeconds = b.getSecondsToNextActiveTime(this.eorzeaTime);
if (aSeconds === bSeconds) return 1;
return aSeconds - bSeconds;
});
},
mounted() {
this.displayNodes = this.nodes;
},
}
},
mounted() {
this.displayNodes = this.nodes;
},
}
);
</script>