Skip to content

Commit bbb66d7

Browse files
authored
ci: check prettier format (#6830)
1 parent 830454a commit bbb66d7

File tree

6 files changed

+14
-5
lines changed

6 files changed

+14
-5
lines changed

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ jobs:
6868
- name: Run eslint
6969
run: pnpm run lint
7070

71+
- name: Run prettier
72+
run: pnpm run format-check
73+
7174
- name: Run type declaration tests
7275
run: pnpm run test-dts
7376

package.json

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

packages/compiler-sfc/src/compileScript.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,10 @@ export function compileScript(
553553
}
554554

555555
if (declId) {
556-
emitIdentifier = (declId.type === 'Identifier') ? declId.name : scriptSetup!.content.slice(declId.start!, declId.end!)
556+
emitIdentifier =
557+
declId.type === 'Identifier'
558+
? declId.name
559+
: scriptSetup!.content.slice(declId.start!, declId.end!)
557560
}
558561

559562
return true

packages/reactivity/src/ref.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,10 @@ export type ShallowUnwrapRef<T> = {
282282
[K in keyof T]: T[K] extends Ref<infer V>
283283
? V // if `V` is `unknown` that means it does not extend `Ref` and is undefined
284284
: T[K] extends Ref<infer V> | undefined
285-
? unknown extends V ? undefined : V | undefined
286-
: T[K]
285+
? unknown extends V
286+
? undefined
287+
: V | undefined
288+
: T[K]
287289
}
288290

289291
export type UnwrapRef<T> = T extends ShallowRef<infer V>

packages/runtime-core/__tests__/componentEmits.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ describe('component: emit', () => {
385385
expect(fn2).toHaveBeenCalledTimes(1)
386386
expect(fn2).toHaveBeenCalledWith(1)
387387
})
388-
388+
389389
test('only trim string parameter when work with v-model on component', () => {
390390
const Foo = defineComponent({
391391
render() {},

packages/runtime-core/src/componentEmits.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function emit(
123123
}Modifiers`
124124
const { number, trim } = props[modifiersKey] || EMPTY_OBJ
125125
if (trim) {
126-
args = rawArgs.map(a => isString(a) ? a.trim() : a)
126+
args = rawArgs.map(a => (isString(a) ? a.trim() : a))
127127
}
128128
if (number) {
129129
args = rawArgs.map(toNumber)

0 commit comments

Comments
 (0)