Skip to content

Commit fb57db4

Browse files
committed
feat: disable complexity rules for some methods
1 parent 96d3d8d commit fb57db4

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/components/MdApp/MdApp.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
})
3131
}
3232
33+
/* eslint-disable complexity */
3334
function buildSlots (children, context, functionalContext, options, createElement) {
3435
let slots = []
3536
3637
let hasDrawer = false
3738
3839
if (children) {
3940
children.forEach(child => {
40-
/* eslint-enable */
4141
const data = child.data
4242
const componentOptions = child.componentOptions
4343
@@ -75,6 +75,7 @@
7575
7676
return slots
7777
}
78+
/* eslint-enable complexity */
7879
7980
function getDrawers (children) {
8081
const drawerVnodes = children.filter(child => {

src/core/mixins/MdSwipeable/MdSwipeable.js

+18-19
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,30 @@ export default {
3636

3737
this.swipeStart = true
3838
},
39+
/* eslint-disable complexity */
3940
handleTouchMove (event) {
40-
if (!this.swipeStart) {
41-
return
42-
}
43-
44-
const touchmoveX = event.touches[0].screenX
45-
const touchmoveY = event.touches[0].screenY
41+
if (this.swipeStart) {
42+
const touchmoveX = event.touches[0].screenX
43+
const touchmoveY = event.touches[0].screenY
4644

47-
const actualX = touchmoveX - this.touchPosition.startX
48-
const actualY = touchmoveY - this.touchPosition.startY
45+
const actualX = touchmoveX - this.touchPosition.startX
46+
const actualY = touchmoveY - this.touchPosition.startY
4947

50-
const elapsedTime = new Date() - this.swipeStartTime
48+
const elapsedTime = new Date() - this.swipeStartTime
5149

52-
if (elapsedTime <= this.mdSwipeTime) {
53-
if (Math.abs(actualX) >= this.mdSwipeThreshold && Math.abs(actualY) <= this.mdSwipeRestraint) {
54-
this.swiped = actualX < 0
55-
? 'left'
56-
: 'right'
57-
} else if (Math.abs(actualY) >= this.mdSwipeThreshold && Math.abs(actualX) <= this.mdSwipeRestraint) {
58-
this.swiped = actualY < 0
59-
? 'up'
60-
: 'down'
50+
if (elapsedTime <= this.mdSwipeTime) {
51+
if (Math.abs(actualX) >= this.mdSwipeThreshold && Math.abs(actualY) <= this.mdSwipeRestraint) {
52+
this.swiped = actualX < 0
53+
? 'left'
54+
: 'right'
55+
} else if (Math.abs(actualY) >= this.mdSwipeThreshold && Math.abs(actualX) <= this.mdSwipeRestraint) {
56+
this.swiped = actualY < 0
57+
? 'up'
58+
: 'down'
59+
}
6160
}
6261
}
63-
},
62+
}, /* eslint-enable complexity */
6463
handleTouchEnd () {
6564
this.touchPosition = {
6665
startX: 0,

0 commit comments

Comments
 (0)