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