chore(deps): migrate to eslint 9 (#2443)

This commit is contained in:
Benjamin Canac
2024-10-24 10:30:37 +02:00
committed by GitHub
parent b29fcd2650
commit cae4f0c4a8
177 changed files with 2034 additions and 1289 deletions

View File

@@ -72,7 +72,7 @@ export default defineComponent({
default: () => ({})
}
},
setup (props) {
setup(props) {
const { ui, attrs } = useUI('breadcrumb', toRef(props, 'ui'), config, toRef(props, 'class'))
return {

View File

@@ -72,10 +72,10 @@ import { twJoin } from 'tailwind-merge'
import { defu } from 'defu'
import UIcon from '../elements/Icon.vue'
import UButton from '../elements/Button.vue'
import CommandPaletteGroup from './CommandPaletteGroup.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig } from '../../utils'
import type { Group, Command, Button, Strategy, DeepPartial } from '../../types/index'
import CommandPaletteGroup from './CommandPaletteGroup.vue'
// @ts-expect-error
import appConfig from '#build/app.config'
import { commandPalette } from '#ui/ui.config'
@@ -180,7 +180,7 @@ export default defineComponent({
}
},
emits: ['update:modelValue', 'close'],
setup (props, { emit, expose }) {
setup(props, { emit, expose }) {
const { ui, attrs } = useUI('commandPalette', toRef(props, 'ui'), config, toRef(props, 'class'))
const query = ref('')
@@ -228,7 +228,7 @@ export default defineComponent({
const { results } = useFuse(query, commands, options)
function getGroupWithCommands (group: Group, commands: Command[]) {
function getGroupWithCommands(group: Group, commands: Command[]) {
if (!group) {
return
}
@@ -269,13 +269,13 @@ export default defineComponent({
return getGroupWithCommands(group, commands)
}).filter(Boolean)
const searchGroups = props.groups.filter(group => !!group.search && searchResults.value[group.key]?.length).map(group => {
const searchGroups = props.groups.filter(group => !!group.search && searchResults.value[group.key]?.length).map((group) => {
const commands = (searchResults.value[group.key] || [])
return getGroupWithCommands(group, [...commands])
})
const staticGroups: Group[] = props.groups.filter((group) => group.static && group.commands?.length).map((group) => {
const staticGroups: Group[] = props.groups.filter(group => group.static && group.commands?.length).map((group) => {
return getGroupWithCommands(group, group.commands)
})
@@ -333,21 +333,21 @@ export default defineComponent({
// Methods
function activateFirstOption () {
function activateFirstOption() {
setTimeout(() => {
// https://github.com/tailwindlabs/headlessui/blob/6fa6074cd5d3a96f78a2d965392aa44101f5eede/packages/%40headlessui-vue/src/components/combobox/combobox.ts#L804
comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent('keydown', { key: 'PageUp' }))
}, 0)
}
function activateNextOption () {
function activateNextOption() {
setTimeout(() => {
// https://github.com/tailwindlabs/headlessui/blob/6fa6074cd5d3a96f78a2d965392aa44101f5eede/packages/%40headlessui-vue/src/components/combobox/combobox.ts#L769
comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown' }))
}, 0)
}
function onSelect (option: Command | Command[]) {
function onSelect(option: Command | Command[]) {
emit('update:modelValue', option, { query: query.value })
// Clear input after selection
@@ -358,7 +358,7 @@ export default defineComponent({
}
}
function onClear () {
function onClear() {
if (query.value) {
query.value = ''
} else {

View File

@@ -77,7 +77,7 @@ import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import UKbd from '../elements/Kbd.vue'
import type { Command, Group } from '../../types/index'
import { commandPalette } from '#ui/ui.config'
import type { commandPalette } from '#ui/ui.config'
import { useId } from '#imports'
export default defineComponent({
@@ -113,14 +113,14 @@ export default defineComponent({
required: true
}
},
setup (props) {
setup(props) {
const label = computed(() => {
const label = props.group[props.groupAttribute]
return typeof label === 'function' ? label(props.query) : label
})
function highlight (text: string, { indices, value }: Command['matches'][number]): string {
function highlight(text: string, { indices, value }: Command['matches'][number]): string {
if (text === value) {
return ''
}

View File

@@ -90,7 +90,7 @@ export default defineComponent({
default: () => ({})
}
},
setup (props) {
setup(props) {
const { ui, attrs } = useUI('horizontalNavigation', toRef(props, 'ui'), config, toRef(props, 'class'))
const sections = computed(() => (Array.isArray(props.links[0]) ? props.links : [props.links]) as HorizontalNavigationLink[][])

View File

@@ -74,11 +74,11 @@
<script lang="ts">
import { computed, toRef, defineComponent } from 'vue'
import type { PropType } from 'vue'
import type { RouteLocationRaw } from '#vue-router'
import UButton from '../elements/Button.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig } from '../../utils'
import type { Button, ButtonSize, DeepPartial, Strategy } from '../../types/index'
import type { RouteLocationRaw } from '#vue-router'
// @ts-expect-error
import appConfig from '#build/app.config'
import { pagination, button } from '#ui/ui.config'
@@ -108,7 +108,7 @@ export default defineComponent({
max: {
type: Number,
default: 7,
validate (value) {
validate(value) {
return value >= 5 && value < Number.MAX_VALUE
}
},
@@ -119,7 +119,7 @@ export default defineComponent({
size: {
type: String as PropType<ButtonSize>,
default: () => config.default.size,
validator (value: string) {
validator(value: string) {
return Object.keys(buttonConfig.size).includes(value)
}
},
@@ -173,14 +173,14 @@ export default defineComponent({
}
},
emits: ['update:modelValue'],
setup (props, { emit }) {
setup(props, { emit }) {
const { ui, attrs } = useUI('pagination', toRef(props, 'ui'), config, toRef(props, 'class'))
const currentPage = computed({
get () {
get() {
return props.modelValue
},
set (value) {
set(value) {
emit('update:modelValue', value)
}
})
@@ -252,7 +252,7 @@ export default defineComponent({
const canGoFirstOrPrev = computed(() => currentPage.value > 1)
const canGoLastOrNext = computed(() => currentPage.value < pages.value.length)
function onClickFirst () {
function onClickFirst() {
if (!canGoFirstOrPrev.value) {
return
}
@@ -260,7 +260,7 @@ export default defineComponent({
currentPage.value = 1
}
function onClickLast () {
function onClickLast() {
if (!canGoLastOrNext.value) {
return
}
@@ -268,7 +268,7 @@ export default defineComponent({
currentPage.value = pages.value.length
}
function onClickPage (page: number | string) {
function onClickPage(page: number | string) {
if (typeof page === 'string') {
return
}
@@ -276,7 +276,7 @@ export default defineComponent({
currentPage.value = page
}
function onClickPrev () {
function onClickPrev() {
if (!canGoFirstOrPrev.value) {
return
}
@@ -284,7 +284,7 @@ export default defineComponent({
currentPage.value--
}
function onClickNext () {
function onClickNext() {
if (!canGoLastOrNext.value) {
return
}

View File

@@ -114,7 +114,7 @@ export default defineComponent({
}
},
emits: ['update:modelValue', 'change'],
setup (props, { emit }) {
setup(props, { emit }) {
const { ui, attrs } = useUI('tabs', toRef(props, 'ui'), config, toRef(props, 'class'))
const listRef = ref<HTMLElement>()
@@ -125,7 +125,7 @@ export default defineComponent({
// Methods
function calcMarkerSize (index: number | undefined) {
function calcMarkerSize(index: number | undefined) {
// @ts-ignore
const tab = itemRefs.value[index]?.$el
if (!tab) {
@@ -142,7 +142,7 @@ export default defineComponent({
markerRef.value.style.height = `${tab.offsetHeight}px`
}
function onChange (index: number) {
function onChange(index: number) {
selectedIndex.value = index
emit('change', index)

View File

@@ -93,7 +93,7 @@ export default defineComponent({
default: () => ({})
}
},
setup (props) {
setup(props) {
const { ui, attrs } = useUI('verticalNavigation', toRef(props, 'ui'), config, toRef(props, 'class'))
const sections = computed(() => (Array.isArray(props.links[0]) ? props.links : [props.links]) as VerticalNavigationLink[][])