chore: cleanup tweaks that would affect JS; rolled back packages folder to @pikax output

This commit is contained in:
David Welch 2022-05-04 15:16:17 -06:00
parent 40dccfedd1
commit e2f1ce06cf
20 changed files with 24166 additions and 24158 deletions

View File

@ -1726,6 +1726,7 @@
}
}
catch (e) {
// @ts-expect-error should it be any?
handleError(e, vm, info);
}
return res;
@ -5698,7 +5699,7 @@
// $flow-disable-line
const leadingSpaceLength = template.match(/^\s*/)[0].length;
warn = (msg, range, tip) => {
const data = typeof (msg) === 'string' ? { msg } : msg;
const data = { msg };
if (range) {
if (range.start != null) {
data.start = range.start + leadingSpaceLength;

View File

@ -1731,6 +1731,7 @@ function invokeWithErrorHandling(handler, context, args, vm, info) {
}
}
catch (e) {
// @ts-expect-error should it be any?
handleError(e, vm, info);
}
return res;
@ -5443,7 +5444,7 @@ function createCompilerCreator(baseCompile) {
// $flow-disable-line
const leadingSpaceLength = template.match(/^\s*/)[0].length;
warn = (msg, range, tip) => {
const data = typeof (msg) === 'string' ? { msg } : msg;
const data = { msg };
if (range) {
if (range.start != null) {
data.start = range.start + leadingSpaceLength;

View File

@ -4415,7 +4415,7 @@
// $flow-disable-line
const leadingSpaceLength = template.match(/^\s*/)[0].length;
warn = (msg, range, tip) => {
const data = typeof (msg) === 'string' ? { msg } : msg;
const data = { msg };
if (range) {
if (range.start != null) {
data.start = range.start + leadingSpaceLength;

View File

@ -4049,7 +4049,7 @@ function createCompilerCreator(baseCompile) {
// $flow-disable-line
const leadingSpaceLength = template.match(/^\s*/)[0].length;
warn = (msg, range, tip) => {
const data = typeof (msg) === 'string' ? { msg } : msg;
const data = { msg };
if (range) {
if (range.start != null) {
data.start = range.start + leadingSpaceLength;

View File

@ -1,5 +1,3 @@
/* globals */
declare const stats: any
declare const valueToPoint: Function
@ -45,7 +43,7 @@ module.exports = {
const point = valueToPoint(stat.value, i, 6)
return point.x + ',' + point.y
}).join(' ')
return document.querySelector('polygon').attributes[0].value === points
return document.querySelector('polygon')!.attributes[0].value === points
})
.end()
}

View File

@ -52,10 +52,10 @@ beforeEach(() => {
spyOn(console, 'error')
jasmine.addMatchers({
toHaveBeenWarned: () =>
// @ts-ignore
// @ts-expect-error
createCompareFn(console.error),
toHaveBeenTipped: () =>
// @ts-ignore
// @ts-expect-error
createCompareFn(console.warn)
})
})

View File

@ -1,4 +1,4 @@
global.triggerEvent = function triggerEvent (target, event, process) {
window.triggerEvent = function triggerEvent (target, event, process) {
const e = document.createEvent('HTMLEvents')
e.initEvent(event, true, true)
if (event === 'click') {

View File

@ -12,7 +12,7 @@ import Vue from 'vue'
// // more assertions...
// })
// .then(done)
// @ts-expect-error
window.waitForUpdate = initialCb => {
let end
const queue = initialCb ? [initialCb] : []
@ -30,7 +30,7 @@ window.waitForUpdate = initialCb => {
done.fail(e)
}
}
if (!hasError && !job?.wait) {
if (!hasError && !job!.wait) {
if (queue.length) {
Vue.nextTick(shift)
}
@ -41,7 +41,7 @@ window.waitForUpdate = initialCb => {
}
Vue.nextTick(() => {
if (!queue.length || (!end && !queue[queue.length - 1]?.fail)) {
if (!queue.length || (!end && !queue[queue.length - 1]!.fail)) {
throw new Error('waitForUpdate chain is missing .then(done)')
}
shift()

View File

@ -3,9 +3,6 @@ import webpack from 'webpack'
import MemoryFS from 'memory-fs'
export function compileWithWebpack (file, extraConfig, cb) {
if( process.env.FOOBAR !== 'blah') {
throw new Error('die')
}
const config = Object.assign({
mode: 'development',
entry: path.resolve(__dirname, 'fixtures', file),

View File

@ -3,7 +3,8 @@ import { formatComponentName, warn } from 'core/util/debug'
describe('Debug utilities', () => {
it('properly format component names', () => {
const vm = new Vue('div')
// @ts-expect-error
const vm = new Vue()
expect(formatComponentName(vm)).toBe('<Root>')
vm.$root = null
@ -83,7 +84,8 @@ found in
describe('warn', () => {
const msg = 'message'
const vm = new Vue('div')
// @ts-expect-error
const vm = new Vue()
it('calls warnHandler if warnHandler is set', () => {
Vue.config.warnHandler = jasmine.createSpy()

View File

@ -170,7 +170,8 @@ describe('Error handling', () => {
Vue.nextTick(() => {
expect(spy).toHaveBeenCalledWith(err1, undefined, 'nextTick')
const vm = new Vue('div')
// @ts-expect-error
const vm = new Vue()
vm.$nextTick(() => { throw err2 })
Vue.nextTick(() => {
// should be called with correct instance info

View File

@ -2,11 +2,13 @@ import Vue from 'vue'
describe('Initialization', () => {
it('without new', () => {
try { Vue('div') } catch (e) {}
// @ts-expect-error
try { Vue() } catch (e) {}
expect('Vue is a constructor and should be called with the `new` keyword').toHaveBeenWarned()
})
it('with new', () => {
expect(new Vue('div') instanceof Vue).toBe(true)
// @ts-expect-error
expect(new Vue() instanceof Vue).toBe(true)
})
})

View File

@ -3,7 +3,8 @@ import Vue from 'vue'
describe('Instance methods events', () => {
let vm, spy
beforeEach(() => {
vm = new Vue('div')
// @ts-expect-error
const vm = new Vue()
spy = jasmine.createSpy('emitter')
})

View File

@ -161,7 +161,8 @@ describe('Instance properties', () => {
})
it('warn mutating $attrs', () => {
const vm = new Vue('div')
// @ts-expect-error
const vm = new Vue()
vm.$attrs = {}
expect(`$attrs is readonly`).toHaveBeenWarned()
})
@ -196,7 +197,8 @@ describe('Instance properties', () => {
})
it('warn mutating $listeners', () => {
const vm = new Vue('div')
// @ts-expect-error
const vm = new Vue()
vm.$listeners = {}
expect(`$listeners is readonly`).toHaveBeenWarned()
})

View File

@ -78,7 +78,8 @@ describe('Options lifecycle hooks', () => {
// #3898
it('should call for manually mounted instance with parent', () => {
const parent = new Vue('div')
// @ts-expect-error
const vm = new Vue()
expect(spy).not.toHaveBeenCalled()
new Vue({
parent,

View File

@ -33,7 +33,8 @@ describe('Options render', () => {
})
it('should warn non `render` option and non `template` option', () => {
new Vue('div').$mount()
// @ts-expect-error
new Vue().$mount()
expect('Failed to mount component: template or render function not defined.').toHaveBeenWarned()
})
})

View File

@ -23,7 +23,7 @@ if (!isIE9) {
// should not apply transition on initial render by default
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
vm.ok = false
global.waitForUpdate(() => {
waitForUpdate(() => {
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
}).thenWaitFor(nextFrame).then(() => {
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')

View File

@ -14,7 +14,8 @@ describe('Observer', () => {
const ob1 = observe(1)
expect(ob1).toBeUndefined()
// avoid vue instance
const ob2 = observe(new Vue('div'))
// @ts-expect-error
const ob2 = observe(new Vue())
expect(ob2).toBeUndefined()
// avoid frozen objects
const ob3 = observe(Object.freeze({}))