From 1cc2cdac8f190be59e2fe7611b08d2efaa2d1437 Mon Sep 17 00:00:00 2001 From: Tyh2001 <1469442737@qq.com> Date: Thu, 20 Jun 2024 14:43:02 +0800 Subject: [PATCH] style: format --- docs/.vitepress/json/search.json | 2 +- package.json | 2 +- .../_utils/compatible/__test__/utils.spec.ts | 4 ++-- .../fighting-design/_utils/props/__test__/utils.spec.ts | 5 ++++- .../fighting-design/_utils/type/__test__/utils.spec.ts | 2 +- packages/fighting-design/_utils/utils/index.ts | 2 +- .../dropdown-item/__test__/dropdown-item.spec.ts | 6 +++--- packages/fighting-design/package.json | 2 +- packages/fighting-design/select/src/interface.ts | 7 +++++-- packages/fighting-design/select/src/props.ts | 7 ++++++- 10 files changed, 25 insertions(+), 14 deletions(-) diff --git a/docs/.vitepress/json/search.json b/docs/.vitepress/json/search.json index 6726d15a1a..eda167acab 100644 --- a/docs/.vitepress/json/search.json +++ b/docs/.vitepress/json/search.json @@ -361,4 +361,4 @@ "url": "components/confirm-box" } ] -} \ No newline at end of file +} diff --git a/package.json b/package.json index 41f4b4c157..1023701b4a 100644 --- a/package.json +++ b/package.json @@ -77,4 +77,4 @@ "eslint --fix" ] } -} \ No newline at end of file +} diff --git a/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts b/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts index 0815f68538..217500303a 100644 --- a/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts +++ b/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts @@ -9,8 +9,8 @@ const data = { test('objectEntries', () => { /** - * @see toStrictEqual https://cn.vitest.dev/api/expect.html#tostrictequal - */ + * @see toStrictEqual https://cn.vitest.dev/api/expect.html#tostrictequal + */ expect(objectEntries(data)).toStrictEqual([ ['a', 1], ['b', 2], diff --git a/packages/fighting-design/_utils/props/__test__/utils.spec.ts b/packages/fighting-design/_utils/props/__test__/utils.spec.ts index cd8f09022a..72603f49f0 100644 --- a/packages/fighting-design/_utils/props/__test__/utils.spec.ts +++ b/packages/fighting-design/_utils/props/__test__/utils.spec.ts @@ -21,7 +21,10 @@ test('setStringProp', () => { }) test('setStringNumberProp', () => { - expect(setStringNumberProp('123')).toStrictEqual({ type: [String, Number], default: '123' }) + expect(setStringNumberProp('123')).toStrictEqual({ + type: [String, Number], + default: '123' + }) expect(setStringNumberProp()).toStrictEqual({ type: [String, Number], default: void 0 }) expect(setStringNumberProp(222)).toStrictEqual({ type: [String, Number], default: 222 }) }) diff --git a/packages/fighting-design/_utils/type/__test__/utils.spec.ts b/packages/fighting-design/_utils/type/__test__/utils.spec.ts index 13d72bbe1c..2456b9998f 100644 --- a/packages/fighting-design/_utils/type/__test__/utils.spec.ts +++ b/packages/fighting-design/_utils/type/__test__/utils.spec.ts @@ -8,7 +8,7 @@ test('toString', () => { expect(toString([])).toBe('[object Array]') expect(toString({})).toBe('[object Object]') expect(toString((): number => 1)).toBe('[object Function]') - expect(toString(new Date)).toBe('[object Date]') + expect(toString(new Date())).toBe('[object Date]') expect(toString(Symbol(1))).toBe('[object Symbol]') expect(toString(null)).toBe('[object Null]') expect(toString(undefined)).toBe('[object Undefined]') diff --git a/packages/fighting-design/_utils/utils/index.ts b/packages/fighting-design/_utils/utils/index.ts index f0cf45ea8a..e9a6e0fbd5 100644 --- a/packages/fighting-design/_utils/utils/index.ts +++ b/packages/fighting-design/_utils/utils/index.ts @@ -2,7 +2,7 @@ import { isString, isNumber } from '..' // #region 保留小数点后 no 位 /** - * + * * 保留小数点后 no 位 * * @see Number.prototype.toFixed() https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed diff --git a/packages/fighting-design/dropdown-item/__test__/dropdown-item.spec.ts b/packages/fighting-design/dropdown-item/__test__/dropdown-item.spec.ts index 659594959a..d68d339ea9 100644 --- a/packages/fighting-design/dropdown-item/__test__/dropdown-item.spec.ts +++ b/packages/fighting-design/dropdown-item/__test__/dropdown-item.spec.ts @@ -39,10 +39,10 @@ describe('DropdownItem', () => { const fn = vi.fn() const wrapper = mount(FDropdownItem, { props: { - onClick() { + onClick () { fn('onClick') } - }, + } }) wrapper.trigger('click') expect(fn.mock.calls[0]).toEqual(['onClick']) @@ -54,7 +54,7 @@ describe('DropdownItem', () => { global: { provide: { [TRIGGER_CLOSE_KEY as symbol]: { - close() { + close () { fn('close') } } diff --git a/packages/fighting-design/package.json b/packages/fighting-design/package.json index 7aa3d523cf..337ca3be2b 100644 --- a/packages/fighting-design/package.json +++ b/packages/fighting-design/package.json @@ -58,4 +58,4 @@ }, "homepage": "https://fighting.tianyuhao.cn", "repository": "https://github.com/FightingDesign/fighting-design" -} \ No newline at end of file +} diff --git a/packages/fighting-design/select/src/interface.ts b/packages/fighting-design/select/src/interface.ts index 2f690c8bae..06e71c1306 100644 --- a/packages/fighting-design/select/src/interface.ts +++ b/packages/fighting-design/select/src/interface.ts @@ -18,11 +18,14 @@ export type SelectChange = ( /** * 值在改变之前的回调类型 - * + * * @param { string | number } value 需要改变的值 * @param { string | number } label 需要改变的标签 */ -export type SelectBeforeChange = (value: SelectModelValue, label: SelectModelValue) => Promise +export type SelectBeforeChange = ( + value: SelectModelValue, + label: SelectModelValue +) => Promise /** * 提供给子组件注入的依赖项类型接口 diff --git a/packages/fighting-design/select/src/props.ts b/packages/fighting-design/select/src/props.ts index 311238c0ac..4645522a84 100644 --- a/packages/fighting-design/select/src/props.ts +++ b/packages/fighting-design/select/src/props.ts @@ -1,7 +1,12 @@ import { setBooleanProp, setFunctionProp, setStringProp } from '../../_utils' import { FIGHTING_SIZE } from '../../_tokens' import type { ExtractPropTypes, InjectionKey, PropType } from 'vue' -import type { SelectProvide, SelectModelValue, SelectChange, SelectBeforeChange } from './interface' +import type { + SelectProvide, + SelectModelValue, + SelectChange, + SelectBeforeChange +} from './interface' import type { FightingSize } from '../../_interface' export const Props = {