diff --git a/.eslintrc.js b/.eslintrc.js index 81b2f5903d..2f27e31faf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -82,10 +82,24 @@ module.exports = { '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/explicit-function-return-type' : 'off', '@typescript-eslint/strict-boolean-expressions' : 'off', - 'align-assignments/align-assignments' : [2, { requiresOnly: false }], - 'vue/multi-word-component-names' : 'off', - 'vue/no-reserved-component-names' : 'off', - 'vue/html-closing-bracket-newline' : [ + '@typescript-eslint/member-delimiter-style' : [ + 'error', + { + multiline: { + delimiter : 'comma', + requireLast: true, + }, + singleline: { + delimiter : 'comma', + requireLast: false, + }, + multilineDetection: 'brackets', + }, + ], + 'align-assignments/align-assignments': [2, { requiresOnly: false }], + 'vue/multi-word-component-names' : 'off', + 'vue/no-reserved-component-names' : 'off', + 'vue/html-closing-bracket-newline' : [ 'error', { singleline: 'never', diff --git a/.vscode/settings.json b/.vscode/settings.json index acbbb4e6a0..77bcce0a73 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,7 @@ "eslint.packageManager": "yarn", "eslint.run": "onSave", "eslint.lintTask.options": "--cache .", - "eslint.lintTask.enable": true + "eslint.lintTask.enable": true, + "volar.autoCompleteRefs": false, + "volar.vueserver.useSecondServer": true, } diff --git a/components/.vitepress/config.ts b/components/.vitepress/config.ts index 4f251e5eac..810a4bc3fa 100644 --- a/components/.vitepress/config.ts +++ b/components/.vitepress/config.ts @@ -1,5 +1,4 @@ import { defineConfig } from 'vitepress' -import fonts from 'vite-plugin-fonts' export default defineConfig({ base : process.env.BASE_URL ?? '/design-system/', @@ -14,7 +13,6 @@ export default defineConfig({ nextLinks : false, prevLinks : false, lastUpdated : 'Last Updated', - smoothScroll: true, nav : [], sidebar : [ { diff --git a/components/avatar/Avatar.spec.ts b/components/avatar/Avatar.spec.ts index 1a51a0d36c..a46db396f8 100644 --- a/components/avatar/Avatar.spec.ts +++ b/components/avatar/Avatar.spec.ts @@ -3,12 +3,10 @@ import Avatar from './Avatar.vue' import IconUser from '@carbon/icons-vue/lib/events/20' import MockImage from './__mocks__/image' import { vi } from 'vitest' +import { delay } from 'nanodelay' vi.stubGlobal('Image', MockImage) -// eslint-disable-next-line @typescript-eslint/promise-function-async -const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)) - it('should render properly', () => { const screen = render({ components: { Avatar }, diff --git a/components/calendar/Calendar.vue b/components/calendar/Calendar.vue index bb5f859f45..7c3ab781d4 100644 --- a/components/calendar/Calendar.vue +++ b/components/calendar/Calendar.vue @@ -69,10 +69,18 @@ import Button from '../button/Button.vue' import IconNext from '@carbon/icons-vue/lib/chevron--right/20' import IconBack from '@carbon/icons-vue/lib/chevron--left/20' import { - defineComponent, ref, computed, watch, toRef, PropType, + defineComponent, + ref, + computed, + watch, + toRef, + PropType, } from 'vue-demi' import { - CalendarAdapter, CalendarFormat, CalendarItem, CalendarMode, + CalendarAdapter, + CalendarFormat, + CalendarItem, + CalendarMode, } from './adapter/adapter' import DateAdapter from './adapter/date' import MonthAdapter from './adapter/month' diff --git a/components/calendar/adapter/adapter.ts b/components/calendar/adapter/adapter.ts index 42da690720..bcd98bdcc9 100644 --- a/components/calendar/adapter/adapter.ts +++ b/components/calendar/adapter/adapter.ts @@ -1,28 +1,28 @@ import { Ref } from 'vue-demi' export interface CalendarItem { - value: Date - text: string - disabled: boolean - readonly: boolean - active: boolean + value: Date, + text: string, + disabled: boolean, + readonly: boolean, + active: boolean, } export interface CalendarContext { - cursor: Ref - model: Ref - max: Ref - min: Ref + cursor: Ref, + model: Ref, + max: Ref, + min: Ref, } export interface CalendarAdapter { - getItems: (this: this, context: CalendarContext) => CalendarItem[] - getTitle: (this: this, context: CalendarContext) => string - getNextCursor: (this: this, context: CalendarContext) => Date - getPrevCursor: (this: this, context: CalendarContext) => Date + getItems: (this: this, context: CalendarContext) => CalendarItem[], + getTitle: (this: this, context: CalendarContext) => string, + getNextCursor: (this: this, context: CalendarContext) => Date, + getPrevCursor: (this: this, context: CalendarContext) => Date, - canNext: (this: this, context: CalendarContext) => boolean - canPrev: (this: this, context: CalendarContext) => boolean + canNext: (this: this, context: CalendarContext) => boolean, + canPrev: (this: this, context: CalendarContext) => boolean, } export const CalendarFormat = [ diff --git a/components/checkbox/use-checkbox.ts b/components/checkbox/use-checkbox.ts index 47f5daabd9..491a1e1086 100644 --- a/components/checkbox/use-checkbox.ts +++ b/components/checkbox/use-checkbox.ts @@ -1,6 +1,8 @@ import { syncRef } from '@vueuse/shared' import { - computed, getCurrentInstance, ref, + computed, + getCurrentInstance, + ref, } from 'vue-demi' import { InputProps } from '../input/use-input' import { valueIn, isEqual } from '../utils/value' @@ -12,9 +14,9 @@ function isChecked (modelValue: unknown, checked: unknown): boolean { } export interface CheckboxProps extends InputProps { - checked: boolean - value: unknown - uncheckedValue: unknown + checked: boolean, + value: unknown, + uncheckedValue: unknown, } export function useVModel (props: CheckboxProps) { @@ -32,14 +34,12 @@ export function useVModel (props: CheckboxProps) { if (Array.isArray(props.modelValue)) { if (value) { - if (!valueIn(props.modelValue, newValue)) emit('update:modelValue', [...props.modelValue, newValue]) - } else { - emit( - 'update:modelValue', - props.modelValue.filter((old) => !isEqual(old, checked)), - ) - } - } else emit('update:modelValue', newValue) + if (!valueIn(props.modelValue, newValue)) + emit('update:modelValue', [...props.modelValue, newValue]) + } else + emit('update:modelValue', props.modelValue.filter((old) => !isEqual(old, checked))) + } else + emit('update:modelValue', newValue) emit('change', value) }, diff --git a/components/dropdown/DropdownGroup.vue b/components/dropdown/DropdownGroup.vue index 3b4384abb1..32553f4735 100644 --- a/components/dropdown/DropdownGroup.vue +++ b/components/dropdown/DropdownGroup.vue @@ -90,7 +90,7 @@ export default defineComponent({ }, }, setup (props, { slots }) { - const context = inject(DROPDOWN_TREE) + const context = inject(DROPDOWN_TREE, undefined, true) const transition = ref<'slide-left' | 'slide-right' | 'none'>('slide-left') const isRoot = computed(() => { diff --git a/components/input/use-input.ts b/components/input/use-input.ts index 7c3c8a98d5..4d84f2c887 100644 --- a/components/input/use-input.ts +++ b/components/input/use-input.ts @@ -4,7 +4,7 @@ import { } from 'vue-demi' export interface InputProps { - modelValue: V + modelValue: V, } export function useVModel (props: InputProps): Ref { diff --git a/components/overlay/utils/use-loading.spec.ts b/components/overlay/utils/use-loading.spec.ts index 312a795e9c..c7bf883c76 100644 --- a/components/overlay/utils/use-loading.spec.ts +++ b/components/overlay/utils/use-loading.spec.ts @@ -1,9 +1,7 @@ import { vi } from 'vitest' import { nextTick } from 'vue-demi' import useLoading from './use-loading' - -// eslint-disable-next-line @typescript-eslint/promise-function-async -const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)) +import { delay } from 'nanodelay' beforeEach(() => { vi.useFakeTimers() diff --git a/components/overlay/utils/use-loading.ts b/components/overlay/utils/use-loading.ts index 60e9d12725..86f459b29a 100644 --- a/components/overlay/utils/use-loading.ts +++ b/components/overlay/utils/use-loading.ts @@ -2,7 +2,7 @@ import { tryOnMounted } from '@vueuse/shared' import { computed, ref } from 'vue-demi' export interface LoadingOptions { - elapsed: number | boolean + elapsed: number | boolean, } export default function useLoading (options_?: LoadingOptions) { diff --git a/components/select/Select.vue b/components/select/Select.vue index e4662e6c73..8022704c99 100644 --- a/components/select/Select.vue +++ b/components/select/Select.vue @@ -3,10 +3,12 @@ v-model="isOpen" class="select" data-testid="select" + aria-label="select" :class="classNames">