chore: format code

This commit is contained in:
三咲智子 Kevin Deng 2023-08-11 17:30:04 +08:00
parent 3be4e3cbe3
commit 623ba514ec
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
8 changed files with 24 additions and 16 deletions

View File

@ -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", "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", "check": "tsc --incremental --noEmit",
"lint": "eslint --cache --ext .ts packages/*/{src,__tests__}/**.ts", "lint": "eslint --cache --ext .ts packages/*/{src,__tests__}/**.ts",
"format": "prettier --write --cache --parser typescript \"**/*.[tj]s?(x)\"", "format": "prettier --write --cache \"**/*.[tj]s?(x)\"",
"format-check": "prettier --check --cache --parser typescript \"**/*.[tj]s?(x)\"", "format-check": "prettier --check --cache \"**/*.[tj]s?(x)\"",
"test": "vitest", "test": "vitest",
"test-unit": "vitest -c vitest.unit.config.ts", "test-unit": "vitest -c vitest.unit.config.ts",
"test-e2e": "node scripts/build.js vue -f global -d && vitest -c vitest.e2e.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", "marked": "^4.0.10",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^2.7.1", "prettier": "^3.0.1",
"pug": "^3.0.1", "pug": "^3.0.1",
"puppeteer": "~19.6.0", "puppeteer": "~19.6.0",
"rollup": "^3.26.0", "rollup": "^3.26.0",

View File

@ -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}` code += `,${prop.value.content}`
} }
} }

View File

@ -100,7 +100,8 @@ describe('defineProps w/ union type declaration + withDefaults', () => {
) )
}) })
describe('defineProps w/ generic type declaration + withDefaults', <T extends number, TA extends { describe('defineProps w/ generic type declaration + withDefaults', <T extends
number, TA extends {
a: string a: string
}, TString extends string>() => { }, TString extends string>() => {
const res = withDefaults( const res = withDefaults(
@ -117,10 +118,10 @@ describe('defineProps w/ generic type declaration + withDefaults', <T extends nu
n: 123, n: 123,
generic1: () => [123, 33] as T[], generic1: () => [123, 33] as T[],
generic2: () => ({ x: 123 } as { x: T }), generic2: () => ({ x: 123 }) as { x: T },
generic3: () => 'test' as TString, generic3: () => 'test' as TString,
generic4: () => ({ a: 'test' } as TA) generic4: () => ({ a: 'test' }) as TA
} }
) )

View File

@ -138,7 +138,10 @@ class RefImpl<T> {
public dep?: Dep = undefined public dep?: Dep = undefined
public readonly __v_isRef = true 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._rawValue = __v_isShallow ? value : toRaw(value)
this._value = __v_isShallow ? value : toReactive(value) this._value = __v_isShallow ? value : toReactive(value)
} }

View File

@ -382,7 +382,7 @@ describe('api: options', () => {
render() { render() {
return this[injectedKey] return this[injectedKey]
} }
} as any) }) as any
const ChildA = defineChild(['a'], 'a') const ChildA = defineChild(['a'], 'a')
const ChildB = defineChild({ b: 'a' }) const ChildB = defineChild({ b: 'a' })

View File

@ -116,7 +116,7 @@ describe('api: template refs', () => {
const toggle = ref(true) const toggle = ref(true)
const Comp = defineComponent( const Comp = defineComponent(
() => () => toggle.value ? h('div', { ref: fn }) : null () => () => (toggle.value ? h('div', { ref: fn }) : null)
) )
render(h(Comp), root) render(h(Comp), root)
expect(fn.mock.calls[0][0]).toBe(root.children[0]) expect(fn.mock.calls[0][0]).toBe(root.children[0])

View File

@ -400,7 +400,7 @@ function hydrateTeleport(
// Force-casted public typing for h and TSX props inference // Force-casted public typing for h and TSX props inference
export const Teleport = TeleportImpl as unknown as { export const Teleport = TeleportImpl as unknown as {
__isTeleport: true __isTeleport: true
new(): { new (): {
$props: VNodeProps & TeleportProps $props: VNodeProps & TeleportProps
$slots: { $slots: {
default(): VNode[] default(): VNode[]

View File

@ -96,8 +96,8 @@ importers:
specifier: ^4.1.5 specifier: ^4.1.5
version: 4.1.5 version: 4.1.5
prettier: prettier:
specifier: ^2.7.1 specifier: ^3.0.1
version: 2.8.8 version: 3.0.1
pug: pug:
specifier: ^3.0.1 specifier: ^3.0.1
version: 3.0.2 version: 3.0.2
@ -4621,9 +4621,9 @@ packages:
engines: {node: '>= 0.8.0'} engines: {node: '>= 0.8.0'}
dev: true dev: true
/prettier@2.8.8: /prettier@3.0.1:
resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} resolution: {integrity: sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==}
engines: {node: '>=10.13.0'} engines: {node: '>=14'}
hasBin: true hasBin: true
dev: true dev: true