ci: check prettier format (#6830)

This commit is contained in:
三咲智子 (Kevin) 2022-10-28 09:39:34 +08:00 committed by GitHub
parent 830454ae56
commit bbb66d7ac7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 5 deletions

View File

@ -68,6 +68,9 @@ jobs:
- name: Run eslint
run: pnpm run lint
- name: Run prettier
run: pnpm run format-check
- name: Run type declaration tests
run: pnpm run test-dts

View File

@ -10,6 +10,7 @@
"size-baseline": "node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build && node brotli",
"lint": "eslint --cache --ext .ts packages/*/{src,__tests__}/**.ts",
"format": "prettier --write --cache --parser typescript \"packages/**/*.ts?(x)\"",
"format-check": "prettier --check --cache --parser typescript \"packages/**/*.ts?(x)\"",
"test": "run-s \"test-unit {@}\" \"test-e2e {@}\"",
"test-unit": "jest --filter ./scripts/filter-unit.js",
"test-e2e": "node scripts/build.js vue -f global -d && jest --filter ./scripts/filter-e2e.js --runInBand",

View File

@ -553,7 +553,10 @@ export function compileScript(
}
if (declId) {
emitIdentifier = (declId.type === 'Identifier') ? declId.name : scriptSetup!.content.slice(declId.start!, declId.end!)
emitIdentifier =
declId.type === 'Identifier'
? declId.name
: scriptSetup!.content.slice(declId.start!, declId.end!)
}
return true

View File

@ -282,8 +282,10 @@ export type ShallowUnwrapRef<T> = {
[K in keyof T]: T[K] extends Ref<infer V>
? V // if `V` is `unknown` that means it does not extend `Ref` and is undefined
: T[K] extends Ref<infer V> | undefined
? unknown extends V ? undefined : V | undefined
: T[K]
? unknown extends V
? undefined
: V | undefined
: T[K]
}
export type UnwrapRef<T> = T extends ShallowRef<infer V>

View File

@ -385,7 +385,7 @@ describe('component: emit', () => {
expect(fn2).toHaveBeenCalledTimes(1)
expect(fn2).toHaveBeenCalledWith(1)
})
test('only trim string parameter when work with v-model on component', () => {
const Foo = defineComponent({
render() {},

View File

@ -123,7 +123,7 @@ export function emit(
}Modifiers`
const { number, trim } = props[modifiersKey] || EMPTY_OBJ
if (trim) {
args = rawArgs.map(a => isString(a) ? a.trim() : a)
args = rawArgs.map(a => (isString(a) ? a.trim() : a))
}
if (number) {
args = rawArgs.map(toNumber)