Skip to content

Commit

Permalink
refactor(lint): fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dolymood committed Nov 7, 2019
1 parent 63f524f commit e55bbfe
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 63 deletions.
6 changes: 3 additions & 3 deletions example/data/ease.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export const ease = {
// easeOutQuint
// easeOutQuint
swipe: {
style: 'cubic-bezier(0.23, 1, 0.32, 1)',
fn: function (t) {
return 1 + (--t * t * t * t * t)
}
},
// easeOutQuard
// easeOutQuard
swipeBounce: {
style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
fn: function (t) {
return t * (2 - t)
}
},
// easeOutQuart
// easeOutQuart
bounce: {
style: 'cubic-bezier(0.165, 0.84, 0.44, 1)',
fn: function (t) {
Expand Down
46 changes: 13 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/common/helpers/debug.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const warn = function (msg, componentName) {
/* istanbul ignore if */
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production') {
const component = componentName ? `<${componentName}> ` : ''
console.error(`[Cube warn]: ${component}${msg}`)
Expand Down
4 changes: 2 additions & 2 deletions src/common/helpers/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function processComponentName(Component, { prefix = '', firstUpperCase = false }
const name = Component.name
const pureName = name.replace(/^cube-/i, '')
let camelizeName = `${camelize(`${prefix}${pureName}`)}`
/* istanbul ignore if */
/* istanbul ignore if */
if (firstUpperCase) {
camelizeName = camelizeName.charAt(0).toUpperCase() + camelizeName.slice(1)
}
Expand All @@ -170,7 +170,7 @@ function parsePath (obj, path = '') {
let result = obj
for (let i = 0; i < segments.length; i++) {
const key = segments[i]
/* istanbul ignore if */
/* istanbul ignore if */
if (isUndef(result[key])) {
result = ''
break
Expand Down
6 changes: 4 additions & 2 deletions src/common/lang/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ function formatType(type, format, value, regExpAttributes) {

if (new RegExp(regExpMap[type], regExpAttributes).test(format)) {
const replaceStr = type === 'year'
? value.toString().substr(4 - RegExp.$1.length)
: (RegExp.$1.length === 1) ? value : pad(value)
? value.toString().substr(4 - RegExp.$1.length)
: (RegExp.$1.length === 1)
? value
: pad(value)
format = format.replace(RegExp.$1, replaceStr)
}

Expand Down
12 changes: 6 additions & 6 deletions src/components/date-picker/date-picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,18 @@
},
minArray() {
return this.min instanceof Date
? dateToArray(this.min).slice(this.startIndex, this.startIndex + this.columnCount)
: this.min
? dateToArray(this.min).slice(this.startIndex, this.startIndex + this.columnCount)
: this.min
},
maxArray() {
return this.max instanceof Date
? dateToArray(this.max).slice(this.startIndex, this.startIndex + this.columnCount)
: this.max
? dateToArray(this.max).slice(this.startIndex, this.startIndex + this.columnCount)
: this.max
},
valueArray() {
return this.value instanceof Date
? dateToArray(this.value).slice(this.startIndex, this.startIndex + this.columnCount)
: this.value
? dateToArray(this.value).slice(this.startIndex, this.startIndex + this.columnCount)
: this.value
},
data() {
const data = []
Expand Down
10 changes: 6 additions & 4 deletions src/components/time-picker/time-picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,17 @@
// calculate hourIndex
const hour = valueDate.getHours()
const beginHour = dayIndex === 0
? this.showNow ? this.minTime.getHours() - 1 : this.minTime.getHours()
: 0
? this.showNow
? this.minTime.getHours() - 1
: this.minTime.getHours()
: 0
const hourIndex = hour - beginHour
// calculate minuteIndex
const minute = this.minuteStepRule(valueDate.getMinutes() / this.minuteStepNumber)
const beginMinute = !dayIndex && (this.showNow ? hourIndex === 1 : !hourIndex)
? this.minuteStepRule(this.minTime.getMinutes() / this.minuteStepNumber)
: 0
? this.minuteStepRule(this.minTime.getMinutes() / this.minuteStepNumber)
: 0
const minuteIndex = minute - beginMinute
this.selectedIndex = [dayIndex, hourIndex, minuteIndex]
Expand Down
8 changes: 4 additions & 4 deletions src/components/validator/validator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@
this.validating = false
results.forEach(({ key, valid, ret }) => {
const msg = this.messages[key]
? isFunc(this.messages[key])
? this.messages[key](ret, valid)
: this.messages[key]
: this.findMessage(key, configRules[key], configRules.type, model)
? isFunc(this.messages[key])
? this.messages[key](ret, valid)
: this.messages[key]
: this.findMessage(key, configRules[key], configRules.type, model)
if (isValid && !valid) {
isValid = false
this.msg = msg
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/image-preview.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ describe('ImagePreview', () => {
// but becomes false in the same tick in safari
vm.$nextTick(() => {
expect(itemScroll.enabled)
.to.be.false
.to.be.false
})
expect(slideScroll.enabled)
.to.be.true
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/locale.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Locale', () => {
Locale.use('en-US', enUSMessages)
vm.$nextTick(() => {
expect(vm._cancelTxt)
.to.equal('Cancel')
.to.equal('Cancel')
done()
})
})
Expand Down
10 changes: 7 additions & 3 deletions test/unit/specs/radio.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,13 @@ function createRadioGroup(horizontal = false) {
function createUserDefaltSlotRadioGroup(vModelGroup = true) {
const vm = createVue({
template: `
<cube-radio-group ${
vModelGroup ? `v-model="selected"` : ''
} :options="options" class="my-radio" position="right" :horizontal="true">
<cube-radio-group
${vModelGroup ? `v-model="selected"` : ''}
:options="options"
class="my-radio"
position="right"
:horizontal="true"
>
<cube-radio
v-for="(option, idx) in options"
:key="idx"
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/recycle-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('RecycleList', () => {
it('requires onFetch function to return a Promise', () => {
vm = createRecycleList()
expect(vm.onFetch() instanceof window.Promise)
.to.equal(true)
.to.equal(true)
})
it('render correct count data', (done) => {
vm = createRecycleList(true)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/toast.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('Toast', () => {
expect(ins.$el.className)
.to.include('my-toast')
expect(ins.$el.querySelector('.cube-toast-tip').textContent)
.to.equal('toast api content')
.to.equal('toast api content')
ins.remove()
expect(ins.$el.parentElement)
.to.be.null
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/validator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Validator', () => {
const msgEl = el.querySelector('.cube-validator-msg-def')
setTimeout(() => {
expect(el.className)
.to.include('cube-validator_invalid')
.to.include('cube-validator_invalid')
expect(msgEl.textContent)
.to.equal('必填')
expect(vm.result.asyncRule.valid)
Expand Down

0 comments on commit e55bbfe

Please sign in to comment.