From 6b415f6bcd3c39360470e3da4e2cc1fb29849609 Mon Sep 17 00:00:00 2001 From: Arjun Kathuria Date: Wed, 15 Jun 2016 21:43:39 +0530 Subject: [PATCH] style(code-review): adds the respective code review corrections as directed --- .jshintrc | 5 ++--- src/inputjs/compute-delta-xy.js | 6 ++++-- src/inputjs/compute-input-data.js | 3 +-- src/main.js | 2 ++ src/recognizers/swipe.js | 2 +- src/utils/utils-consts.js | 3 +-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.jshintrc b/.jshintrc index f565275e5..d1dab2ec8 100644 --- a/.jshintrc +++ b/.jshintrc @@ -5,15 +5,14 @@ "indent": 2, "predef": [ "document", - "window", - "define", - "module" + "window" ], "browser": true, "boss": true, "curly": true, "debug": false, "devel": true, + "eqeqeq": true, "expr": true, "validthis": true, "evil": true, diff --git a/src/inputjs/compute-delta-xy.js b/src/inputjs/compute-delta-xy.js index b4ecda9b8..fefb5bd41 100644 --- a/src/inputjs/compute-delta-xy.js +++ b/src/inputjs/compute-delta-xy.js @@ -1,8 +1,10 @@ -import { INPUT_START,INPUT_END } from './input-consts'; +import { INPUT_START, INPUT_END } from './input-consts'; export default function computeDeltaXY(session, input) { let { center } = input; - let offset = session.offsetDelta || {}; // could be further deconstructed later on + // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session; + // jscs throwing error on defalut destructured values and without defaults tests fail + let offset = session.offsetDelta || {}; let prevDelta = session.prevDelta || {}; let prevInput = session.prevInput || {}; diff --git a/src/inputjs/compute-input-data.js b/src/inputjs/compute-input-data.js index 20217e86f..73b26940c 100644 --- a/src/inputjs/compute-input-data.js +++ b/src/inputjs/compute-input-data.js @@ -35,8 +35,7 @@ export default function computeInputData(manager, input) { session.firstMultiple = false; } - let { firstInput } = session; - let { firstMultiple } = session; + let { firstInput, firstMultiple } = session; let offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; let center = input.center = getCenter(pointers); diff --git a/src/main.js b/src/main.js index 15e21c50c..2672503c6 100644 --- a/src/main.js +++ b/src/main.js @@ -126,6 +126,7 @@ assign(Hammer, { let freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line freeGlobal.Hammer = Hammer; +/* jshint ignore:start */ if (typeof define === 'function' && define.amd) { define(function() { return Hammer; @@ -135,3 +136,4 @@ if (typeof define === 'function' && define.amd) { } else { window[exportName] = Hammer; } +/* jshint ignore:end */ diff --git a/src/recognizers/swipe.js b/src/recognizers/swipe.js index b78c1a726..e4b39798d 100644 --- a/src/recognizers/swipe.js +++ b/src/recognizers/swipe.js @@ -36,7 +36,7 @@ inherit(SwipeRecognizer, AttrRecognizer, { }, attrTest(input) { - let { options:{ direction } } = this; + let { direction } = this.options; let velocity; if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { diff --git a/src/utils/utils-consts.js b/src/utils/utils-consts.js index 7054369d4..a2c30db35 100644 --- a/src/utils/utils-consts.js +++ b/src/utils/utils-consts.js @@ -3,8 +3,7 @@ const TEST_ELEMENT = document.createElement('div'); const TYPE_FUNCTION = 'function'; -const { round } = Math; -const { abs } = Math; +const { round, abs } = Math; const { now } = Date; export {