ESLint fixes.

This commit is contained in:
Buster Neece 2022-12-30 10:44:47 -06:00
parent 38f480f72b
commit 069481353e
No known key found for this signature in database
GPG Key ID: F1D2E64A0005E80E
16 changed files with 101 additions and 96 deletions

View File

@ -1,3 +1,2 @@
vue/components/Public/WebDJ/Stream.js vue/components/Public/WebDJ/*
vue/components/Public/WebDJ/Track.js
vue/vendor/chartjs-colorschemes/* vue/vendor/chartjs-colorschemes/*

View File

@ -4,16 +4,17 @@ module.exports = {
'plugin:vue/vue3-recommended' 'plugin:vue/vue3-recommended'
], ],
rules: { rules: {
"vue/no-v-html": "off",
"vue/multi-word-component-names": "off",
"no-unused-vars": ["error", { "no-unused-vars": ["error", {
"varsIgnorePattern": "^_|props", "varsIgnorePattern": "^_|props",
}], }],
"vue/multi-word-component-names": "off",
"vue/html-indent": ["error", 4, { "vue/html-indent": ["error", 4, {
"attribute": 1, "attribute": 1,
"baseIndent": 1, "baseIndent": 1,
"closeBracket": 0, "closeBracket": 0,
"alignAttributesVertically": true "alignAttributesVertically": true
}] }],
"vue/no-v-html": "off",
"vue/no-mutating-props": "off"
} }
} }

View File

@ -51,6 +51,7 @@ const props = defineProps({
} }
}); });
const remainingStations = computed(() => { const remainingStations = computed(() => {
return pickBy(props.stations, (stationName, stationId) => { return pickBy(props.stations, (stationName, stationId) => {
return !find(props.form.permissions.$model.station, {'station_id': stationId}); return !find(props.form.permissions.$model.station, {'station_id': stationId});
@ -61,6 +62,7 @@ const hasRemainingStations = computed(() => {
return !isEmpty(remainingStations.value); return !isEmpty(remainingStations.value);
}); });
const remove = (index) => { const remove = (index) => {
props.form.permissions.$model.station.splice(index, 1); props.form.permissions.$model.station.splice(index, 1);
}; };

View File

@ -9,7 +9,7 @@ import mergeExisting from "~/functions/mergeExisting";
export default { export default {
name: 'BaseEditModal', name: 'BaseEditModal',
components: {ModalForm}, components: {ModalForm}, // eslint-disable-line
props: { props: {
createUrl: { createUrl: {
type: String, type: String,

View File

@ -92,6 +92,7 @@
<b-dropdown-form class="pt-3"> <b-dropdown-form class="pt-3">
<div <div
v-for="field in selectableFields" v-for="field in selectableFields"
:key="field.key"
class="form-group" class="form-group"
> >
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
@ -147,7 +148,7 @@
@refreshed="onRefreshed" @refreshed="onRefreshed"
@sort-changed="onSortChanged" @sort-changed="onSortChanged"
> >
<template #head(selected)="data"> <template #head(selected)>
<b-form-checkbox <b-form-checkbox
:aria-label="$gettext('Select all visible rows')" :aria-label="$gettext('Select all visible rows')"
:checked="allSelected" :checked="allSelected"
@ -274,13 +275,11 @@ export default defineComponent({
}, },
requestConfig: { requestConfig: {
type: Function, type: Function,
default: () => { default: null
}
}, },
requestProcess: { requestProcess: {
type: Function, type: Function,
default: () => { default: null
}
} }
}, },
emits: [ emits: [
@ -361,7 +360,6 @@ export default defineComponent({
}, },
itemProvider() { itemProvider() {
if (this.items !== null) { if (this.items !== null) {
this.totalRows = this.items.length;
return this.items; return this.items;
} }
@ -371,6 +369,11 @@ export default defineComponent({
} }
}, },
watch: { watch: {
items(newVal) {
if (newVal !== null) {
this.totalRows = newVal.length;
}
},
filter() { filter() {
this.currentPage = 1; this.currentPage = 1;
} }

View File

@ -30,7 +30,7 @@ const emit = defineEmits(['click']);
const onEventDidMount = (info) => { const onEventDidMount = (info) => {
let desc = info?.event?.extendedProps?.description || null; let desc = info?.event?.extendedProps?.description || null;
if (desc !== null) { if (desc !== null) {
// eslint-ignore-line no-undef /* eslint-disable no-undef */
$(info.el).tooltip({ $(info.el).tooltip({
title: desc, title: desc,
placement: 'top', placement: 'top',
@ -38,6 +38,7 @@ const onEventDidMount = (info) => {
container: 'body', container: 'body',
offset: 0 offset: 0
}); });
/* eslint-enable */
} }
}; };

