chore: run lint (#993)

This commit is contained in:
Rémi Marseault 2023-07-22 22:20:33 +02:00 committed by GitHub
parent 0594af387f
commit 8b4a342cb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 80 additions and 78 deletions

View file

@ -20,11 +20,8 @@ export default {
components: { Navbar },
mixins: [General],
computed: {
...mapState(['rid', 'mainData', 'preferences', 'modals', 'webuiSettings']),
...mapGetters(['getAuthenticated']),
isAuthenticated() {
return this.getAuthenticated()
},
...mapState(['modals', 'webuiSettings']),
...mapGetters(['isAuthenticated']),
onLoginPage() {
return this.$router.currentRoute.name?.includes('login')
}

View file

@ -1,7 +1,7 @@
import store from '@/store'
import {formatSpeed} from '@/filters'
import {formatProgress} from '@/filters'
import {Torrent} from '@/models'
import { formatSpeed } from '@/filters'
import { formatProgress } from '@/filters'
import { Torrent } from '@/models'
export class DocumentTitle {
private static setDefault() {

View file

@ -34,9 +34,9 @@
import { defineComponent } from 'vue'
import { mapGetters, mapState } from 'vuex'
import qbit from '@/services/qbit'
import {FullScreenModal, Modal} from '@/mixins'
import {Torrent} from '@/models'
import WebUISettings from '@/types/vuetorrent/WebUISettings'
import { FullScreenModal, Modal } from '@/mixins'
import { Torrent } from '@/models'
import { WebUISettings } from '@/types/vuetorrent'
export default defineComponent({
name: 'ConfirmDeleteModal',

View file

@ -178,7 +178,7 @@ import { General } from '@/mixins'
import { TitleOptions } from '@/enums/vuetorrent'
import Ajv from 'ajv'
import { StoreStateSchema } from '@/schemas'
import WebUISettings from '@/types/vuetorrent/WebUISettings'
import { WebUISettings } from '@/types/vuetorrent'
export default defineComponent({
name: 'VueTorrent-General',

View file

@ -8,8 +8,8 @@
</template>
<script lang="ts">
import {defineComponent} from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { defineComponent } from 'vue'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'AddedOn',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'AmountLeft',

View file

@ -11,7 +11,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'Availability',

View file

@ -11,7 +11,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'Category',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'CompletedOn',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'ContentPath',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'DownloadLimit',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'DownloadPath',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'DownloadSpeed',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'Downloaded',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'DownloadedSession',

View file

@ -11,7 +11,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'ETA',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'GlobalSpeed',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'GlobalVolume',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'Hash',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'InfoHashV1',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'InfoHashV2',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'LastActivity',

View file

@ -12,7 +12,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'Peers',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'Ratio',

View file

@ -11,7 +11,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'SavePath',

View file

@ -12,7 +12,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'Seeds',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'SeenComplete',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'Size',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'TimeActive',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'TotalSize',

View file

@ -9,7 +9,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'TrackersCount',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'UploadLimit',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'UploadSpeed',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'Uploaded',

View file

@ -14,7 +14,7 @@
<script lang="ts">
import { defineComponent } from 'vue'
import {TorrentDashboardItem} from '@/mixins'
import { TorrentDashboardItem } from '@/mixins'
export default defineComponent({
name: 'UploadedSession',

View file

@ -83,9 +83,9 @@ import { mapState } from 'vuex'
import { mdiChevronUp, mdiChevronDown } from '@mdi/js'
import { getDomainBody } from '@/helpers'
import { DashboardProperty } from '@/enums/vuetorrent'
import {TorrentDashboardItem} from '@/mixins'
import {toPrecision} from '@/filters'
import {TorrentProperty} from '@/types/vuetorrent'
import { TorrentDashboardItem } from '@/mixins'
import { toPrecision } from '@/filters'
import { TorrentProperty } from '@/types/vuetorrent'
export default defineComponent({
name: 'MobileCard',

View file

@ -92,7 +92,14 @@
</v-list-item>
</v-list>
</v-menu>
<v-menu v-if="settings.queueing_enabled" :open-on-hover="!touchmode" top offset-x :transition="isRightside ? 'slide-x-reverse-transition' : 'slide-x-transition'" :left="isRightside">
<v-menu
v-if="settings.queueing_enabled"
:open-on-hover="!touchmode"
top
offset-x
:transition="isRightside ? 'slide-x-reverse-transition' : 'slide-x-transition'"
:left="isRightside"
>
<template #activator="{ on }">
<v-list-item link v-on="on">
<v-icon>{{ mdiPriorityHigh }}</v-icon>

View file

@ -173,7 +173,7 @@
<script lang="ts">
import dayjs from 'dayjs'
import {FullScreenModal, TorrentDashboardItem} from '@/mixins'
import { FullScreenModal, TorrentDashboardItem } from '@/mixins'
import qbit from '@/services/qbit'
import { splitByUrl, stringContainsUrl } from '@/helpers'
import { defineComponent } from 'vue'

View file

@ -21,7 +21,9 @@
<v-progress-circular v-else-if="torrent?.progress === 100" :size="100" :width="15" :value="100" color="torrent-seeding">
<v-icon color="torrent-seeding">{{ mdiCheck }}</v-icon>
</v-progress-circular>
<v-progress-circular v-else :rotate="-90" :size="100" :width="15" :value="torrent?.progress ?? 0" color="accent">{{ (torrent.progress ?? 0) | progress }}</v-progress-circular>
<v-progress-circular v-else :rotate="-90" :size="100" :width="15" :value="torrent?.progress ?? 0" color="accent">
{{ (torrent.progress ?? 0) | progress }}
</v-progress-circular>
</v-col>
<v-col cols="8" md="9" class="d-flex align-center justify-center flex-column">
<div v-if="isFetchingMetadata">
@ -136,7 +138,7 @@
<script lang="ts">
import dayjs from 'dayjs'
import {FullScreenModal, General, TorrentDashboardItem} from '@/mixins'
import { FullScreenModal, General, TorrentDashboardItem } from '@/mixins'
import qbit from '@/services/qbit'
import { getDomainBody, splitByUrl, stringContainsUrl } from '@/helpers'
import { defineComponent } from 'vue'
@ -144,8 +146,8 @@ import { mapState } from 'vuex'
import { mdiArrowDown, mdiArrowUp, mdiCheck, mdiClose, mdiPencil } from '@mdi/js'
import { TorrentState } from '@/enums/vuetorrent'
import { Priority } from '@/enums/qbit'
import {TorrentFile} from '@/types/qbit/models'
import {formatDataUnit, formatDataValue} from '@/filters'
import { TorrentFile } from '@/types/qbit/models'
import { formatDataUnit, formatDataValue } from '@/filters'
export default defineComponent({
name: 'Overflow',
@ -300,7 +302,7 @@ export default defineComponent({
}
},
async changeLocation() {
this.createModal('ChangeLocationModal', {hashes: [this.torrent?.hash as string]})
this.createModal('ChangeLocationModal', { hashes: [this.torrent?.hash as string] })
},
async renameTorrentFile() {
this.createModal('RenameTorrentFileModal', {

View file

@ -14,14 +14,14 @@ export default defineComponent({
selectTorrent(hash: string) {
if (!this.selectMode) this.selectMode = true
if (this.isAlreadySelected(hash)) {
this.$store.commit('SET_SELECTED', {type: 'remove', hash})
this.$store.commit('SET_SELECTED', { type: 'remove', hash })
} else {
this.$store.commit('SET_SELECTED', {type: 'add', hash})
this.$store.commit('SET_SELECTED', { type: 'add', hash })
}
},
selectUntil(hash: string, index: number) {
if (!this.selectMode) return
this.$store.commit('SET_SELECTED', {type: 'until', hash, index})
this.$store.commit('SET_SELECTED', { type: 'until', hash, index })
}
}
})

View file

@ -41,6 +41,6 @@ export default {
Vue.$toast.error(i18n.t('toast.resetSettingsNeeded').toString(), { timeout: 2500 })
},
FETCH_SEARCH_PLUGINS: async (store: Store<StoreState>) => {
await qbit.getSearchPlugins().then(plugins => store.commit('UPDATE_SEARCH_PLUGINS', plugins))
await qbit.getSearchPlugins().then(plugins => store.commit('SET_SEARCH_PLUGINS', plugins))
}
}

View file

@ -20,7 +20,7 @@ export default {
getModals: (state: StoreState) => () => state.modals,
getTorrents: (state: StoreState) => () => state.torrents,
getTrackers: (state: StoreState) => () => state.trackers,
getAuthenticated: (state: StoreState) => () => state.authenticated,
isAuthenticated: (state: StoreState) => () => state.authenticated,
getTorrentCountString: (state: StoreState, getters: any) => () => {
if (state.selected_torrents.length) {
let selectedSize = state.selected_torrents

View file

@ -93,7 +93,7 @@ export default {
FETCH_TAGS: async (state: StoreState) => (state.tags = await qbit.getAvailableTags()),
FETCH_FEEDS: async (state: StoreState) => (state.rss.feeds = Object.entries(await qbit.getFeeds(true)).map(([key, value]) => ({ name: key, ...value }))),
FETCH_RULES: async (state: StoreState) => (state.rss.rules = Object.entries(await qbit.getRules()).map(([key, value]) => ({ name: key, ...value }))),
UPDATE_SEARCH_PLUGINS: async (state: StoreState, plugins: SearchPlugin[]) => (state.searchPlugins = plugins),
SET_SEARCH_PLUGINS: async (state: StoreState, plugins: SearchPlugin[]) => (state.searchPlugins = plugins),
SET_CURRENT_ITEM_COUNT: (state: StoreState, count: number) => (state.filteredTorrentsCount = count),
SET_LANGUAGE: async (state: StoreState) => setLanguage(state.webuiSettings.lang)
}

View file

@ -6,7 +6,7 @@ import type SortOptions from './SortOptions'
import type { AppPreferences } from '../qbit/models'
import type ModalTemplate from './ModalTemplate'
import type { Status } from '@/models'
import type WebUISettings from '@/types/vuetorrent/WebUISettings'
import type WebUISettings from './WebUISettings'
import type { SearchPlugin } from '@/types/qbit/models'
export interface PersistentStoreState {

View file

@ -7,7 +7,7 @@ import type SortOptions from './SortOptions'
import type StoreState from './StoreState'
import type { PersistentStoreState } from './StoreState'
import type { TreeNode, TreeFile, TreeFolder, TreeRoot } from './TreeObjects'
import { TorrentProperty } from './WebUISettings'
import WebUISettings, { TorrentProperty } from './WebUISettings'
import type Tracker from './Tracker'
export {
@ -26,5 +26,6 @@ export {
TreeFolder,
TreeRoot,
TorrentProperty,
Tracker
Tracker,
WebUISettings
}

View file

@ -391,7 +391,7 @@ export default {
if (e.preventDefault) e.preventDefault()
if (!this.selectMode) {
this.$store.commit('SET_SELECTED', {type: 'add', hash: data.torrent.hash})
this.$store.commit('SET_SELECTED', { type: 'add', hash: data.torrent.hash })
}
this.tmCalc.TouchMode = touchmode
@ -401,7 +401,7 @@ export default {
this.trcMenu.show = true
})
},
hideTorrentRightClickMenu(e) {
hideTorrentRightClickMenu() {
if (!this.selectMode && this.getModals().length === 0) {
this.resetSelected()
}
@ -486,8 +486,7 @@ export default {
}
// 'Search' => Search view
if (e.key === "/" && this.$route.name !== 'search' && document.activeElement !== document.getElementById('searchInput'))
this.$router.push({ name: 'search' })
if (e.key === '/' && this.$route.name !== 'search' && document.activeElement !== document.getElementById('searchInput')) this.$router.push({ name: 'search' })
}
}
}

View file

@ -1,12 +1,8 @@
import { describe, beforeEach, it, expect, vi } from 'vitest'
import { shallowMount } from '@vue/test-utils'
import Vue from 'vue'
import Vuetify from 'vuetify'
import { Ripple } from 'vuetify/lib/directives'
import { describe, expect, it, vi } from "vitest";
import { mdiChevronDown } from '@mdi/js'
import SpeedCard from '@/components/Core/SpeedCard.vue'
import {setup} from "../helpers";
import { mdiChevronDown } from "@mdi/js";
import SpeedCard from "@/components/Core/SpeedCard.vue";
import { setup } from "../helpers";
describe('SpeedCard.vue', () => {
it('should render the card', () => {

View file

@ -11,14 +11,14 @@ let wrapper
describe('StorageCard.vue', () => {
beforeEach(() => {
wrapper = shallowMount(StorageCard, {
propsData: {label, value, color},
propsData: { label, value, color },
filters: {
formatDataValue: vi.fn().mockReturnValue('9.77'),
formatDataUnit: vi.fn().mockReturnValue('KB')
},
mocks: {
$store: {
getters: { shouldUseBinaryData: vi.fn().mockReturnValue(true) },
getters: { shouldUseBinaryData: vi.fn().mockReturnValue(true) }
}
}
})

View file

@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
import {titleCase, capitalize, formatData, formatSpeed, toPrecision} from '@/filters'
import { titleCase, capitalize, formatData, formatSpeed, toPrecision } from '@/filters'
describe('Filters', () => {
it('titleCase', () => {