Skip to content

Commit 505078e

Browse files
fix: eslint
1 parent d008106 commit 505078e

File tree

19 files changed

+92
-44
lines changed

19 files changed

+92
-44
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 120
10+
tab_width = 2
11+
trim_trailing_whitespace = true
12+
13+
[Makefile]
14+
indent_style = tab
15+
tab_width = 4
16+
17+
[{*.md,*.mdx}]
18+
trim_trailing_whitespace = false

packages/vue-primitives/src/accordion/Accordion.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const TYPE_SINGLE = 'single' as const satisfies AccordionType
3535
const collectionContext = Collection.provideCollectionContext($el)
3636
const getItems = useCollection(collectionContext)
3737
const handleKeydown = composeEventHandlers<KeyboardEvent>((event) => {
38-
isFunction(attrs.onKeydown) && attrs.onKeydown(event)
38+
if (isFunction(attrs.onKeydown))
39+
attrs.onKeydown(event)
3940
}, (event) => {
4041
if (!ACCORDION_KEYS.includes(event.key))
4142
return

packages/vue-primitives/src/checkbox/Checkbox.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ watchEffect((onCleanup) => {
4444
})
4545
4646
const onKeydown = composeEventHandlers<KeyboardEvent>((event) => {
47-
isFunction(attrs.onKeydown) && attrs.onKeydown(event)
47+
if (isFunction(attrs.onKeydown))
48+
attrs.onKeydown(event)
4849
}, (event) => {
4950
// According to WAI ARIA, Checkboxes don't activate on enter keypress
5051
if (event.key === 'Enter')
@@ -63,7 +64,8 @@ const onClick = composeEventHandlers<CliclEvent>((event) => {
6364
return this._isPropagationStopped
6465
}
6566
66-
isFunction(attrs.onClick) && attrs.onClick(event)
67+
if (isFunction(attrs.onClick))
68+
attrs.onClick(event)
6769
}, (event) => {
6870
checked.value = isIndeterminate(checked.value) ? true : !checked.value
6971
if (isFormControl.value) {

packages/vue-primitives/src/collapsible/CollapsibleTrigger.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const attrs = useAttrs()
2020
const context = useCollapsibleContext()
2121
2222
const onClick = composeEventHandlers((event) => {
23-
isFunction(attrs.onClick) && attrs.onClick(event)
23+
if (isFunction(attrs.onClick))
24+
attrs.onClick(event)
2425
}, context.onOpenToggle)
2526
</script>
2627

packages/vue-primitives/src/radio-group/Radio.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ const onClick = composeEventHandlers<CliclEvent>((event) => {
3737
return this._isPropagationStopped
3838
}
3939
40-
isFunction(attrs.onClick) && attrs.onClick(event)
40+
if (isFunction(attrs.onClick))
41+
attrs.onClick(event)
4142
}, (event) => {
4243
// radios cannot be unchecked so we only communicate a checked state
4344
if (!props.checked)

packages/vue-primitives/src/radio-group/RadioGroupItem.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ function onKeyDown(event: KeyboardEvent) {
5555
}
5656
5757
const onFocus = composeEventHandlers<FocusEvent>((event) => {
58-
isFunction(attrs.onFocus) && attrs.onFocus(event)
58+
if (isFunction(attrs.onFocus))
59+
attrs.onFocus(event)
5960
}, () => {
6061
/**
6162
* Our `RovingFocusGroup` will focus the radio when navigating with arrow keys

packages/vue-primitives/src/roving-focus/RovingFocusGroup.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ let isClickFocus = false
3131
const focusableItemsCount = shallowRef(0)
3232
3333
const onMousedown = composeEventHandlers((event) => {
34-
isFunction(attrs.onMousedown) && attrs.onMousedown(event)
34+
if (isFunction(attrs.onMousedown))
35+
attrs.onMousedown(event)
3536
}, () => {
3637
isClickFocus = true
3738
})
3839
3940
const onFocus = composeEventHandlers((event) => {
40-
isFunction(attrs.onFocus) && attrs.onFocus(event)
41+
if (isFunction(attrs.onFocus))
42+
attrs.onFocus(event)
4143
}, (event) => {
4244
// We normally wouldn't need this check, because we already check
4345
// that the focus is on the current target and not bubbling to it.
@@ -65,7 +67,8 @@ const onFocus = composeEventHandlers((event) => {
6567
})
6668
6769
const onFocusout = composeEventHandlers((event) => {
68-
isFunction(attrs.onFocusout) && attrs.onFocusout(event)
70+
if (isFunction(attrs.onFocusout))
71+
attrs.onFocusout(event)
6972
}, () => {
7073
isTabbingBackOut.value = false
7174
})

packages/vue-primitives/src/roving-focus/RovingFocusGroupItem.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ watchEffect(() => {
4747
Collection.useCollectionItem($el, itemData)
4848
4949
const onMousedown = composeEventHandlers((event) => {
50-
isFunction(attrs.onMousedown) && attrs.onMousedown(event)
50+
if (isFunction(attrs.onMousedown))
51+
attrs.onMousedown(event)
5152
}, (event) => {
5253
// We prevent focusing non-focusable items on `mousedown`.
5354
// Even though the item has tabIndex={-1}, that only means take it out of the tab order.
@@ -58,11 +59,13 @@ const onMousedown = composeEventHandlers((event) => {
5859
})
5960
6061
const onFocus = composeEventHandlers((event) => {
61-
isFunction(attrs.onFocus) && attrs.onFocus(event)
62+
if (isFunction(attrs.onFocus))
63+
attrs.onFocus(event)
6264
}, () => context.onItemFocus(id.value))
6365
6466
const onKeydown = composeEventHandlers<KeyboardEvent>((event) => {
65-
isFunction(attrs.onKeydown) && attrs.onKeydown(event)
67+
if (isFunction(attrs.onKeydown))
68+
attrs.onKeydown(event)
6669
}, (event) => {
6770
if (event.key === 'Tab' && event.shiftKey) {
6871
context.onItemShiftTab()

packages/vue-primitives/src/roving-focus/stories/Button.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const isSelected = computed(() => context.value.value !== undefined
2020
&& context.value.value === props.value)
2121
2222
const onFocus = composeEventHandlers((event) => {
23-
isFunction(attrs.onFocus) && attrs.onFocus(event)
23+
if (isFunction(attrs.onFocus))
24+
attrs.onFocus(event)
2425
}, (event) => {
2526
if (context.value.value !== undefined) {
2627
(event.target as HTMLElement).click()

packages/vue-primitives/src/scroll-area/ScrollAreaScrollbarScroll.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,15 @@ watchEffect((onCleanup) => {
8888
const isPresent = usePresence($el, () => props.forceMount || state.value !== 'hidden')
8989
9090
const onPointerenter = composeEventHandlers<PointerEvent>((event) => {
91-
isFunction(attrs.onPointerenter) && attrs.onPointerenter(event)
91+
if (isFunction(attrs.onPointerenter))
92+
attrs.onPointerenter(event)
9293
}, () => {
9394
send('POINTER_ENTER')
9495
})
9596
9697
const onPointerleave = composeEventHandlers<PointerEvent>((event) => {
97-
isFunction(attrs.onPointerleave) && attrs.onPointerleave(event)
98+
if (isFunction(attrs.onPointerleave))
99+
attrs.onPointerleave(event)
98100
}, () => {
99101
send('POINTER_LEAVE')
100102
})

0 commit comments

Comments
 (0)