View File

@ -46,6 +46,7 @@
<template v-if="!notificationsLoading && notifications.length > 0"> <template v-if="!notificationsLoading && notifications.length > 0">
<div <div
v-for="notification in notifications" v-for="notification in notifications"
:key="notification.title"
class="card-body d-flex align-items-center" class="card-body d-flex align-items-center"
:class="'alert-'+notification.type" :class="'alert-'+notification.type"
role="alert" role="alert"

View File

@ -1,6 +1,9 @@
<template> <template>
<div style="display: contents"> <div style="display: contents">
<div v-for="message in errorMessages"> <div
v-for="message in errorMessages"
:key="message"
>
{{ message }} {{ message }}
</div> </div>
</div> </div>

View File

@ -5,6 +5,7 @@
</p> </p>
<div <div
v-for="(row, index) in history" v-for="(row, index) in history"
:key="row.sh_id"
class="song" class="song"
> >
<strong class="order">{{ history.length - index }}</strong> <strong class="order">{{ history.length - index }}</strong>

View File

@ -106,6 +106,7 @@
> >
<a <a
v-for="stream in streams" v-for="stream in streams"
:key="stream.url"
class="dropdown-item" class="dropdown-item"
href="javascript:" href="javascript:"
@click.prevent="switchStream(stream)" @click.prevent="switchStream(stream)"
@ -157,7 +158,7 @@ import AudioPlayer from '~/components/Common/AudioPlayer';
import Icon from '~/components/Common/Icon'; import Icon from '~/components/Common/Icon';
import PlayButton from "~/components/Common/PlayButton"; import PlayButton from "~/components/Common/PlayButton";
import {computed, onMounted, ref, shallowRef, watch} from "vue"; import {computed, onMounted, ref, shallowRef, watch} from "vue";
import {useMounted, useStorage} from "@vueuse/core"; import {useStorage} from "@vueuse/core";
import formatTime from "~/functions/formatTime"; import formatTime from "~/functions/formatTime";
import {useTranslate} from "~/vendor/gettext"; import {useTranslate} from "~/vendor/gettext";
import useNowPlaying from "~/functions/useNowPlaying"; import useNowPlaying from "~/functions/useNowPlaying";

View File

@ -163,6 +163,7 @@
/> />
</div> </div>
</template> </template>
<!-- eslint-disable-next-line -->
<template #cell(media.length)="row"> <template #cell(media.length)="row">
{{ row.item.media.length_text }} {{ row.item.media.length_text }}
</template> </template>
@ -175,7 +176,10 @@
</template> </template>
</template> </template>
<template #cell(playlists)="row"> <template #cell(playlists)="row">
<template v-for="(playlist, index) in row.item.playlists"> <template
v-for="(playlist, index) in row.item.playlists"
:key="playlist.id"
>
<a <a
class="btn-search" class="btn-search"
href="#" href="#"

View File

