diff --git a/front/.eslintrc.js b/front/.eslintrc.js index d42c4ee3b..a378f0221 100644 --- a/front/.eslintrc.js +++ b/front/.eslintrc.js @@ -23,6 +23,9 @@ module.exports = { 'vue' ], rules: { + // NOTE: Nicer for the eye + 'operator-linebreak': ['error', 'before'], + // NOTE: Handled by typescript 'no-undef': 'off', 'no-unused-vars': 'off', diff --git a/front/src/components/Sidebar.vue b/front/src/components/Sidebar.vue index f61ea72fd..5bcdfa942 100644 --- a/front/src/components/Sidebar.vue +++ b/front/src/components/Sidebar.vue @@ -89,9 +89,9 @@ watchEffect(() => { }) const moderationNotifications = computed(() => - store.state.ui.notifications.pendingReviewEdits + - store.state.ui.notifications.pendingReviewReports + - store.state.ui.notifications.pendingReviewRequests + store.state.ui.notifications.pendingReviewEdits + + store.state.ui.notifications.pendingReviewReports + + store.state.ui.notifications.pendingReviewRequests ) onMounted(async () => { diff --git a/front/src/components/library/EditCard.vue b/front/src/components/library/EditCard.vue index 1984fd39d..b7d5bbefe 100644 --- a/front/src/components/library/EditCard.vue +++ b/front/src/components/library/EditCard.vue @@ -252,8 +252,8 @@ export default { if (!this.$store.state.auth.authenticated) return false // TODO (wvffle): Is it better to compare ids? Is full_username unique? - return this.obj.created_by.full_username === this.$store.state.auth.fullUsername || - this.$store.state.auth.availablePermissions.library + return this.obj.created_by.full_username === this.$store.state.auth.fullUsername + || this.$store.state.auth.availablePermissions.library }, previousState () { if (this.obj.is_applied) { diff --git a/front/src/components/library/EditForm.vue b/front/src/components/library/EditForm.vue index e060b1b68..9641b7a05 100644 --- a/front/src/components/library/EditForm.vue +++ b/front/src/components/library/EditForm.vue @@ -287,9 +287,9 @@ export default { canEdit () { if (!this.$store.state.auth.authenticated) return false - const isOwner = this.object.attributed_to && + const isOwner = this.object.attributed_to // TODO (wvffle): Is it better to compare ids? Is full_username unique? - this.$store.state.auth.fullUsername === this.object.attributed_to.full_username + && this.$store.state.auth.fullUsername === this.object.attributed_to.full_username return isOwner || this.$store.state.auth.availablePermissions.library }, diff --git a/front/src/components/library/FileUpload.vue b/front/src/components/library/FileUpload.vue index 2a517e42f..cf958898f 100644 --- a/front/src/components/library/FileUpload.vue +++ b/front/src/components/library/FileUpload.vue @@ -418,11 +418,11 @@ export default { }, processableFiles () { return ( - this.uploads.pending + - this.uploads.skipped + - this.uploads.errored + - this.uploads.finished + - this.uploadedFilesCount + this.uploads.pending + + this.uploads.skipped + + this.uploads.errored + + this.uploads.finished + + this.uploadedFilesCount ) }, processedFilesCount () { diff --git a/front/src/components/radios/Button.vue b/front/src/components/radios/Button.vue index b8013cbed..1c61a148b 100644 --- a/front/src/components/radios/Button.vue +++ b/front/src/components/radios/Button.vue @@ -27,11 +27,11 @@ const running = computed(() => { return false } - return store.state.radios.current?.type === props.type && - store.state.radios.current?.customRadioId === props.customRadioId && - ( - typeof props.objectId === 'string' || - store.state.radios.current?.objectId?.fullUsername === props.objectId?.fullUsername + return store.state.radios.current?.type === props.type + && store.state.radios.current?.customRadioId === props.customRadioId + && ( + typeof props.objectId === 'string' + || store.state.radios.current?.objectId?.fullUsername === props.objectId?.fullUsername ) }) diff --git a/front/src/composables/audio/usePlayOptions.ts b/front/src/composables/audio/usePlayOptions.ts index 1f926f7a0..f295f41a2 100644 --- a/front/src/composables/audio/usePlayOptions.ts +++ b/front/src/composables/audio/usePlayOptions.ts @@ -37,8 +37,8 @@ export default (props: PlayOptionsProps) => { if (props.track) { return props.track.uploads?.length > 0 } else if (props.artist) { - return props.artist.tracks_count > 0 || - props.artist.albums.some((album) => album.is_playable === true) + return props.artist.tracks_count > 0 + || props.artist?.albums.some((album) => album.is_playable === true) } else if (props.tracks) { return props.tracks.some((track) => (track.uploads?.length ?? 0) > 0) } diff --git a/front/src/types.ts b/front/src/types.ts index 0f870f50e..99ce20683 100644 --- a/front/src/types.ts +++ b/front/src/types.ts @@ -111,8 +111,8 @@ export interface Channel { itunes_category?: unknown itunes_subcategory?: unknown language?: string - owner_name: string - owner_email: string + owner_name?: string + owner_email?: string } } diff --git a/front/src/utils/filters.ts b/front/src/utils/filters.ts index cf3fb8957..90520b5b5 100644 --- a/front/src/utils/filters.ts +++ b/front/src/utils/filters.ts @@ -6,9 +6,9 @@ export function truncate (str: string, max = 100, ellipsis = '…', middle = fal if (!middle) return str.slice(0, max) + ellipsis const charsToShow = max - ellipsis.length - return str.slice(0, Math.ceil(charsToShow / 2)) + - ellipsis + - str.slice(-Math.floor(charsToShow / 2)) + return str.slice(0, Math.ceil(charsToShow / 2)) + + ellipsis + + str.slice(-Math.floor(charsToShow / 2)) } export function momentFormat (date: Date, format = 'lll') { diff --git a/front/src/views/content/remote/Card.vue b/front/src/views/content/remote/Card.vue index 0167bf84e..fffbca3c5 100644 --- a/front/src/views/content/remote/Card.vue +++ b/front/src/views/content/remote/Card.vue @@ -34,8 +34,8 @@ const scanProgress = computed(() => Math.min(latestScan.value.processed_files * const scanStatus = computed(() => latestScan.value?.status ?? 'unknown') const canLaunchScan = computed(() => scanStatus.value !== 'pending' && scanStatus.value !== 'scanning') const radioPlayable = computed(() => ( - (library.value.actor.is_local || scanStatus.value === 'finished') && - (library.value.privacy_level === 'everyone' || library.value.follow?.approved) + (library.value.actor.is_local || scanStatus.value === 'finished') + && (library.value.privacy_level === 'everyone' || library.value.follow?.approved) )) const { $pgettext } = useGettext() diff --git a/front/src/views/library/DetailBase.vue b/front/src/views/library/DetailBase.vue index 58a203e7e..ae4d04334 100644 --- a/front/src/views/library/DetailBase.vue +++ b/front/src/views/library/DetailBase.vue @@ -25,10 +25,10 @@ const object = ref(null) const isOwner = computed(() => store.state.auth.authenticated && object.value?.actor.full_username === store.state.auth.fullUsername) const isPlayable = computed(() => (object.value?.uploads_count ?? 0) > 0 && ( - isOwner.value || - object.value?.privacy_level === 'everyone' || - (object.value?.privacy_level === 'instance' && store.state.auth.authenticated && object.value.actor.domain === store.getters['instance/domain']) || - (store.getters['libraries/follow'](object.value?.uuid) || {}).approved === true + isOwner.value + || object.value?.privacy_level === 'everyone' + || (object.value?.privacy_level === 'instance' && store.state.auth.authenticated && object.value.actor.domain === store.getters['instance/domain']) + || (store.getters['libraries/follow'](object.value?.uuid) || {}).approved === true )) const { $pgettext } = useGettext() diff --git a/front/tsconfig.json b/front/tsconfig.json index 264fec254..9ad4090ef 100644 --- a/front/tsconfig.json +++ b/front/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "@vue/tsconfig/tsconfig.web.json", "compilerOptions": { - "lib": ["webworker"], "baseUrl": ".", "sourceMap": true, "allowJs": true,