chore: type [ci skip]

This commit is contained in:
那里好脏不可以 2022-05-10 10:51:51 +08:00 committed by GitHub
parent 181872f744
commit 6042ab0f2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 32 additions and 32 deletions

View File

@ -2023,7 +2023,7 @@ foo
isPreTag: tag => tag === 'pre'
})
const elementAfterPre = ast.children[1] as ElementNode
// should not affect the <span> and condense its whitepsace inside
// should not affect the <span> and condense its whitespace inside
expect((elementAfterPre.children[0] as TextNode).content).toBe(` foo bar`)
})

View File

@ -80,7 +80,7 @@ describe('compiler: element transform', () => {
expect(root.components).toContain(`Foo`)
})
test('resolve implcitly self-referencing component', () => {
test('resolve implicitly self-referencing component', () => {
const { root } = parseWithElementTransform(`<Example/>`, {
filename: `/foo/bar/Example.vue?vue&type=template`
})

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`the v-if/else-if/else branchs in Transition should ignore comments 1`] = `
exports[`the v-if/else-if/else branches in Transition should ignore comments 1`] = `
"const _Vue = Vue
return function render(_ctx, _cache) {

View File

@ -139,7 +139,7 @@ describe('compiler warnings', () => {
})
})
test('the v-if/else-if/else branchs in Transition should ignore comments', () => {
test('the v-if/else-if/else branches in Transition should ignore comments', () => {
expect(
compile(`
<transition>

View File

@ -64,7 +64,7 @@ const bar = 1
`)
// should generate working code
assertCode(content)
// should anayze bindings
// should analyze bindings
expect(bindings).toStrictEqual({
foo: BindingTypes.PROPS,
bar: BindingTypes.SETUP_CONST,
@ -403,7 +403,7 @@ defineExpose({ foo: 123 })
assertCode(content)
})
// #4340 interpolations in tempalte strings
// #4340 interpolations in template strings
test('js template string interpolations', () => {
const { content } = compile(`
<script setup lang="ts">

View File

@ -33,7 +33,7 @@ function genVarName(id: string, raw: string, isProd: boolean): string {
}
}
function noramlizeExpression(exp: string) {
function normalizeExpression(exp: string) {
exp = exp.trim()
if (
(exp[0] === `'` && exp[exp.length - 1] === `'`) ||
@ -51,7 +51,7 @@ export function parseCssVars(sfc: SFCDescriptor): string[] {
// ignore v-bind() in comments /* ... */
const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '')
while ((match = cssVarRE.exec(content))) {
const variable = noramlizeExpression(match[1])
const variable = normalizeExpression(match[1])
if (!vars.includes(variable)) {
vars.push(variable)
}
@ -74,7 +74,7 @@ export const cssVarsPlugin: PluginCreator<CssVarsPluginOptions> = opts => {
// rewrite CSS variables
if (cssVarRE.test(decl.value)) {
decl.value = decl.value.replace(cssVarRE, (_, $1) => {
return `var(--${genVarName(id, noramlizeExpression($1), isProd)})`
return `var(--${genVarName(id, normalizeExpression($1), isProd)})`
})
}
}

View File

@ -85,7 +85,7 @@ exports[`handle TS casting syntax 1`] = `
exports[`macro import alias and removal 1`] = `
"import { ref as _ref, toRef as _toRef } from 'vue'
let a = _ref(1)
const __$temp_1 = (useMouse()),
@ -184,7 +184,7 @@ exports[`object destructure 1`] = `
d = _toRef(__$temp_1, 'd', 1),
f = _toRef(__$temp_1, 'e', 2),
h = _toRef(__$temp_1, g)
let __$temp_2 = (useSomthing(() => 1)),
let __$temp_2 = (useSomething(() => 1)),
foo = _toRef(__$temp_2, 'foo');
console.log(n.value, a.value, c.value, d.value, f.value, h.value, foo.value)
"

View File

@ -240,7 +240,7 @@ test('should not rewrite scope variable', () => {
test('object destructure', () => {
const { code, rootRefs } = transform(`
let n = $ref(1), { a, b: c, d = 1, e: f = 2, [g]: h } = $(useFoo())
let { foo } = $(useSomthing(() => 1));
let { foo } = $(useSomething(() => 1));
console.log(n, a, c, d, f, h, foo)
`)
expect(code).toMatch(`a = _toRef(__$temp_1, 'a')`)

View File

@ -120,7 +120,7 @@ describe('reactivity/effect/scope', () => {
counter.num = 6
expect(dummy).toBe(7)
// nested scope should not be stoped
// nested scope should not be stopped
expect(doubled).toBe(12)
})
@ -212,7 +212,7 @@ describe('reactivity/effect/scope', () => {
expect(spy).toHaveBeenCalledTimes(1)
})
it('should derefence child scope from parent scope after stopping child scope (no memleaks)', () => {
it('should dereference child scope from parent scope after stopping child scope (no memleaks)', () => {
const parent = new EffectScope()
const child = parent.run(() => new EffectScope())!
expect(parent.scopes!.includes(child)).toBe(true)

View File

@ -459,7 +459,7 @@ describe('reactivity/readonly', () => {
expect(
'Set operation on key "_dirty" failed: target is readonly.'
).not.toHaveBeenWarned()
// @ts-expect-error - non-existant property
// @ts-expect-error - non-existent property
rC.randomProperty = true
expect(
@ -476,7 +476,7 @@ describe('reactivity/readonly', () => {
expect(isReadonly(rr.foo)).toBe(true)
})
test('attemptingt to write plain value to a readonly ref nested in a reactive object should fail', () => {
test('attempting to write plain value to a readonly ref nested in a reactive object should fail', () => {
const r = ref(false)
const ror = readonly(r)
const obj = reactive({ ror })

View File

@ -18,7 +18,7 @@ export class EffectScope {
cleanups: (() => void)[] = []
/**
* only assinged by undetached scope
* only assigned by undetached scope
* @internal
*/
parent: EffectScope | undefined

View File

@ -1032,7 +1032,7 @@ describe('Suspense', () => {
await nextTick()
expect(deps.length).toBe(2)
// switch before two resovles
// switch before two resolves
view.value = Three
await nextTick()
expect(deps.length).toBe(3)
@ -1098,7 +1098,7 @@ describe('Suspense', () => {
await nextTick()
expect(deps.length).toBe(2)
// switch back before two resovles
// switch back before two resolves
view.value = One
await nextTick()
expect(deps.length).toBe(2)

View File

@ -183,7 +183,7 @@ describe('error handling', () => {
})
// unlike other lifecycle hooks, created/beforeCreate are called as part of
// the options API initiualization process instead of by the renderer.
// the options API initialization process instead of by the renderer.
test('in created/beforeCreate hook', () => {
const err = new Error('foo')
const fn = jest.fn()

View File

@ -1,5 +1,5 @@
// since v-memo really is a compiler + runtime combo feature, we are performing
// more of an itegration test here.
// more of an integration test here.
import { ComponentOptions, createApp, nextTick } from 'vue'
describe('v-memo', () => {

View File

@ -879,7 +879,7 @@ describe('renderer: optimized mode', () => {
// #3881
// root cause: fragment inside a compiled slot passed to component which
// programmatically invokes the slot. The entire slot should de-opt but
// the fragment was incorretly put in optimized mode which causes it to skip
// the fragment was incorrectly put in optimized mode which causes it to skip
// updates for its inner components.
test('fragments inside programmatically invoked compiled slot should de-opt properly', async () => {
const Parent: FunctionalComponent = (_, { slots }) => slots.default!()

View File

@ -477,7 +477,7 @@ export function createComponentInstance(
accessCache: null!,
renderCache: [],
// local resovled assets
// local resolved assets
components: null,
directives: null,

View File

@ -483,8 +483,8 @@ interface LegacyOptions<
*
* type-only, used to assist Mixin's type inference,
* typescript will try to simplify the inferred `Mixin` type,
* with the `__differenciator`, typescript won't be able to combine different mixins,
* because the `__differenciator` will be different
* with the `__differentiator`, typescript won't be able to combine different mixins,
* because the `__differentiator` will be different
*/
__differentiator?: keyof D | keyof C | keyof M
}

View File

@ -1015,7 +1015,7 @@ describe('vModel', () => {
bar.selected = false
data.value = new Set([{ foo: 1 }, { bar: 1 }])
await nextTick()
// whithout looseEqual, here is different from Array
// without looseEqual, here is different from Array
expect(foo.selected).toEqual(false)
expect(bar.selected).toEqual(false)
})

View File

@ -205,7 +205,7 @@ describe('runtime-dom: props patching', () => {
test('form attribute', () => {
const el = document.createElement('input')
patchProp(el, 'form', null, 'foo')
// non existant element
// non existent element
expect(el.form).toBe(null)
expect(el.getAttribute('form')).toBe('foo')
// remove attribute

View File

@ -28,11 +28,11 @@ describe('toDisplayString', () => {
}
expect(toDisplayString(objWithToStringOverride)).toBe('override')
const objWithNonInvokeableToString = {
const objWithNonInvokableToString = {
foo: 555,
toString: null
}
expect(toDisplayString(objWithNonInvokeableToString)).toBe(
expect(toDisplayString(objWithNonInvokableToString)).toBe(
`{
"foo": 555,
"toString": null

View File

@ -281,7 +281,7 @@ Features that start with `COMPILER_` are compiler-specific: if you are using the
| ID | Type | Description | Docs |
| ------------------ | ---- | ------------------------------------- | ---------------------------------------- |
| TRANSITION_CLASSES | ⭘ | Transtion enter/leave classes changed | [link](https://v3-migration.vuejs.org/breaking-changes/transition.html) |
| TRANSITION_CLASSES | ⭘ | Transition enter/leave classes changed | [link](https://v3-migration.vuejs.org/breaking-changes/transition.html) |
### Fully Compatible

View File

@ -98,7 +98,7 @@ describe('object props', () => {
ff: Function as PropType<(a: number, b: string) => { a: boolean }>,
// explicit type casting with constructor
ccc: Array as () => string[],
// required + contructor type casting
// required + constructor type casting
ddd: {
type: Array as () => string[],
required: true
@ -281,7 +281,7 @@ describe('object props', () => {
ff: Function as PropType<(a: number, b: string) => { a: boolean }>,
// explicit type casting with constructor
ccc: Array as () => string[],
// required + contructor type casting
// required + constructor type casting
ddd: {
type: Array as () => string[],
required: true