mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 03:57:36 +08:00
eslint fixes
This commit is contained in:
parent
6c86065307
commit
69a1bc909b
@ -22,6 +22,15 @@ module.exports = {
|
||||
WXEnvironment: true,
|
||||
},
|
||||
rules: {
|
||||
'no-unused-vars': [
|
||||
'error',
|
||||
// we are only using this rule to check for unused arguments since TS
|
||||
// catches unused variables but not args.
|
||||
{ varsIgnorePattern: '.*', args: 'none' }
|
||||
],
|
||||
'prefer-spread': 0,
|
||||
'prefer-rest-params': 0,
|
||||
'no-prototype-builtins': 0,
|
||||
"no-console": process.env.NODE_ENV !== "production" ? 0 : 2,
|
||||
"no-useless-escape": 0,
|
||||
"no-empty": 0,
|
||||
|
@ -40,6 +40,7 @@ export function generateCodeFrame(
|
||||
function repeat(str, n) {
|
||||
let result = ''
|
||||
if (n > 0) {
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
// eslint-disable-line
|
||||
if (n & 1) result += str
|
||||
|
@ -14,7 +14,7 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||
const tips: WarningMessage[] = []
|
||||
|
||||
let warn = (msg, range, tip) => {
|
||||
;(tip ? tips : errors).push(msg)
|
||||
(tip ? tips : errors).push(msg)
|
||||
}
|
||||
|
||||
if (options) {
|
||||
@ -35,7 +35,7 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||
data.end = range.end + leadingSpaceLength
|
||||
}
|
||||
}
|
||||
;(tip ? tips : errors).push(data)
|
||||
(tip ? tips : errors).push(data)
|
||||
}
|
||||
}
|
||||
// merge custom modules
|
||||
|
@ -24,7 +24,7 @@ export function addProp(
|
||||
range?: Range,
|
||||
dynamic?: boolean
|
||||
) {
|
||||
;(el.props || (el.props = [])).push(
|
||||
(el.props || (el.props = [])).push(
|
||||
rangeSetItem({ name, value, dynamic }, range)
|
||||
)
|
||||
el.plain = false
|
||||
@ -65,7 +65,7 @@ export function addDirective(
|
||||
modifiers?: ASTModifiers,
|
||||
range?: Range
|
||||
) {
|
||||
;(el.directives || (el.directives = [])).push(
|
||||
(el.directives || (el.directives = [])).push(
|
||||
rangeSetItem(
|
||||
{
|
||||
name,
|
||||
|
@ -91,7 +91,7 @@ export function parseFilters(exp: string): string {
|
||||
}
|
||||
|
||||
function pushFilter() {
|
||||
;(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim())
|
||||
(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim())
|
||||
lastFilterIndex = i + 1
|
||||
}
|
||||
|
||||
|
@ -773,7 +773,7 @@ function processAttrs(el) {
|
||||
modifiers = parseModifiers(name.replace(dirRE, ''))
|
||||
// support .foo shorthand syntax for the .prop modifier
|
||||
if (process.env.VBIND_PROP_SHORTHAND && propBindRE.test(name)) {
|
||||
;(modifiers || (modifiers = {})).prop = true
|
||||
(modifiers || (modifiers = {})).prop = true
|
||||
name = `.` + name.slice(1).replace(modifierRE, '')
|
||||
} else if (modifiers) {
|
||||
name = name.replace(modifierRE, '')
|
||||
|
@ -68,7 +68,7 @@ export function eventsMixin(Vue: Component) {
|
||||
vm.$on(event[i], fn)
|
||||
}
|
||||
} else {
|
||||
;(vm._events[event] || (vm._events[event] = [])).push(fn)
|
||||
(vm._events[event] || (vm._events[event] = [])).push(fn)
|
||||
// optimize hook:event cost by using a boolean flag marked at registration
|
||||
// instead of a hash lookup
|
||||
if (hookRE.test(event)) {
|
||||
|
@ -44,6 +44,6 @@ export function renderList(
|
||||
if (!isDef(ret)) {
|
||||
ret = []
|
||||
}
|
||||
;(ret as any)._isVList = true
|
||||
(ret as any)._isVList = true
|
||||
return ret
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ export function resolveScopedSlots(
|
||||
}
|
||||
}
|
||||
if (contentHashKey) {
|
||||
;(res as any).$key = contentHashKey
|
||||
(res as any).$key = contentHashKey
|
||||
}
|
||||
return res as any
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ export function resolveSlots(
|
||||
slot.push(child)
|
||||
}
|
||||
} else {
|
||||
;(slots.default || (slots.default = [])).push(child)
|
||||
(slots.default || (slots.default = [])).push(child)
|
||||
}
|
||||
}
|
||||
// ignore slots that contains only whitespace
|
||||
|
@ -160,10 +160,10 @@ function cloneAndMarkFunctionalResult(
|
||||
clone.fnContext = contextVm
|
||||
clone.fnOptions = options
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
;(clone.devtoolsMeta = clone.devtoolsMeta || {} as any).renderContext = renderContext
|
||||
(clone.devtoolsMeta = clone.devtoolsMeta || {} as any).renderContext = renderContext
|
||||
}
|
||||
if (data.slot) {
|
||||
;(clone.data || (clone.data = {})).slot = data.slot
|
||||
(clone.data || (clone.data = {})).slot = data.slot
|
||||
}
|
||||
return clone
|
||||
}
|
||||
|
2
src/global.d.ts
vendored
2
src/global.d.ts
vendored
@ -19,4 +19,4 @@ declare type WeexEnvironment = {
|
||||
dpr?: number;
|
||||
rem?: number;
|
||||
};
|
||||
declare var WXEnvironment: WeexEnvironment;
|
||||
declare let WXEnvironment: WeexEnvironment;
|
||||
|
@ -97,7 +97,7 @@ function remove(
|
||||
capture: boolean,
|
||||
_target?: HTMLElement
|
||||
) {
|
||||
;(_target || target).removeEventListener(
|
||||
(_target || target).removeEventListener(
|
||||
name,
|
||||
//@ts-expect-error
|
||||
handler._wrapper || handler,
|
||||
|
@ -242,7 +242,7 @@ export function leave(vnode: VNodeWithData, rm: Function) {
|
||||
}
|
||||
// record leaving element
|
||||
if (!vnode.data.show && el.parentNode) {
|
||||
;(el.parentNode._pending || (el.parentNode._pending = {}))[
|
||||
(el.parentNode._pending || (el.parentNode._pending = {}))[
|
||||
vnode.key!
|
||||
] = vnode
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ function add(
|
||||
}
|
||||
|
||||
function remove(event: string, handler: any, capture: any, _target?: any) {
|
||||
;(_target || target).removeEvent(event)
|
||||
(_target || target).removeEvent(event)
|
||||
}
|
||||
|
||||
function updateDOMListeners(oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
||||
|
@ -224,7 +224,7 @@ function leave(vnode, rm) {
|
||||
}
|
||||
// record leaving element
|
||||
if (!vnode.data.show) {
|
||||
;(el.parentNode._pending || (el.parentNode._pending = {}))[
|
||||
(el.parentNode._pending || (el.parentNode._pending = {}))[
|
||||
vnode.key
|
||||
] = vnode
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
declare var document: WeexDocument
|
||||
declare let document: WeexDocument
|
||||
|
||||
import type { WeexDocument, WeexElement } from 'typescript/weex'
|
||||
import TextNode from 'weex/runtime/text-node'
|
||||
|
@ -1,4 +1,4 @@
|
||||
declare var document: WeexDocument
|
||||
declare let document: WeexDocument
|
||||
|
||||
import { warn } from 'core/util/index'
|
||||
import type { WeexDocument } from 'typescript/weex'
|
||||
|
@ -97,7 +97,7 @@ export function createBundleRendererCreator(
|
||||
|
||||
let promise
|
||||
if (!cb) {
|
||||
;({ promise, cb } = createPromiseCallback())
|
||||
({ promise, cb } = createPromiseCallback())
|
||||
}
|
||||
|
||||
run(context)
|
||||
|
@ -80,7 +80,7 @@ export function createRenderer({
|
||||
// no callback, return Promise
|
||||
let promise
|
||||
if (!cb) {
|
||||
;({ promise, cb } = createPromiseCallback())
|
||||
({ promise, cb } = createPromiseCallback())
|
||||
}
|
||||
|
||||
let result = ''
|
||||
|
@ -221,6 +221,7 @@ describe('Observer', () => {
|
||||
get () { return this.val },
|
||||
set (v) {
|
||||
this.val = v
|
||||
// eslint-disable-next-line no-setter-return
|
||||
return this.val
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user