@ -154,7 +154,7 @@ const setCueOut = () => {
const setFadeOverlap = () => { const setFadeOverlap = () => {
let duration = $waveform.value?.getDuration(); let duration = $waveform.value?.getDuration();
let currentTime = $waveform.value?.getCurrentTime(); let currentTime = $waveform.value?.getCurrentTime();
let cue_out = form.value?.cue_out ?? duration; let cue_out = props.form.cue_out ?? duration;
props.form.fade_overlap = Math.round((cue_out - currentTime) * 10) / 10; props.form.fade_overlap = Math.round((cue_out - currentTime) * 10) / 10;
updateRegions(); updateRegions();
@ -162,7 +162,7 @@ const setFadeOverlap = () => {
const setFadeIn = () => { const setFadeIn = () => {
let currentTime = $waveform.value?.getCurrentTime(); let currentTime = $waveform.value?.getCurrentTime();
let cue_in = form.value?.cue_in ?? 0; let cue_in = props.form.cue_in ?? 0;
props.form.fade_in = Math.round((currentTime - cue_in) * 10) / 10; props.form.fade_in = Math.round((currentTime - cue_in) * 10) / 10;
updateRegions(); updateRegions();
@ -171,7 +171,7 @@ const setFadeIn = () => {
const setFadeOut = () => { const setFadeOut = () => {
let currentTime = $waveform.value?.getCurrentTime(); let currentTime = $waveform.value?.getCurrentTime();
let duration = $waveform.value?.getDuration(); let duration = $waveform.value?.getDuration();
let cue_out = form.value?.cue_out ?? duration; let cue_out = props.form.cue_out ?? duration;
props.form.fade_out = Math.round((cue_out - currentTime) * 10) / 10; props.form.fade_out = Math.round((cue_out - currentTime) * 10) / 10;
updateRegions(); updateRegions();

View File

@ -14,8 +14,8 @@
> >
<form-basic-info :form="v$.form" /> <form-basic-info :form="v$.form" />
<form-schedule <form-schedule
v-model:schedule-items="form.schedule_items"
:form="v$.form" :form="v$.form"
:schedule-items="form.schedule_items"
:station-time-zone="stationTimeZone" :station-time-zone="stationTimeZone"
/> />
<form-advanced <form-advanced

View File

@ -33,43 +33,44 @@
</b-tab> </b-tab>
</template> </template>
<script> <script setup>
import Icon from '~/components/Common/Icon'; import Icon from '~/components/Common/Icon';
import PlaylistsFormScheduleRow from "~/components/Stations/Playlists/Form/ScheduleRow.vue"; import PlaylistsFormScheduleRow from "~/components/Stations/Playlists/Form/ScheduleRow.vue";
import {useVModel} from "@vueuse/core";
export default { const props = defineProps({
name: 'PlaylistEditSchedule', form: {
components: {PlaylistsFormScheduleRow, Icon}, type: Object,
props: { required: true
form: {
type: Object,
required: true
},
stationTimeZone: {
type: String,
required: true
},
scheduleItems: {
type: Array,
default: () => {
return [];
}
}
}, },
methods: { stationTimeZone: {
add() { type: String,
this.scheduleItems.push({ required: true
start_time: null, },
end_time: null, scheduleItems: {
start_date: null, type: Array,
end_date: null, default: () => {
days: [], return [];
loop_once: false
});
},
remove (index) {
this.scheduleItems.splice(index, 1);
} }
} }
});
const emit = defineEmits(['update:scheduleItems']);
const scheduleItems = useVModel(props, 'scheduleItems', emit);
const add = () => {
scheduleItems.value.push({
start_time: null,
end_time: null,
start_date: null,
end_date: null,
days: [],
loop_once: false
});
};
const remove = (index) => {
scheduleItems.value.splice(index, 1);
}; };
</script> </script>

View File

@ -14,8 +14,8 @@
> >
<form-basic-info :form="v$.form" /> <form-basic-info :form="v$.form" />
<form-schedule <form-schedule
v-model:schedule-items="form.schedule_items"
:form="v$.form" :form="v$.form"
:schedule-items="form.schedule_items"
:station-time-zone="stationTimeZone" :station-time-zone="stationTimeZone"
/> />
<form-artwork <form-artwork

View File

@ -31,55 +31,43 @@
</b-tab> </b-tab>
</template> </template>
<script> <script setup>
import Icon from '~/components/Common/Icon'; import Icon from '~/components/Common/Icon';
import StreamersFormScheduleRow from "~/components/Stations/Streamers/Form/ScheduleRow.vue"; import StreamersFormScheduleRow from "~/components/Stations/Streamers/Form/ScheduleRow.vue";
import {useVModel} from "@vueuse/core";
export default { const props = defineProps({
name: 'StreamerFormSchedule', form: {
components: {StreamersFormScheduleRow, Icon}, type: Object,
props: { required: true
form: {
type: Object,
required: true
},
stationTimeZone: {
type: String,
required: true
},
scheduleItems: {
type: Array,
default: () => {
return [];
}
}
}, },
data() { stationTimeZone: {
return { type: String,
dayOptions: [ required: true
{value: 1, text: this.$gettext('Monday')},
{value: 2, text: this.$gettext('Tuesday')},
{value: 3, text: this.$gettext('Wednesday')},
{value: 4, text: this.$gettext('Thursday')},
{value: 5, text: this.$gettext('Friday')},
{value: 6, text: this.$gettext('Saturday')},
{value: 7, text: this.$gettext('Sunday')}
]
};
}, },
methods: { scheduleItems: {
add () { type: Array,
this.scheduleItems.push({ default: () => {
start_time: null, return [];
end_time: null,
start_date: null,
end_date: null,
days: []
});
},
remove (index) {
this.scheduleItems.splice(index, 1);
} }
} }
});
const emit = defineEmits(['update:scheduleItems']);
const scheduleItems = useVModel(props, 'scheduleItems', emit);
const add = () => {
scheduleItems.value.push({
start_time: null,
end_time: null,
start_date: null,
end_date: null,
days: []
});
};
const remove = (index) => {
scheduleItems.value.splice(index, 1);
}; };
</script> </script>