fix: lint issues

This commit is contained in:
kolaente
2024-10-29 10:05:53 +01:00
committed by konrad
parent b601671395
commit 703c641aeb
14 changed files with 29 additions and 29 deletions

View File

@@ -73,6 +73,7 @@ function getHeight(el: HTMLElement) {
* https://gist.github.com/paulirish/5d52fb081b3570c81e3a
*/
function forceLayout(el: HTMLElement) {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
el.offsetTop
}

View File

@@ -117,6 +117,7 @@ async function setApiUrl() {
success({message: t('apiConfig.success', {domain: apiDomain.value})})
configureApi.value = false
emit('foundApi', apiUrl.value)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
// Still not found, url is still invalid
errorMsg.value = t('apiConfig.error', {domain: apiDomain.value})

View File

@@ -250,7 +250,6 @@ const sharableName = computed(() => {
if (props.shareType === 'user') {
searchService = shallowReactive(new UserService())
// eslint-disable-next-line vue/no-ref-as-operand
sharable = ref(new UserModel())
searchLabel.value = 'username'
@@ -262,7 +261,6 @@ if (props.shareType === 'user') {
}
} else if (props.shareType === 'team') {
searchService = new TeamService()
// eslint-disable-next-line vue/no-ref-as-operand
sharable = ref(new TeamModel())
searchLabel.value = 'name'

View File

@@ -5,9 +5,12 @@ export function useBodyClass(className: string, defaultValue = false) {
const isActive = ref(defaultValue)
watchEffect(() => {
isActive.value
? document.body.classList.add(className)
: document.body.classList.remove(className)
if(isActive.value) {
document.body.classList.add(className)
return
}
document.body.classList.remove(className)
})
tryOnBeforeUnmount(() => isActive.value && document.body.classList.remove(className))

View File

@@ -24,7 +24,8 @@ export function useCopyToClipboard() {
if (!successful) {
throw new Error()
}
} catch (err) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
error(t('misc.copyError'))
}
@@ -38,6 +39,7 @@ export function useCopyToClipboard() {
}
try {
await navigator.clipboard.writeText(text)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch(e) {
error(t('misc.copyError'))
}

View File

@@ -40,6 +40,7 @@ export const checkAndSetApiUrl = (url: string | undefined | null): Promise<strin
let urlToCheck: URL
try {
urlToCheck = new URL(url)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
throw new InvalidApiUrlProvidedError()
}

View File

@@ -1,5 +1,5 @@
import {describe, it, expect} from 'vitest'
import {hourToDaytime} from "./hourToDaytime"
import {hourToDaytime} from './hourToDaytime'
function dateWithHour(hours: number): Date {
const newDate = new Date()

View File

@@ -23,7 +23,7 @@ export function parseDateProp(kebabDate: DateKebab | undefined): string | undefi
throw new Error('Invalid date values')
}
return new Date(year, month - 1, date).toISOString() as DateISO
} catch(e) {
} catch(_) {
// ignore nonsense route queries
return
}

View File

@@ -273,7 +273,7 @@ describe('Parse Task Text', () => {
const mar = new Date(2022, 2, 32)
vi.setSystemTime(mar)
const result = parseTaskText(`Lorem Ipsum 31st`)
const result = parseTaskText('Lorem Ipsum 31st')
const expectedDate = new Date(2022, 4, 31)
expect(result.text).toBe('Lorem Ipsum')
@@ -617,7 +617,7 @@ describe('Parse Task Text', () => {
expect(result.labels[1]).toBe('label2')
})
it('should correctly parse labels with spaces in them', () => {
const result = parseTaskText(`Lorem *'label with space' Ipsum`)
const result = parseTaskText('Lorem *\'label with space\' Ipsum')
expect(result.text).toBe('Lorem Ipsum')
expect(result.labels).toHaveLength(1)
@@ -647,25 +647,25 @@ describe('Parse Task Text', () => {
expect(result.project).toBe('project')
})
it('should parse a project with a space in it', () => {
const result = parseTaskText(`Lorem Ipsum +'project with long name'`)
const result = parseTaskText('Lorem Ipsum +\'project with long name\'')
expect(result.text).toBe('Lorem Ipsum')
expect(result.project).toBe('project with long name')
})
it('should parse a project with a space in it and "', () => {
const result = parseTaskText(`Lorem Ipsum +"project with long name"`)
const result = parseTaskText('Lorem Ipsum +"project with long name"')
expect(result.text).toBe('Lorem Ipsum')
expect(result.project).toBe('project with long name')
})
it('should parse only the first project', () => {
const result = parseTaskText(`Lorem Ipsum +project1 +project2 +project3`)
const result = parseTaskText('Lorem Ipsum +project1 +project2 +project3')
expect(result.text).toBe('Lorem Ipsum +project2 +project3')
expect(result.project).toBe('project1')
})
it('should parse a project that\'s called like a date as project', () => {
const result = parseTaskText(`Lorem Ipsum +today`)
const result = parseTaskText('Lorem Ipsum +today')
expect(result.text).toBe('Lorem Ipsum')
expect(result.project).toBe('today')
@@ -681,14 +681,14 @@ describe('Parse Task Text', () => {
expect(result.priority).toBe(PRIORITIES[p])
})
}
it(`should not parse an invalid priority`, () => {
const result = parseTaskText(`Lorem Ipsum !9999`)
it('should not parse an invalid priority', () => {
const result = parseTaskText('Lorem Ipsum !9999')
expect(result.text).toBe('Lorem Ipsum !9999')
expect(result.priority).toBe(null)
})
it(`should not parse an invalid priority but use the first valid one it finds`, () => {
const result = parseTaskText(`Lorem Ipsum !9999 !1`)
it('should not parse an invalid priority but use the first valid one it finds', () => {
const result = parseTaskText('Lorem Ipsum !9999 !1')
expect(result.text).toBe('Lorem Ipsum !9999')
expect(result.priority).toBe(1)
@@ -724,7 +724,7 @@ describe('Parse Task Text', () => {
expect(result.assignees[1]).toBe('user2')
})
it('should parse an assignee with a space in it', () => {
const text = `Lorem Ipsum @'user with long name'`
const text = 'Lorem Ipsum @\'user with long name\''
const result = parseTaskText(text)
expect(result.text).toBe(text)
@@ -732,7 +732,7 @@ describe('Parse Task Text', () => {
expect(result.assignees[0]).toBe('user with long name')
})
it('should parse an assignee with a space in it and "', () => {
const text = `Lorem Ipsum @"user with long name"`
const text = 'Lorem Ipsum @"user with long name"'
const result = parseTaskText(text)
expect(result.text).toBe(text)
@@ -740,7 +740,7 @@ describe('Parse Task Text', () => {
expect(result.assignees[0]).toBe('user with long name')
})
it('should parse an assignee who is called like a date as assignee', () => {
const text = `Lorem Ipsum @today`
const text = 'Lorem Ipsum @today'
const result = parseTaskText(text)
expect(result.text).toBe(text)

View File

@@ -1,5 +1,3 @@
/* eslint-disable no-console */
import {register} from 'register-service-worker'
import {getFullBaseUrl} from './helpers/getFullBaseUrl'

View File

@@ -247,7 +247,7 @@ export const useAuthStore = defineStore('auth', () => {
isAuthenticated = info.exp >= ts
// Settings should only be loaded from the api request, not via the jwt
setUser(info, false)
} catch (e) {
} catch (_) {
logout()
}

View File

@@ -1,6 +1,3 @@
/* eslint-disable no-console */
/* eslint-disable no-undef */
import {getFullBaseUrl} from './helpers/getFullBaseUrl'
declare let self: ServiceWorkerGlobalScope

View File

@@ -88,7 +88,7 @@ export function useGanttTaskList<F extends Filters>(
// update the task with possible changes from server
tasks.value.set(updatedTask.id, updatedTask)
success('Saved')
} catch (e) {
} catch (_) {
error('Something went wrong saving the task')
// roll back changes
tasks.value.set(task.id, oldTask)

View File

@@ -117,7 +117,6 @@ const showAll = computed(() => typeof props.dateFrom === 'undefined' || typeof p
const pageTitle = computed(() => {
// We need to define "key" because it is the first parameter in the array and we need the second
const predefinedRange = Object.entries(DATE_RANGES)
// eslint-disable-next-line no-unused-vars
.find(([, value]) => props.dateFrom === value[0] && props.dateTo === value[1])
?.[0]
if (typeof predefinedRange !== 'undefined') {