1
0
Fork 0

fix: lint

This commit is contained in:
kolaente 2023-05-24 17:15:24 +02:00
parent c1fa64afc7
commit 6da6c6eb20
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
14 changed files with 42 additions and 39 deletions

View File

@ -74,6 +74,7 @@ export interface BaseButtonEmits {
(e: 'click', payload: MouseEvent): void (e: 'click', payload: MouseEvent): void
} }
// eslint-disable-next-line vue/no-dupe-keys
const { const {
type = BASE_BUTTON_TYPES_MAP.BUTTON, type = BASE_BUTTON_TYPES_MAP.BUTTON,
disabled = false, disabled = false,

View File

@ -66,9 +66,9 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const modelValue = toRef(props, 'modelValue') const modelValueRef = toRef(props, 'modelValue')
watch( watch(
modelValue, modelValueRef,
(newValue) => { (newValue) => {
color.value = newValue color.value = newValue
}, },

View File

@ -56,6 +56,7 @@ export interface ButtonProps extends BaseButtonProps {
wrap?: boolean wrap?: boolean
} }
// eslint-disable-next-line vue/no-dupe-keys
const { const {
variant = 'primary', variant = 'primary',
icon = '', icon = '',

View File

@ -134,9 +134,9 @@ const changed = ref(false)
onMounted(() => document.addEventListener('click', hideDatePopup)) onMounted(() => document.addEventListener('click', hideDatePopup))
onBeforeUnmount(() =>document.removeEventListener('click', hideDatePopup)) onBeforeUnmount(() =>document.removeEventListener('click', hideDatePopup))
const modelValue = toRef(props, 'modelValue') const modelValueRef = toRef(props, 'modelValue')
watch( watch(
modelValue, modelValueRef,
setDateValue, setDateValue,
{immediate: true}, {immediate: true},
) )

View File

@ -157,10 +157,10 @@ const config = ref(createEasyMDEConfig({
const checkboxId = ref(createRandomID()) const checkboxId = ref(createRandomID())
const {modelValue} = toRefs(props) const {modelValue: modelValueRef} = toRefs(props)
watch( watch(
modelValue, modelValueRef,
async (value) => { async (value) => {
text.value = value text.value = value
await nextTick() await nextTick()
@ -172,7 +172,7 @@ watch(
text, text,
(newVal, oldVal) => { (newVal, oldVal) => {
// Only bubble the new value if it actually changed, but not if the component just got mounted and the text changed from the outside. // Only bubble the new value if it actually changed, but not if the component just got mounted and the text changed from the outside.
if (oldVal === '' && text.value === modelValue.value) { if (oldVal === '' && text.value === modelValueRef.value) {
return return
} }
bubble() bubble()
@ -181,8 +181,8 @@ watch(
onMounted(() => { onMounted(() => {
if (modelValue.value !== '') { if (modelValueRef.value !== '') {
text.value = modelValue.value text.value = modelValueRef.value
} }
if (props.previewIsDefault && props.hasPreview) { if (props.previewIsDefault && props.hasPreview) {

View File

@ -227,10 +227,10 @@ const internalValue = ref<string | {[key: string]: any} | any[] | null>(null)
onMounted(() => document.addEventListener('click', hideSearchResultsHandler)) onMounted(() => document.addEventListener('click', hideSearchResultsHandler))
onBeforeUnmount(() => document.removeEventListener('click', hideSearchResultsHandler)) onBeforeUnmount(() => document.removeEventListener('click', hideSearchResultsHandler))
const {modelValue, searchResults} = toRefs(props) const {modelValue: modelValueRef, searchResults: searchResultsRef} = toRefs(props)
watch( watch(
modelValue, modelValueRef,
(value) => setSelectedObject(value), (value) => setSelectedObject(value),
{ {
immediate: true, immediate: true,
@ -261,10 +261,10 @@ const creatableAvailable = computed(() => {
const filteredSearchResults = computed(() => { const filteredSearchResults = computed(() => {
const currentInternal = internalValue.value const currentInternal = internalValue.value
if (props.multiple && currentInternal !== null && Array.isArray(currentInternal)) { if (props.multiple && currentInternal !== null && Array.isArray(currentInternal)) {
return searchResults.value.filter((item: any) => !currentInternal.some(e => e === item)) return searchResultsRef.value.filter((item: any) => !currentInternal.some(e => e === item))
} }
return searchResults.value return searchResultsRef.value
}) })
const hasMultiple = computed(() => { const hasMultiple = computed(() => {
@ -392,8 +392,8 @@ function create() {
} }
function createOrSelectOnEnter() { function createOrSelectOnEnter() {
if (!creatableAvailable.value && searchResults.value.length === 1) { if (!creatableAvailable.value && searchResultsRef.value.length === 1) {
select(searchResults.value[0]) select(searchResultsRef.value[0])
return return
} }

View File

@ -93,7 +93,7 @@ const emit = defineEmits([
...allEvents.map(camelToKebab), ...allEvents.map(camelToKebab),
]) ])
const {modelValue, config, disabled} = toRefs(props) const {modelValue: modelValueRef, config: configRef, disabled: disabledRef} = toRefs(props)
// bind listener like onBlur // bind listener like onBlur
const attrs = useAttrs() const attrs = useAttrs()
@ -159,7 +159,7 @@ onMounted(() => {
}) })
onBeforeUnmount(() => fp.value?.destroy()) onBeforeUnmount(() => fp.value?.destroy())
watch(config, () => { watch(configRef, () => {
if (!fp.value) return if (!fp.value) return
// Workaround: Don't pass hooks to configs again otherwise // Workaround: Don't pass hooks to configs again otherwise
// previously registered hooks will stop working // previously registered hooks will stop working
@ -201,7 +201,7 @@ onBeforeUnmount(() => fpInput.value?.removeEventListener('blur', onBlur))
* Watch for the disabled property and sets the value to the real input. * Watch for the disabled property and sets the value to the real input.
*/ */
watchEffect(() => { watchEffect(() => {
if (disabled.value) { if (disabledRef.value) {
fpInput.value?.setAttribute('disabled', '') fpInput.value?.setAttribute('disabled', '')
} else { } else {
fpInput.value?.removeAttribute('disabled') fpInput.value?.removeAttribute('disabled')
@ -212,7 +212,7 @@ watchEffect(() => {
* Watch for changes from parent component and update DOM * Watch for changes from parent component and update DOM
*/ */
watch( watch(
modelValue, modelValueRef,
newValue => { newValue => {
// Prevent updates if v-model value is same as input's current value // Prevent updates if v-model value is same as input's current value
if (!root.value || newValue === nullify(root.value.value)) return if (!root.value || newValue === nullify(root.value.value)) return

View File

@ -255,7 +255,7 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const {modelValue} = toRefs(props) const {modelValue: modelValueRef} = toRefs(props)
const labelStore = useLabelStore() const labelStore = useLabelStore()
@ -289,7 +289,7 @@ onMounted(() => {
}) })
watch( watch(
modelValue, modelValueRef,
(value) => { (value) => {
// FIXME: filters should only be converted to snake case in // FIXME: filters should only be converted to snake case in
// the last moment // the last moment

View File

@ -78,7 +78,7 @@ const emit = defineEmits<{
(e: 'update:task', task: ITaskPartialWithId): void (e: 'update:task', task: ITaskPartialWithId): void
}>() }>()
const {tasks, filters} = toRefs(props) const {tasks: tasksRef, filters: filtersRef} = toRefs(props)
// setup dayjs for vue-ganttastic // setup dayjs for vue-ganttastic
const dayjsLanguageLoading = ref(false) const dayjsLanguageLoading = ref(false)
@ -87,8 +87,8 @@ extendDayjs()
const router = useRouter() const router = useRouter()
const dateFromDate = computed(() => new Date(new Date(filters.value.dateFrom).setHours(0,0,0,0))) const dateFromDate = computed(() => new Date(new Date(filtersRef.value.dateFrom).setHours(0,0,0,0)))
const dateToDate = computed(() => new Date(new Date(filters.value.dateTo).setHours(23,59,0,0))) const dateToDate = computed(() => new Date(new Date(filtersRef.value.dateTo).setHours(23,59,0,0)))
const DAY_WIDTH_PIXELS = 30 const DAY_WIDTH_PIXELS = 30
const ganttChartWidth = computed(() => { const ganttChartWidth = computed(() => {
@ -103,10 +103,10 @@ const ganttBars = ref<GanttBarObject[][]>([])
* Update ganttBars when tasks change * Update ganttBars when tasks change
*/ */
watch( watch(
tasks, tasksRef,
() => { () => {
ganttBars.value = [] ganttBars.value = []
tasks.value.forEach(t => ganttBars.value.push(transformTaskToGanttBar(t))) tasksRef.value.forEach(t => ganttBars.value.push(transformTaskToGanttBar(t)))
}, },
{deep: true, immediate: true}, {deep: true, immediate: true},
) )

View File

@ -39,12 +39,12 @@ const props = defineProps({
}, },
}) })
const {task} = toRefs(props) const {task: taskRef} = toRefs(props)
const updatedSince = computed(() => formatDateSince(task.value.updated)) const updatedSince = computed(() => formatDateSince(taskRef.value.updated))
const updatedFormatted = computed(() => formatDateLong(task.value.updated)) const updatedFormatted = computed(() => formatDateLong(taskRef.value.updated))
const doneSince = computed(() => formatDateSince(task.value.doneAt)) const doneSince = computed(() => formatDateSince(taskRef.value.doneAt))
const doneFormatted = computed(() => formatDateLong(task.value.doneAt)) const doneFormatted = computed(() => formatDateLong(taskRef.value.doneAt))
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -188,17 +188,17 @@ const taskService = shallowReactive(new TaskService())
const task = ref<ITask>(new TaskModel()) const task = ref<ITask>(new TaskModel())
const showDefer = ref(false) const showDefer = ref(false)
const theTask = toRef(props, 'theTask') const theTaskRef = toRef(props, 'theTask')
watch( watch(
theTask, theTaskRef,
newVal => { newVal => {
task.value = newVal task.value = newVal
}, },
) )
onMounted(() => { onMounted(() => {
task.value = theTask.value task.value = theTaskRef.value
document.addEventListener('click', hideDeferDueDatePopup) document.addEventListener('click', hideDeferDueDatePopup)
}) })

View File

@ -77,7 +77,7 @@ const props = defineProps<{route: RouteLocationNormalized}>()
const baseStore = useBaseStore() const baseStore = useBaseStore()
const canWrite = computed(() => baseStore.currentProject.maxRight > RIGHTS.READ) const canWrite = computed(() => baseStore.currentProject.maxRight > RIGHTS.READ)
const {route} = toRefs(props) const {route: routeRef} = toRefs(props)
const { const {
filters, filters,
hasDefaultFilters, hasDefaultFilters,
@ -86,7 +86,7 @@ const {
isLoading, isLoading,
addTask, addTask,
updateTask, updateTask,
} = useGanttFilters(route) } = useGanttFilters(routeRef)
const DEFAULT_DATE_RANGE_DAYS = 7 const DEFAULT_DATE_RANGE_DAYS = 7

View File

@ -73,6 +73,7 @@ setTimeout(() => showNothingToDo.value = true, 100)
// Linting disabled because we explicitely enabled destructuring in vite's config, this will work. // Linting disabled because we explicitely enabled destructuring in vite's config, this will work.
// eslint-disable-next-line vue/no-setup-props-destructure // eslint-disable-next-line vue/no-setup-props-destructure
// eslint-disable-next-line vue/no-dupe-keys
const { const {
dateFrom, dateFrom,
dateTo, dateTo,

View File

@ -536,7 +536,7 @@ const taskColor = ref<ITask['hexColor']>('')
// Used to avoid flashing of empty elements if the task content is not yet loaded. // Used to avoid flashing of empty elements if the task content is not yet loaded.
const visible = ref(false) const visible = ref(false)
const taskId = toRef(props, 'taskId') const taskIdRef = toRef(props, 'taskId')
const parent = computed(() => { const parent = computed(() => {
if (!task.projectId) { if (!task.projectId) {
@ -584,7 +584,7 @@ const hasAttachments = computed(() => attachmentStore.attachments.length > 0)
const isModal = computed(() => Boolean(props.backdropView)) const isModal = computed(() => Boolean(props.backdropView))
function attachmentUpload(file: File, onSuccess?: (url: string) => void) { function attachmentUpload(file: File, onSuccess?: (url: string) => void) {
return uploadFile(taskId.value, file, onSuccess) return uploadFile(taskIdRef.value, file, onSuccess)
} }
const heading = ref<HTMLElement | null>(null) const heading = ref<HTMLElement | null>(null)
@ -595,7 +595,7 @@ async function scrollToHeading() {
const taskService = shallowReactive(new TaskService()) const taskService = shallowReactive(new TaskService())
// load task // load task
watch(taskId, async (id) => { watch(taskIdRef, async (id) => {
if (id === undefined) { if (id === undefined) {
return return
} }