Skip to content
Permalink
Browse files

chore(eslint): enable no-var rule

  • Loading branch information
Guillaume Chau
Guillaume Chau committed Oct 30, 2019
1 parent 15bb71b commit edd42a91f9dd5dfc843ae217c1d54f5291200204
@@ -18,6 +18,7 @@ module.exports = {
'vue/html-closing-bracket-newline': ['error', {
'singleline': 'never',
'multiline': 'always'
}]
}],
'no-var': ['error']
}
}
@@ -32,10 +32,10 @@ export default function clone (parent, {
} = {}) {
// maintain two arrays for circular references, where corresponding parents
// and children have the same index
var allParents = []
var allChildren = []
let allParents = []
let allChildren = []

var useBuffer = typeof Buffer !== 'undefined' && typeof Buffer.isBuffer === 'function'
let useBuffer = typeof Buffer !== 'undefined' && typeof Buffer.isBuffer === 'function'

const isBuffer = typeof window !== 'undefined' ? browserIsBuffer : Buffer.isBuffer

@@ -46,8 +46,8 @@ export default function clone (parent, {

if (depth === 0) { return parent }

var child
var proto
let child
let proto
if (typeof parent !== 'object') {
return parent
}
@@ -95,7 +95,7 @@ export default function clone (parent, {
}

if (circular) {
var index = allParents.indexOf(parent)
let index = allParents.indexOf(parent)

if (index !== -1) {
return allChildren[index]
@@ -106,20 +106,20 @@ export default function clone (parent, {

if (_instanceof(parent, NativeMap)) {
parent.forEach(function (value, key) {
var keyChild = _clone(key, depth - 1)
var valueChild = _clone(value, depth - 1)
let keyChild = _clone(key, depth - 1)
let valueChild = _clone(value, depth - 1)
child.set(keyChild, valueChild)
})
}
if (_instanceof(parent, NativeSet)) {
parent.forEach(function (value) {
var entryChild = _clone(value, depth - 1)
let entryChild = _clone(value, depth - 1)
child.add(entryChild)
})
}

for (var i in parent) {
var attrs = Object.getOwnPropertyDescriptor(parent, i)
for (let i in parent) {
let attrs = Object.getOwnPropertyDescriptor(parent, i)
if (attrs) {
if (attrs.hasOwnProperty('get') && attrs.get.name === 'computedGetter') {
Object.defineProperty(child, i, attrs)
@@ -131,12 +131,12 @@ export default function clone (parent, {
}

if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(parent)
let symbols = Object.getOwnPropertySymbols(parent)
for (let i = 0; i < symbols.length; i++) {
// Don't need to worry about cloning a symbol because it is a primitive,
// like a number or string.
var symbol = symbols[i]
var descriptor = Object.getOwnPropertyDescriptor(parent, symbol)
let symbol = symbols[i]
let descriptor = Object.getOwnPropertyDescriptor(parent, symbol)
if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
continue
}
@@ -146,7 +146,7 @@ export default function clone (parent, {
}

if (includeNonEnumerable) {
var allPropertyNames = Object.getOwnPropertyNames(parent)
let allPropertyNames = Object.getOwnPropertyNames(parent)
for (let i = 0; i < allPropertyNames.length; i++) {
const propertyName = allPropertyNames[i]
let descriptor = Object.getOwnPropertyDescriptor(parent, propertyName)
@@ -187,7 +187,7 @@ function __isRegExp (o) {
clone.__isRegExp = __isRegExp

function __getRegExpFlags (re) {
var flags = ''
let flags = ''
if (re.global) flags += 'g'
if (re.ignoreCase) flags += 'i'
if (re.multiline) flags += 'm'
@@ -176,12 +176,12 @@ export function installHook (target) {
}
// maintain two arrays for circular references, where corresponding parents
// and children have the same index
var allParents = []
var allChildren = []
let allParents = []
let allChildren = []

var useBuffer = typeof Buffer !== 'undefined' && typeof Buffer.isBuffer === 'function'
let useBuffer = typeof Buffer !== 'undefined' && typeof Buffer.isBuffer === 'function'

var isBuffer = typeof window !== 'undefined' ? browserIsBuffer : Buffer.isBuffer
let isBuffer = typeof window !== 'undefined' ? browserIsBuffer : Buffer.isBuffer

if (typeof circular === 'undefined') { circular = true }

@@ -194,8 +194,8 @@ export function installHook (target) {

if (depth === 0) { return parent }

var child
var proto
let child
let proto
if (typeof parent !== 'object') {
return parent
}
@@ -243,7 +243,7 @@ export function installHook (target) {
}

if (circular) {
var index = allParents.indexOf(parent)
let index = allParents.indexOf(parent)

if (index !== -1) {
return allChildren[index]
@@ -254,20 +254,20 @@ export function installHook (target) {

if (_instanceof(parent, NativeMap)) {
parent.forEach(function (value, key) {
var keyChild = _clone(key, depth - 1)
var valueChild = _clone(value, depth - 1)
let keyChild = _clone(key, depth - 1)
let valueChild = _clone(value, depth - 1)
child.set(keyChild, valueChild)
})
}
if (_instanceof(parent, NativeSet)) {
parent.forEach(function (value) {
var entryChild = _clone(value, depth - 1)
let entryChild = _clone(value, depth - 1)
child.add(entryChild)
})
}

for (var i in parent) {
var attrs = Object.getOwnPropertyDescriptor(parent, i)
for (let i in parent) {
let attrs = Object.getOwnPropertyDescriptor(parent, i)
if (attrs) {
if (attrs.hasOwnProperty('get') && attrs.get.name === 'computedGetter') {
Object.defineProperty(child, i, attrs)
@@ -279,12 +279,12 @@ export function installHook (target) {
}

if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(parent)
let symbols = Object.getOwnPropertySymbols(parent)
for (let i = 0; i < symbols.length; i++) {
// Don't need to worry about cloning a symbol because it is a primitive,
// like a number or string.
var symbol = symbols[i]
var descriptor = Object.getOwnPropertyDescriptor(parent, symbol)
let symbol = symbols[i]
let descriptor = Object.getOwnPropertyDescriptor(parent, symbol)
if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
continue
}
@@ -294,7 +294,7 @@ export function installHook (target) {
}

if (includeNonEnumerable) {
var allPropertyNames = Object.getOwnPropertyNames(parent)
let allPropertyNames = Object.getOwnPropertyNames(parent)
for (let i = 0; i < allPropertyNames.length; i++) {
const propertyName = allPropertyNames[i]
let descriptor = Object.getOwnPropertyDescriptor(parent, propertyName)
@@ -335,7 +335,7 @@ export function installHook (target) {
clone.__isRegExp = __isRegExp

function __getRegExpFlags (re) {
var flags = ''
let flags = ''
if (re.global) flags += 'g'
if (re.ignoreCase) flags += 'i'
if (re.multiline) flags += 'm'
@@ -849,7 +849,7 @@ function processVuexGetters (instance) {
*/

function processFirebaseBindings (instance) {
var refs = instance.$firebaseRefs
const refs = instance.$firebaseRefs
if (refs) {
return Object.keys(refs).map(key => {
return {
@@ -871,7 +871,7 @@ function processFirebaseBindings (instance) {
*/

function processObservables (instance) {
var obs = instance.$observables
const obs = instance.$observables
if (obs) {
return Object.keys(obs).map(key => {
return {
@@ -919,7 +919,7 @@ function bindToConsole (instance) {
}

consoleBoundInstances.unshift(id)
for (var i = 0; i < 5; i++) {
for (let i = 0; i < 5; i++) {
window['$vm' + i] = instanceMap.get(consoleBoundInstances[i])
}
window.$vm = instance
@@ -351,7 +351,7 @@ export default {
} else if (this.valueType.includes('native')) {
return escape(specialTypeRE.exec(value)[2])
} else if (typeof value === 'string') {
var typeMatch = value.match(rawTypeRE)
const typeMatch = value.match(rawTypeRE)
if (typeMatch) {
value = escape(typeMatch[1])
} else {
@@ -48,7 +48,10 @@ export default {
required: true
},
forceCollapse: String
forceCollapse: {
type: String,
default: null
}
},
data () {
@@ -32,7 +32,7 @@ const getters = {
if (typeof state.inspectedIndex === 'string') {
const path = state.inspectedIndex.split('_')
let obj = state.routeChanges[parseInt(path[0])]
for (var i = 1, len = path.length; i < len; ++i) {
for (let i = 1, len = path.length; i < len; ++i) {
obj = obj.children[parseInt(path[i])]
}
return obj
@@ -82,20 +82,20 @@ export function parse (data, reviver) {
if (Array.isArray(data)) {
data = data.join('')
}
var hasCircular = /^\s/.test(data)
const hasCircular = /^\s/.test(data)
if (!hasCircular) {
return arguments.length === 1
? JSON.parse(data)
: JSON.parse(data, reviver)
} else {
var list = JSON.parse(data)
const list = JSON.parse(data)
decode(list, reviver)
return list[0]
}
}

export function stringifyStrict (data, replacer, space) {
var list = []
const list = []
encode(data, replacer, list, new Map())
return space
? ' ' + JSON.stringify(list, null, space)
@@ -14,7 +14,7 @@ function cached (fn) {
}
}

var classifyRE = /(?:^|[-_/])(\w)/g
const classifyRE = /(?:^|[-_/])(\w)/g
export const classify = cached((str) => {
return str && str.replace(classifyRE, toUpper)
})
@@ -51,8 +51,8 @@ export function getComponentDisplayName (originalName, style = 'class') {

export function inDoc (node) {
if (!node) return false
var doc = node.ownerDocument.documentElement
var parent = node.parentNode
const doc = node.ownerDocument.documentElement
const parent = node.parentNode
return doc === node ||
doc === parent ||
!!(parent && parent.nodeType === 1 && (doc.contains(parent)))
@@ -20,7 +20,7 @@ function handshake (e) {
let listeners = []
const bridge = new Bridge({
listen (fn) {
var listener = evt => {
const listener = evt => {
if (evt.data.source === 'vue-devtools-proxy' && evt.data.payload) {
fn(evt.data.payload)
}

0 comments on commit edd42a9

Please sign in to comment.
You can’t perform that action at this time.