Skip to content

Commit

Permalink
ci: check prettier format (#6830)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Oct 28, 2022
1 parent 830454a commit bbb66d7
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion packages/compiler-sfc/src/compileScript.ts
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions packages/reactivity/src/ref.ts
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/__tests__/componentEmits.spec.ts
Expand Up @@ -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() {},
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/componentEmits.ts
Expand Up @@ -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)
Expand Down

0 comments on commit bbb66d7

Please sign in to comment.