Browse Source

fix: eslint configuration tweak and fixing issues found

Owen Diffey 2 years ago
parent
commit
d7f15e05dd

+ 1 - 2
frontend/.eslintrc

@@ -14,8 +14,7 @@
 		"parser": "@typescript-eslint/parser"
 	},
 	"extends": [
-		"airbnb-base",
-		"plugin:vue/strongly-recommended",
+		"plugin:vue/vue3-strongly-recommended",
 		"eslint:recommended",
 		"prettier",
 		"plugin:@typescript-eslint/eslint-recommended",

+ 0 - 2
frontend/src/api/admin/index.ts

@@ -1,5 +1,3 @@
-/* eslint-disable import/no-cycle */
-
 import reports from "./reports";
 
 // when Pinia needs to interact with websockets

+ 0 - 2
frontend/src/api/admin/reports.ts

@@ -1,5 +1,3 @@
-/* eslint-disable import/no-cycle */
-
 import Toast from "toasters";
 import ws from "@/ws";
 

+ 0 - 2
frontend/src/api/auth.ts

@@ -1,5 +1,3 @@
-/* eslint-disable import/no-cycle */
-
 import Toast from "toasters";
 import ws from "@/ws";
 

+ 2 - 2
frontend/src/components/AutoSuggest.vue

@@ -8,7 +8,7 @@ const props = defineProps({
 	allItems: { type: Array, default: () => [] }
 });
 
-const emit = defineEmits(["update:modelValue"]);
+const emit = defineEmits(["update:modelValue", "submitted"]);
 
 const inputFocussed = ref(false);
 const containerFocussed = ref(false);
@@ -81,7 +81,7 @@ const blurAutosuggestItem = event => {
 			:disabled="disabled"
 			@blur="blurInput($event)"
 			@focus="focusInput()"
-			@keydown.enter="$emit('submitted')"
+			@keydown.enter="emit('submitted')"
 			@keydown="keydownInput()"
 		/>
 		<div

+ 4 - 2
frontend/src/components/modals/EditSong/index.vue

@@ -49,7 +49,9 @@ const emit = defineEmits([
 	"savedError",
 	"flagSong",
 	"nextSong",
-	"close"
+	"close",
+	"saving",
+	"toggleFlag"
 ]);
 
 const editSongStore = useEditSongStore(props);
@@ -1484,7 +1486,7 @@ onBeforeUnmount(() => {
 							:song="song"
 							:fallback="false"
 							class="thumbnail-preview"
-							@loadError="onThumbnailLoadError"
+							@load-error="onThumbnailLoadError"
 						/>
 						<img
 							v-if="

+ 4 - 4
frontend/src/components/modals/EditSongs.vue

@@ -299,11 +299,11 @@ onUnmounted(() => {
 			:bulk="true"
 			:flagged="currentSongFlagged"
 			v-if="currentSong"
-			@savedSuccess="onSavedSuccess"
-			@savedError="onSavedError"
+			@saved-success="onSavedSuccess"
+			@saved-error="onSavedError"
 			@saving="onSaving"
-			@toggleFlag="toggleFlag"
-			@nextSong="editNextSong"
+			@toggle-flag="toggleFlag"
+			@next-song="editNextSong"
 			@close="onClose"
 		>
 			<template #toggleMobileSidebar>

+ 0 - 2
frontend/src/stores/bulkActions.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useBulkActionsStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`bulkActions-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/confirm.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useConfirmStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`confirm-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/createStation.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useCreateStationStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`createStation-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/editNews.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useEditNewsStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`editNews-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/editPlaylist.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useEditPlaylistStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`editPlaylist-${modalUuid}`, {

+ 0 - 25
frontend/src/stores/editSong.ts

@@ -1,9 +1,5 @@
-/* eslint no-param-reassign: 0 */
-
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useEditSongStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`editSong-${modalUuid}`, {
@@ -118,27 +114,6 @@ export const useEditSongStore = props => {
 					this.video.playbackRate =
 						this.video.player.getPlaybackRate();
 				}
-			},
-
-			getCurrentTime(fixedVal) {
-				// new Promise(resolve => {
-				// 	commit("getCurrentTime", fixedVal);
-				// 	resolve(this.video.currentTime);
-				// }),
-				// 	if (!this.playerReady) this.video.currentTime = 0;
-				// else {
-				// 	Promise.resolve(this.video.player.getCurrentTime()).then(
-				// 		time => {
-				// 			if (fixedVal)
-				// 				Promise.resolve(time.toFixed(fixedVal)).then(
-				// 					fixedTime => {
-				// 						this.video.currentTime = fixedTime;
-				// 					}
-				// 				);
-				// 			else this.video.currentTime = time;
-				// 		}
-				// 	);
-				// }
 			}
 		}
 	})();

+ 0 - 4
frontend/src/stores/editSongs.ts

@@ -1,9 +1,5 @@
-/* eslint no-param-reassign: 0 */
-
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useEditSongsStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`editSongs-${modalUuid}`, {

+ 0 - 4
frontend/src/stores/editUser.ts

@@ -1,9 +1,5 @@
-/* eslint no-param-reassign: 0 */
-
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useEditUserStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`editUser-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/importAlbum.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useImportAlbumStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`importAlbum-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/longJobs.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useLongJobsStore = defineStore("longJobs", {
 	state: () => ({
 		activeJobs: [],

+ 0 - 2
frontend/src/stores/manageStation.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useManageStationStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`manageStation-${modalUuid}`, {

+ 0 - 4
frontend/src/stores/modals.ts

@@ -20,8 +20,6 @@ import { useViewReportStore } from "@/stores/viewReport";
 import { useViewYoutubeVideoStore } from "@/stores/viewYoutubeVideo";
 import { useWhatIsNewStore } from "@/stores/whatIsNew";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useModalsStore = defineStore("modals", {
 	state: () => ({
 		modals: {},
@@ -155,8 +153,6 @@ export const useModalsStore = defineStore("modals", {
 	}
 });
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useModalComponents = (baseDirectory, map) => {
 	const modalComponents = {};
 	Object.entries(map).forEach(([mapKey, mapValue]) => {

+ 0 - 2
frontend/src/stores/removeAccount.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useRemoveAccountStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`removeAccount-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/report.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useReportStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`report-${modalUuid}`, {

+ 0 - 4
frontend/src/stores/settings.ts

@@ -1,9 +1,5 @@
-/* eslint no-param-reassign: 0 */
-
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useSettingsStore = defineStore("settings", {
 	state: () => ({
 		originalUser: {},

+ 0 - 2
frontend/src/stores/station.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useStationStore = defineStore("station", {
 	state: () => ({
 		station: {},

+ 0 - 2
frontend/src/stores/userAuth.ts

@@ -3,8 +3,6 @@ import validation from "@/validation";
 import ws from "@/ws";
 import auth from "@/api/auth";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useUserAuthStore = defineStore("userAuth", {
 	state: () => ({
 		userIdMap: {},

+ 0 - 2
frontend/src/stores/userPlaylists.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useUserPlaylistsStore = defineStore("userPlaylists", {
 	state: () => ({
 		playlists: [],

+ 0 - 2
frontend/src/stores/userPreferences.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useUserPreferencesStore = defineStore("userPreferences", {
 	state: () => ({
 		nightmode: false,

+ 0 - 2
frontend/src/stores/viewApiRequest.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useViewApiRequestStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`viewApiRequest-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/viewPunishment.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useViewPunishmentStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`viewPunishment-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/viewReport.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useViewReportStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`viewReport-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/viewYoutubeVideo.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useViewYoutubeVideoStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`viewYoutubeVideo-${modalUuid}`, {

+ 0 - 2
frontend/src/stores/websockets.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useWebsocketsStore = defineStore("websockets", {
 	state: () => ({
 		socket: {

+ 0 - 2
frontend/src/stores/whatIsNew.ts

@@ -1,7 +1,5 @@
 import { defineStore } from "pinia";
 
-// TODO fix/decide eslint rule properly
-// eslint-disable-next-line
 export const useWhatIsNewStore = props => {
 	const { modalUuid } = props;
 	return defineStore(`whatIsNew-${modalUuid}`, {