From: 三咲智子 Kevin Deng Date: Fri, 11 Aug 2023 09:30:04 +0000 (+0800) Subject: chore: format code X-Git-Tag: v3.3.5~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=623ba514ec0f5adc897db90c0f986b1b6905e014;p=thirdparty%2Fvuejs%2Fcore.git chore: format code --- diff --git a/package.json b/package.json index f14db16dda..d514ccd919 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "size-baseline": "node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build && node brotli", "check": "tsc --incremental --noEmit", "lint": "eslint --cache --ext .ts packages/*/{src,__tests__}/**.ts", - "format": "prettier --write --cache --parser typescript \"**/*.[tj]s?(x)\"", - "format-check": "prettier --check --cache --parser typescript \"**/*.[tj]s?(x)\"", + "format": "prettier --write --cache \"**/*.[tj]s?(x)\"", + "format-check": "prettier --check --cache \"**/*.[tj]s?(x)\"", "test": "vitest", "test-unit": "vitest -c vitest.unit.config.ts", "test-e2e": "node scripts/build.js vue -f global -d && vitest -c vitest.e2e.config.ts", @@ -84,7 +84,7 @@ "marked": "^4.0.10", "minimist": "^1.2.0", "npm-run-all": "^4.1.5", - "prettier": "^2.7.1", + "prettier": "^3.0.1", "pug": "^3.0.1", "puppeteer": "~19.6.0", "rollup": "^3.26.0", diff --git a/packages/compiler-sfc/src/script/importUsageCheck.ts b/packages/compiler-sfc/src/script/importUsageCheck.ts index 7019dcf231..f3c3932d82 100644 --- a/packages/compiler-sfc/src/script/importUsageCheck.ts +++ b/packages/compiler-sfc/src/script/importUsageCheck.ts @@ -63,7 +63,11 @@ function resolveTemplateUsageCheckString(sfc: SFCDescriptor) { )}` } } - if (prop.type === NodeTypes.ATTRIBUTE && prop.name === 'ref' && prop.value?.content) { + if ( + prop.type === NodeTypes.ATTRIBUTE && + prop.name === 'ref' && + prop.value?.content + ) { code += `,${prop.value.content}` } } diff --git a/packages/dts-test/setupHelpers.test-d.ts b/packages/dts-test/setupHelpers.test-d.ts index 934e6056d2..feb4085dea 100644 --- a/packages/dts-test/setupHelpers.test-d.ts +++ b/packages/dts-test/setupHelpers.test-d.ts @@ -100,7 +100,8 @@ describe('defineProps w/ union type declaration + withDefaults', () => { ) }) -describe('defineProps w/ generic type declaration + withDefaults', () => { const res = withDefaults( @@ -117,10 +118,10 @@ describe('defineProps w/ generic type declaration + withDefaults', [123, 33] as T[], - generic2: () => ({ x: 123 } as { x: T }), + generic2: () => ({ x: 123 }) as { x: T }, generic3: () => 'test' as TString, - generic4: () => ({ a: 'test' } as TA) + generic4: () => ({ a: 'test' }) as TA } ) diff --git a/packages/reactivity/src/ref.ts b/packages/reactivity/src/ref.ts index ef111fc1ff..915f576087 100644 --- a/packages/reactivity/src/ref.ts +++ b/packages/reactivity/src/ref.ts @@ -138,7 +138,10 @@ class RefImpl { public dep?: Dep = undefined public readonly __v_isRef = true - constructor(value: T, public readonly __v_isShallow: boolean) { + constructor( + value: T, + public readonly __v_isShallow: boolean + ) { this._rawValue = __v_isShallow ? value : toRaw(value) this._value = __v_isShallow ? value : toReactive(value) } diff --git a/packages/runtime-core/__tests__/apiOptions.spec.ts b/packages/runtime-core/__tests__/apiOptions.spec.ts index a172196d3f..ca712e0d3a 100644 --- a/packages/runtime-core/__tests__/apiOptions.spec.ts +++ b/packages/runtime-core/__tests__/apiOptions.spec.ts @@ -382,7 +382,7 @@ describe('api: options', () => { render() { return this[injectedKey] } - } as any) + }) as any const ChildA = defineChild(['a'], 'a') const ChildB = defineChild({ b: 'a' }) diff --git a/packages/runtime-core/__tests__/rendererTemplateRef.spec.ts b/packages/runtime-core/__tests__/rendererTemplateRef.spec.ts index 7d6279c525..28d7a95eb0 100644 --- a/packages/runtime-core/__tests__/rendererTemplateRef.spec.ts +++ b/packages/runtime-core/__tests__/rendererTemplateRef.spec.ts @@ -116,7 +116,7 @@ describe('api: template refs', () => { const toggle = ref(true) const Comp = defineComponent( - () => () => toggle.value ? h('div', { ref: fn }) : null + () => () => (toggle.value ? h('div', { ref: fn }) : null) ) render(h(Comp), root) expect(fn.mock.calls[0][0]).toBe(root.children[0]) diff --git a/packages/runtime-core/src/components/Teleport.ts b/packages/runtime-core/src/components/Teleport.ts index 4f7d16bc7d..19ccbc5de2 100644 --- a/packages/runtime-core/src/components/Teleport.ts +++ b/packages/runtime-core/src/components/Teleport.ts @@ -400,7 +400,7 @@ function hydrateTeleport( // Force-casted public typing for h and TSX props inference export const Teleport = TeleportImpl as unknown as { __isTeleport: true - new(): { + new (): { $props: VNodeProps & TeleportProps $slots: { default(): VNode[] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a4a711ef39..378cc5749d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -96,8 +96,8 @@ importers: specifier: ^4.1.5 version: 4.1.5 prettier: - specifier: ^2.7.1 - version: 2.8.8 + specifier: ^3.0.1 + version: 3.0.1 pug: specifier: ^3.0.1 version: 3.0.2 @@ -4621,9 +4621,9 @@ packages: engines: {node: '>= 0.8.0'} dev: true - /prettier@2.8.8: - resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} - engines: {node: '>=10.13.0'} + /prettier@3.0.1: + resolution: {integrity: sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==} + engines: {node: '>=14'} hasBin: true dev: true