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

@@ -4,10 +4,11 @@ import { join } from 'pathe'
import { loadNuxt } from '@nuxt/kit'
import type { NuxtConfig } from '@nuxt/schema'
import type * as tailwindcss from 'tailwindcss'
type TWConfig = tailwindcss.Config;
import type resolveConfig from 'tailwindcss/resolveConfig'
async function getTailwindCSSConfig (overrides: Partial<NuxtConfig> = {}) {
type TWConfig = tailwindcss.Config
async function getTailwindCSSConfig(overrides: Partial<NuxtConfig> = {}) {
let tailwindConfig: ReturnType<typeof resolveConfig<TWConfig>>
const nuxt = await loadNuxt({
ready: true,
@@ -17,7 +18,7 @@ async function getTailwindCSSConfig (overrides: Partial<NuxtConfig> = {}) {
ssr: false,
modules: ['../../src/module'],
hooks: {
'tailwindcss:resolvedConfig' (config) {
'tailwindcss:resolvedConfig'(config) {
tailwindConfig = config
}
}

View File

@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { excludeColors, generateSafelist, setGlobalColors } from '../src/runtime/utils/colors'
import defaultColors from 'tailwindcss/colors'
import type { Config as TWConfig } from 'tailwindcss'
import { excludeColors, generateSafelist, setGlobalColors } from '../src/runtime/utils/colors'
describe('excludeColors', () => {
it('should exclude colors from the list', () => {
@@ -40,8 +40,8 @@ describe('generateSafelist', () => {
safelistColors.push('primary')
tailwindConfig.theme = tailwindConfig.theme || {}
tailwindConfig.theme.extend = tailwindConfig.theme.extend || {}
tailwindConfig.theme.extend.colors =
tailwindConfig.theme.extend.colors || {}
tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {}
const safelistConfig = generateSafelist(safelistColors, setGlobalColors(tailwindConfig.theme))
expect.extend({
@@ -64,7 +64,7 @@ describe('generateSafelist', () => {
}
})
safelistPatterns = safelistPatterns instanceof Array ? safelistPatterns : [safelistPatterns]
safelistPatterns = Array.isArray(safelistPatterns) ? safelistPatterns : [safelistPatterns]
let negate = false
for (const safelistPattern of safelistPatterns) {

View File

@@ -1,5 +1,5 @@
import path from 'node:path'
import { mountSuspended } from '@nuxt/test-utils/runtime'
import path from 'path'
export default async function (nameOrHtml: string, options: any, component: any) {
let html: string

View File

@@ -1,17 +1,17 @@
import { describe, it, expect } from 'vitest'
import { UButton } from '#components'
import type { TypeOf } from 'zod'
import ComponentRender from '../component-render'
import { UButton } from '#components'
describe('Button', () => {
it.each([
[ 'basic case', { } ],
[ 'leading icon', { props: { leading: true, icon: 'heroicons-check' } } ],
[ 'black solid', { props: { color: 'black', variant: 'solid' } } ],
[ 'rounded full', { props: { ui: { rounded: 'rounded-full' } } } ],
[ '<UButton icon="i-heroicons-pencil-square" size="sm" color="primary" square variant="solid" />' ]
['basic case', { }],
['leading icon', { props: { leading: true, icon: 'heroicons-check' } }],
['black solid', { props: { color: 'black', variant: 'solid' } }],
['rounded full', { props: { ui: { rounded: 'rounded-full' } } }],
['<UButton icon="i-heroicons-pencil-square" size="sm" color="primary" square variant="solid" />']
// @ts-ignore
])('renders %s correctly', async (nameOrHtml: string, options: TypeOf<typeof Button.props>) => {
])('renders %s correctly', async (nameOrHtml: string, options: TypeOf<typeof UButton.props>) => {
if (options !== undefined) {
options.slots = options.slots || { default: () => 'label' }
options.slots.default = options.slots.default || (() => 'label')

View File

@@ -1,13 +1,13 @@
import { describe, it, expect } from 'vitest'
import { USkeleton } from '#components'
import type { TypeOf } from 'zod'
import ComponentRender from '../component-render'
import { USkeleton } from '#components'
describe('Skeleton', () => {
it.each([
[ 'basic case', { } ],
[ '<USkeleton class="h-12 w-12" :ui="{ rounded: \'rounded-full\' }" />' ],
[ '<USkeleton as="span" />' ]
['basic case', { }],
['<USkeleton class="h-12 w-12" :ui="{ rounded: \'rounded-full\' }" />'],
['<USkeleton as="span" />']
])('renders %s correctly', async (nameOrHtml: string, options?: TypeOf<typeof USkeleton.props>) => {
const html = await ComponentRender(nameOrHtml, options, USkeleton)
expect(html).toMatchSnapshot()