Skip to content

Commit

Permalink
feat: disable complexity rules for some methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuell1 committed Jul 13, 2018
1 parent 96d3d8d commit fb57db4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/components/MdApp/MdApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
})
}
/* eslint-disable complexity */
function buildSlots (children, context, functionalContext, options, createElement) {
let slots = []
let hasDrawer = false
if (children) {
children.forEach(child => {
/* eslint-enable */
const data = child.data
const componentOptions = child.componentOptions
Expand Down Expand Up @@ -75,6 +75,7 @@
return slots
}
/* eslint-enable complexity */
function getDrawers (children) {
const drawerVnodes = children.filter(child => {
Expand Down
37 changes: 18 additions & 19 deletions src/core/mixins/MdSwipeable/MdSwipeable.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,30 @@ export default {

this.swipeStart = true
},
/* eslint-disable complexity */
handleTouchMove (event) {
if (!this.swipeStart) {
return
}

const touchmoveX = event.touches[0].screenX
const touchmoveY = event.touches[0].screenY
if (this.swipeStart) {
const touchmoveX = event.touches[0].screenX
const touchmoveY = event.touches[0].screenY

const actualX = touchmoveX - this.touchPosition.startX
const actualY = touchmoveY - this.touchPosition.startY
const actualX = touchmoveX - this.touchPosition.startX
const actualY = touchmoveY - this.touchPosition.startY

const elapsedTime = new Date() - this.swipeStartTime
const elapsedTime = new Date() - this.swipeStartTime

if (elapsedTime <= this.mdSwipeTime) {
if (Math.abs(actualX) >= this.mdSwipeThreshold && Math.abs(actualY) <= this.mdSwipeRestraint) {
this.swiped = actualX < 0
? 'left'
: 'right'
} else if (Math.abs(actualY) >= this.mdSwipeThreshold && Math.abs(actualX) <= this.mdSwipeRestraint) {
this.swiped = actualY < 0
? 'up'
: 'down'
if (elapsedTime <= this.mdSwipeTime) {
if (Math.abs(actualX) >= this.mdSwipeThreshold && Math.abs(actualY) <= this.mdSwipeRestraint) {
this.swiped = actualX < 0
? 'left'
: 'right'
} else if (Math.abs(actualY) >= this.mdSwipeThreshold && Math.abs(actualX) <= this.mdSwipeRestraint) {
this.swiped = actualY < 0
? 'up'
: 'down'
}
}
}
},
}, /* eslint-enable complexity */
handleTouchEnd () {
this.touchPosition = {
startX: 0,
Expand Down

0 comments on commit fb57db4

Please sign in to comment.