From 734bd8e324ca84ddbe877889beed6fd73ebede47 Mon Sep 17 00:00:00 2001 From: Miklos Bertalan Date: Tue, 22 Jan 2019 12:51:58 +0100 Subject: [PATCH] fix linter issues --- src/builtIns/collections.js | 30 +++++++++++++++--------------- tests/builtIns/Map.test.js | 2 ++ tests/builtIns/Set.test.js | 2 ++ tests/builtIns/WeakMap.test.js | 2 ++ 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/builtIns/collections.js b/src/builtIns/collections.js index faefc2e..525b969 100644 --- a/src/builtIns/collections.js +++ b/src/builtIns/collections.js @@ -8,7 +8,7 @@ import { proxyToRaw, rawToProxy } from '../internals' const hasOwnProperty = Object.prototype.hasOwnProperty -function findObservable(obj) { +function findObservable (obj) { const observableObj = rawToProxy.get(obj) if (hasRunningReaction() && typeof obj === 'object' && obj !== null) { if (observableObj) { @@ -19,7 +19,7 @@ function findObservable(obj) { return observableObj || obj } -function patchIterator(iterator, isEntries) { +function patchIterator (iterator, isEntries) { const originalNext = iterator.next iterator.next = () => { let { done, value } = originalNext.call(iterator) @@ -36,19 +36,19 @@ function patchIterator(iterator, isEntries) { } const instrumentations = { - has(key) { + has (key) { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) registerRunningReactionForOperation({ target, key, type: 'has' }) return proto.has.apply(target, arguments) }, - get(key) { + get (key) { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) registerRunningReactionForOperation({ target, key, type: 'get' }) return findObservable(proto.get.apply(target, arguments)) }, - add(key) { + add (key) { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) const hadKey = proto.has.call(target, key) @@ -59,7 +59,7 @@ const instrumentations = { } return result }, - set(key, value) { + set (key, value) { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) const hadKey = proto.has.call(target, key) @@ -73,7 +73,7 @@ const instrumentations = { } return result }, - delete(key) { + delete (key) { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) const hadKey = proto.has.call(target, key) @@ -85,7 +85,7 @@ const instrumentations = { } return result }, - clear() { + clear () { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) const hadItems = target.size !== 0 @@ -97,7 +97,7 @@ const instrumentations = { } return result }, - forEach(cb, ...args) { + forEach (cb, ...args) { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) registerRunningReactionForOperation({ target, type: 'iterate' }) @@ -106,34 +106,34 @@ const instrumentations = { const wrappedCb = (value, ...rest) => cb(findObservable(value), ...rest) return proto.forEach.call(target, wrappedCb, ...args) }, - keys() { + keys () { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) registerRunningReactionForOperation({ target, type: 'iterate' }) return proto.keys.apply(target, arguments) }, - values() { + values () { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) registerRunningReactionForOperation({ target, type: 'iterate' }) const iterator = proto.values.apply(target, arguments) return patchIterator(iterator, false) }, - entries() { + entries () { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) registerRunningReactionForOperation({ target, type: 'iterate' }) const iterator = proto.entries.apply(target, arguments) return patchIterator(iterator, true) }, - [Symbol.iterator]() { + [Symbol.iterator] () { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) registerRunningReactionForOperation({ target, type: 'iterate' }) const iterator = proto[Symbol.iterator].apply(target, arguments) return patchIterator(iterator, target instanceof Map) }, - get size() { + get size () { const target = proxyToRaw.get(this) const proto = Reflect.getPrototypeOf(this) registerRunningReactionForOperation({ target, type: 'iterate' }) @@ -142,7 +142,7 @@ const instrumentations = { } export default { - get(target, key, receiver) { + get (target, key, receiver) { // instrument methods and property accessors to be reactive target = hasOwnProperty.call(instrumentations, key) ? instrumentations diff --git a/tests/builtIns/Map.test.js b/tests/builtIns/Map.test.js index 52abbbb..f167515 100644 --- a/tests/builtIns/Map.test.js +++ b/tests/builtIns/Map.test.js @@ -1,3 +1,5 @@ +/* eslint no-unused-expressions: 0, no-unused-vars: 0 */ + import { expect } from 'chai' import { observable, isObservable, observe, raw } from '@nx-js/observer-util' import { spy } from '../utils' diff --git a/tests/builtIns/Set.test.js b/tests/builtIns/Set.test.js index 6b3c2c4..9d3312a 100644 --- a/tests/builtIns/Set.test.js +++ b/tests/builtIns/Set.test.js @@ -1,3 +1,5 @@ +/* eslint no-unused-expressions: 0, no-unused-vars: 0 */ + import { expect } from 'chai' import { observable, isObservable, observe, raw } from '@nx-js/observer-util' import { spy } from '../utils' diff --git a/tests/builtIns/WeakMap.test.js b/tests/builtIns/WeakMap.test.js index 138bbd8..78c748f 100644 --- a/tests/builtIns/WeakMap.test.js +++ b/tests/builtIns/WeakMap.test.js @@ -1,3 +1,5 @@ +/* eslint no-unused-expressions: 0, no-unused-vars: 0 */ + import { expect } from 'chai' import { observable, isObservable, observe, raw } from '@nx-js/observer-util' import { spy } from '../utils'