Skip to content

Commit b34418b

Browse files
cab-mikeechrisbbreuer
authored andcommitted
chore: lint
chore: fix lint issues
1 parent 0267bfa commit b34418b

32 files changed

+864
-749
lines changed

docs/.vitepress/sw.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// <reference types="vite/client" />
2-
32
/// <reference lib="webworker" />
43

54
import { CacheableResponsePlugin } from 'workbox-cacheable-response'
@@ -27,7 +26,7 @@ if (import.meta.env.PROD) {
2726
const base = swPath === 0 ? '/' : self.location.pathname.slice(0, swPath + 1)
2827
function escapeStringRegexp(value: string) {
2928
// Escape characters with special meaning either inside or outside character sets.
30-
// Use a simple backslash escape when its always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns stricter grammar.
29+
// Use a simple backslash escape when it's always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns' stricter grammar.
3130
return value
3231
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
3332
.replace(/-/g, '\\x2d')

docs/.vitepress/theme/components/vue-demo/CreditCardDemo.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const cardType = ref<CreditCardType | null>(null)
99
1010
function handleCardTypeChange(type: CreditCardType) {
1111
cardType.value = type
12-
console.log('Card type:', type)
1312
}
1413
1514
const cardIcon = computed(() => {

packages/ts-inputs/src/phone.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const COUNTRY_CODES: Record<string, string> = {
2929
CA: '+1',
3030
}
3131

32-
function format({
32+
function handleFormat({
3333
value,
3434
delimiter,
3535
pattern,
@@ -84,7 +84,7 @@ export function formatPhone(value: string, options?: FormatPhoneOptions): string
8484
// Use region pattern if no custom pattern provided
8585
const selectedPattern = pattern ?? PHONE_PATTERNS[region] ?? DefaultPhonePattern
8686

87-
return format({
87+
return handleFormat({
8888
value,
8989
delimiter,
9090
pattern: selectedPattern,

packages/ts-inputs/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
// return 'test-eslint'
1010
// }
1111

12-
export function isString(value: any): value is string {
12+
export function isString(value: unknown): value is string {
1313
return typeof value === 'string'
1414
}
1515

packages/vue/src/components/datetime-picker/DateTimePicker.vue

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,29 @@ const props = defineProps({
5353
const emit = defineEmits([
5454
'update:model-value',
5555
'update:model-timezone-value',
56-
'text-submit',
56+
'textSubmit',
5757
'closed',
5858
'cleared',
5959
'open',
6060
'focus',
6161
'blur',
62-
'internal-model-change',
63-
'recalculate-position',
64-
'flow-step',
65-
'update-month-year',
66-
'invalid-select',
67-
'invalid-fixed-range',
68-
'tooltip-open',
69-
'tooltip-close',
70-
'time-picker-open',
71-
'time-picker-close',
72-
'am-pm-change',
73-
'range-start',
74-
'range-end',
75-
'date-update',
76-
'invalid-date',
77-
'overlay-toggle',
78-
'text-input',
62+
'internalModelChange',
63+
'recalculatePosition',
64+
'flowStep',
65+
'updateMonthYear',
66+
'invalidSelect',
67+
'invalidFixedRange',
68+
'tooltipOpen',
69+
'tooltipClose',
70+
'timePickerOpen',
71+
'timePickerClose',
72+
'amPmChange',
73+
'rangeStart',
74+
'rangeEnd',
75+
'dateUpdate',
76+
'invalidDate',
77+
'overlayToggle',
78+
'textInput',
7979
])
8080
8181
const slots = useSlots()
@@ -108,46 +108,6 @@ const { isMobile } = useResponsive(defaultedConfig)
108108
109109
const currentInstance = getCurrentInstance()
110110
111-
onMounted(() => {
112-
parseExternalModelValue(props.modelValue)
113-
nextTick().then(() => {
114-
if (!defaultedInline.value.enabled) {
115-
const el = getScrollableParent(pickerWrapperRef.value)
116-
el?.addEventListener('scroll', onScroll)
117-
118-
window?.addEventListener('resize', onResize)
119-
}
120-
})
121-
122-
if (defaultedInline.value.enabled) {
123-
isOpen.value = true
124-
}
125-
126-
window?.addEventListener('keyup', onKeyUp)
127-
window?.addEventListener('keydown', onKeyDown)
128-
})
129-
130-
onUnmounted(() => {
131-
if (!defaultedInline.value.enabled) {
132-
const el = getScrollableParent(pickerWrapperRef.value)
133-
el?.removeEventListener('scroll', onScroll)
134-
window?.removeEventListener('resize', onResize)
135-
}
136-
window?.removeEventListener('keyup', onKeyUp)
137-
window?.removeEventListener('keydown', onKeyDown)
138-
})
139-
140-
const slotList = mapSlots(slots, 'all', props.presetDates)
141-
const inputSlots = mapSlots(slots, 'input')
142-
143-
watch(
144-
[modelValueRef, timezoneRef],
145-
() => {
146-
parseExternalModelValue(modelValueRef.value)
147-
},
148-
{ deep: true },
149-
)
150-
151111
const { openOnTop, menuStyle, xCorrect, setMenuPosition, getScrollableParent, shadowRender } = usePosition({
152112
menuRef: dpWrapMenuRef,
153113
menuRefInner: dpMenuRef,
@@ -249,7 +209,7 @@ function onKeyDown(event: KeyboardEvent) {
249209
shiftKeyActive.value = event.shiftKey
250210
}
251211
252-
function openMenu() {
212+
function openMenu(): void {
253213
if (!props.disabled && !props.readonly) {
254214
shadowRender(currentInstance, DatepickerMenu, props)
255215
setMenuPosition(false)
@@ -313,7 +273,7 @@ function selectDate(): void {
313273
closeMenu()
314274
}
315275
else {
316-
emit('invalid-select', internalModelValue.value)
276+
emit('invalidSelect', internalModelValue.value)
317277
}
318278
}
319279
@@ -401,7 +361,7 @@ function setInputDate(date: Date | Date[] | null, submit?: boolean, tabbed = fal
401361
if (submit) {
402362
shouldFocusNext.value = tabbed
403363
selectDate()
404-
emit('text-submit')
364+
emit('textSubmit')
405365
}
406366
else if (props.autoApply) {
407367
autoApplyValue()
@@ -411,7 +371,7 @@ function setInputDate(date: Date | Date[] | null, submit?: boolean, tabbed = fal
411371
})
412372
}
413373
else {
414-
emit('invalid-date', date)
374+
emit('invalidDate', date)
415375
}
416376
}
417377
@@ -476,15 +436,55 @@ function clickOutside(validateBeforeEmit: () => boolean, evt: PointerEvent) {
476436
return closeMenu(true)
477437
}
478438
479-
function handleFlow(skipStep = 0) {
439+
function handleFlow(skipStep = 0): void {
480440
dpMenuRef.value?.handleFlow(skipStep)
481441
}
482442
483-
const getDpWrapMenuRef = () => dpWrapMenuRef
443+
const getDpWrapMenuRef = (): Ref<HTMLElement | null> => dpWrapMenuRef
484444
485445
onClickOutside(dpWrapMenuRef, inputRef as unknown as MaybeElementRef, (evt: PointerEvent) =>
486446
clickOutside(validateBeforeEmit, evt))
487447
448+
onMounted(() => {
449+
parseExternalModelValue(props.modelValue)
450+
nextTick().then(() => {
451+
if (!defaultedInline.value.enabled) {
452+
const el = getScrollableParent(pickerWrapperRef.value)
453+
el?.addEventListener('scroll', onScroll)
454+
455+
window?.addEventListener('resize', onResize)
456+
}
457+
})
458+
459+
if (defaultedInline.value.enabled) {
460+
isOpen.value = true
461+
}
462+
463+
window?.addEventListener('keyup', onKeyUp)
464+
window?.addEventListener('keydown', onKeyDown)
465+
})
466+
467+
onUnmounted(() => {
468+
if (!defaultedInline.value.enabled) {
469+
const el = getScrollableParent(pickerWrapperRef.value)
470+
el?.removeEventListener('scroll', onScroll)
471+
window?.removeEventListener('resize', onResize)
472+
}
473+
window?.removeEventListener('keyup', onKeyUp)
474+
window?.removeEventListener('keydown', onKeyDown)
475+
})
476+
477+
const slotList = mapSlots(slots, 'all', props.presetDates)
478+
const inputSlots = mapSlots(slots, 'input')
479+
480+
watch(
481+
[modelValueRef, timezoneRef],
482+
() => {
483+
parseExternalModelValue(modelValueRef.value)
484+
},
485+
{ deep: true },
486+
)
487+
488488
defineExpose({
489489
closeMenu,
490490
selectDate,
@@ -519,7 +519,7 @@ defineExpose({
519519
@focus="handleInputFocus"
520520
@blur="handleBlur"
521521
@real-blur="isInputFocused = false"
522-
@text-input="$emit('text-input', $event)"
522+
@text-input="$emit('textInput', $event)"
523523
>
524524
<template v-for="(slot, i) in inputSlots" #[slot]="args" :key="i">
525525
<slot :name="slot" v-bind="args" />
@@ -548,22 +548,22 @@ defineExpose({
548548
@select-date="selectDate"
549549
@auto-apply="autoApplyValue"
550550
@time-update="timeUpdate"
551-
@flow-step="$emit('flow-step', $event)"
552-
@update-month-year="$emit('update-month-year', $event)"
553-
@invalid-select="$emit('invalid-select', internalModelValue)"
554-
@auto-apply-invalid="$emit('invalid-select', $event)"
555-
@invalid-fixed-range="$emit('invalid-fixed-range', $event)"
551+
@flow-step="$emit('flowStep', $event)"
552+
@update-month-year="$emit('updateMonthYear', $event)"
553+
@invalid-select="$emit('invalidSelect', internalModelValue)"
554+
@auto-apply-invalid="$emit('invalidSelect', $event)"
555+
@invalid-fixed-range="$emit('invalidFixedRange', $event)"
556556
@recalculate-position="setMenuPosition"
557-
@tooltip-open="$emit('tooltip-open', $event)"
558-
@tooltip-close="$emit('tooltip-close', $event)"
559-
@time-picker-open="$emit('time-picker-open', $event)"
560-
@time-picker-close="$emit('time-picker-close', $event)"
561-
@am-pm-change="$emit('am-pm-change', $event)"
562-
@range-start="$emit('range-start', $event)"
563-
@range-end="$emit('range-end', $event)"
564-
@date-update="$emit('date-update', $event)"
565-
@invalid-date="$emit('invalid-date', $event)"
566-
@overlay-toggle="$emit('overlay-toggle', $event)"
557+
@tooltip-open="$emit('tooltipOpen', $event)"
558+
@tooltip-close="$emit('tooltipClose', $event)"
559+
@time-picker-open="$emit('timePickerOpen', $event)"
560+
@time-picker-close="$emit('timePickerClose', $event)"
561+
@am-pm-change="$emit('amPmChange', $event)"
562+
@range-start="$emit('rangeStart', $event)"
563+
@range-end="$emit('rangeEnd', $event)"
564+
@date-update="$emit('dateUpdate', $event)"
565+
@invalid-date="$emit('invalidDate', $event)"
566+
@overlay-toggle="$emit('overlayToggle', $event)"
567567
@menu-blur="$emit('blur')"
568568
>
569569
<template v-for="(slot, i) in slotList" #[slot]="args" :key="i">

packages/vue/src/components/datetime-picker/components/ActionRow.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const props = defineProps({
2020
...PickerBaseProps,
2121
})
2222
23-
const emit = defineEmits(['close-picker', 'select-date', 'select-now', 'invalid-select'])
23+
const emit = defineEmits(['closePicker', 'selectDate', 'selectNow', 'invalidSelect'])
2424
2525
const {
2626
defaultedActionRow,
@@ -142,10 +142,10 @@ function selectDate(): void {
142142
&& isMonthValid.value(props.internalModelValue)
143143
&& validDateRange.value
144144
) {
145-
emit('select-date')
145+
emit('selectDate')
146146
}
147147
else {
148-
emit('invalid-select')
148+
emit('invalidSelect')
149149
}
150150
}
151151
</script>
@@ -158,8 +158,8 @@ function selectDate(): void {
158158
v-bind="{
159159
internalModelValue,
160160
disabled,
161-
selectDate: () => $emit('select-date'),
162-
closePicker: () => $emit('close-picker'),
161+
selectDate: (): void => $emit('selectDate'),
162+
closePicker: (): void => $emit('closePicker'),
163163
}"
164164
/>
165165
</template>
@@ -187,17 +187,17 @@ function selectDate(): void {
187187
ref="cancelButtonRef"
188188
type="button"
189189
class="dp__action_button dp__action_cancel"
190-
@click="$emit('close-picker')"
191-
@keydown="checkKeyDown($event, () => $emit('close-picker'))"
190+
@click="$emit('closePicker')"
191+
@keydown="(e: KeyboardEvent): void => checkKeyDown(e, () => $emit('closePicker'))"
192192
>
193193
{{ cancelText }}
194194
</button>
195195
<button
196196
v-if="defaultedActionRow.showNow"
197197
type="button"
198198
class="dp__action_button dp__action_cancel"
199-
@click="$emit('select-now')"
200-
@keydown="checkKeyDown($event, () => $emit('select-now'))"
199+
@click="$emit('selectNow')"
200+
@keydown="(e: KeyboardEvent): void => checkKeyDown(e, () => $emit('selectNow'))"
201201
>
202202
{{ nowButtonLabel }}
203203
</button>

packages/vue/src/components/datetime-picker/components/Common/ArrowBtn.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ defineProps<{
1616
}>()
1717
1818
const emit = defineEmits<{
19-
'activate': []
20-
'set-ref': [i: Ref<HTMLElement | null>]
19+
activate: []
20+
setRef: [i: Ref<HTMLElement | null>]
2121
}>()
2222
2323
const elRef = ref<HTMLElement | null>(null)
2424
25-
onMounted(() => emit('set-ref', elRef)) // eslint-disable-line vue/no-ref-as-operand
25+
onMounted(() => emit('setRef', elRef)) // eslint-disable-line vue/no-ref-as-operand
2626
</script>
2727

2828
<template>

packages/vue/src/components/datetime-picker/components/Common/InstanceWrap.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { computed } from 'vue'
44
const props = defineProps<{ multiCalendars: number, stretch?: boolean, collapse?: boolean, isMobile?: boolean }>()
55
66
const instances = computed((): number[] =>
7-
props.multiCalendars > 0 ? [...new Array(props.multiCalendars).keys()] : [0],
7+
props.multiCalendars > 0 ? Array.from({ length: props.multiCalendars }, (_, i) => i) : [0],
88
)
99
1010
const calendarInstanceClassWrapper = computed(() => ({

0 commit comments

Comments
 (0)