Commit 4ec77c33 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

META: add additional linter rules and autofixes

New linter rules:
* curly
* block-spacing
* keyword-spacing

Also apply all autofixes introduced by these rules
parent bcaa0446
......@@ -36,7 +36,10 @@
"eslint:recommended"
],
"rules": {
"no-console": "off"
"no-console": "off",
"curly": "error",
"block-spacing": "error",
"keyword-spacing": "error"
},
"parserOptions": {
"parser": "babel-eslint"
......
......@@ -65,8 +65,8 @@ export default {
},
computed: {
modules: function () {
if (this.user.logged_in === true) return this.modules_logged_in
else return this.modules_logged_out
if (this.user.logged_in === true) { return this.modules_logged_in }
else { return this.modules_logged_out }
}
},
mounted () {
......
......@@ -548,8 +548,8 @@ export default {
if (this.mode !== mode) {
this.mode = mode
for (var b in this.button) {
if (b === mode) this.button[b] = 'info'
else this.button[b] = 'outline-info'
if (b === mode) { this.button[b] = 'info' }
else { this.button[b] = 'outline-info' }
}
}
},
......
......@@ -655,7 +655,7 @@ export default {
var arr = []
for (var i in this.current.timeslots) {
var note = this.getNoteByTimeslotID(this.current.timeslots[i].id)
if (note !== null) note = note.title
if (note !== null) { note = note.title }
arr.push({
title: note,
starts: this.prettyDateTime(this.current.timeslots[i].start),
......@@ -727,10 +727,10 @@ export default {
this.currentShowID = this.shows[this.currentShow].id
// and check if images are available and set image strings, because we
// cannot use them directly inside the b-img if they are null
if (this.shows[this.currentShow].logo === null) this.current.logo = ''
else this.current.logo = this.shows[this.currentShow].logo
if (this.shows[this.currentShow].image === null) this.current.image = ''
else this.current.image = this.shows[this.currentShow].image
if (this.shows[this.currentShow].logo === null) { this.current.logo = '' }
else { this.current.logo = this.shows[this.currentShow].logo }
if (this.shows[this.currentShow].image === null) { this.current.image = '' }
else { this.current.image = this.shows[this.currentShow].image }
// before we load timeslots and notes, we want to fetch the general settings first
this.getCategories()
this.getHosts()
......@@ -745,10 +745,10 @@ export default {
getTimeslots: function (start, end, limit, offset) {
var dateRegex = new RegExp('^\\d{4}-\\d{2}-\\d{2}$')
var uri = process.env.VUE_APP_API_STEERING_SHOWS + this.currentShowID + '/timeslots/?'
if (dateRegex.test(start)) uri += 'start=' + start + '&'
if (dateRegex.test(end)) uri += 'end=' + end + '&'
if (!isNaN(parseInt(limit))) uri += 'limit=' + parseInt(limit) + '&'
if (!isNaN(parseInt(offset))) uri += 'offset=' + parseInt(offset)
if (dateRegex.test(start)) { uri += 'start=' + start + '&' }
if (dateRegex.test(end)) { uri += 'end=' + end + '&' }
if (!isNaN(parseInt(limit))) { uri += 'limit=' + parseInt(limit) + '&' }
if (!isNaN(parseInt(offset))) { uri += 'offset=' + parseInt(offset) }
this.loaded.timeslots = false
this.loaded.notes = false
axios.get(uri, {
......@@ -833,9 +833,9 @@ export default {
}
},
prettyTitle: function (title) {
if (title === '') return '...'
else if (title.length > 25) return title.slice(0, 25) + '...'
else return title
if (title === '') { return '...' }
else if (title.length > 25) { return title.slice(0, 25) + '...' }
else { return title }
},
// TODO: all thos getSomething functions could be probably merged into one
// generic getItem function. Maybe this.current should be an associative array
......@@ -857,7 +857,7 @@ export default {
alert('There was an error fetching categories from the server: ' + error)
})
}
if (!loadingError) this.loaded.categories = true
if (!loadingError) { this.loaded.categories = true }
}
},
getHosts: function () {
......@@ -877,7 +877,7 @@ export default {
alert('There was an error fetching hosts from the server: ' + error)
})
}
if (!loadingError) this.loaded.hosts = true
if (!loadingError) { this.loaded.hosts = true }
}
},
getLanguages: function () {
......@@ -897,7 +897,7 @@ export default {
alert('There was an error fetching languages from the server: ' + error)
})
}
if (!loadingError) this.loaded.languages = true
if (!loadingError) { this.loaded.languages = true }
}
},
getTopics: function () {
......@@ -917,7 +917,7 @@ export default {
alert('There was an error fetching topics from the server: ' + error)
})
}
if (!loadingError) this.loaded.topics = true
if (!loadingError) { this.loaded.topics = true }
}
},
getMusicfocus: function () {
......@@ -938,7 +938,7 @@ export default {
})
}
}
if (!loadingError) this.loaded.musicfocus = true
if (!loadingError) { this.loaded.musicfocus = true }
},
getFundingCategory: function () {
this.current.fundingcategory = []
......@@ -956,7 +956,7 @@ export default {
alert('There was an error fetching funding category from the server: ' + error)
})
}
if (!loadingError) this.loaded.fundingcategory = true
if (!loadingError) { this.loaded.fundingcategory = true }
},
getType: function () {
this.current.type = []
......@@ -974,7 +974,7 @@ export default {
alert('There was an error fetching show type from the server: ' + error)
})
}
if (!loadingError) this.loaded.type = true
if (!loadingError) { this.loaded.type = true }
},
notYetImplemented: function () {
alert('By the mighty witchcraftry of the mother of time!\n\nThis feature is not implemented yet.')
......
......@@ -781,8 +781,8 @@ export default {
},
saveLogo (event) {
event.preventDefault()
if (this.file === null) alert('Please provide a file to upload')
else if (this.file.type !== 'image/jpeg' && this.file.type !== 'image/png') alert('Please provide a valid image file (JPEG or PNG)')
if (this.file === null) { alert('Please provide a file to upload') }
else if (this.file.type !== 'image/jpeg' && this.file.type !== 'image/png') { alert('Please provide a valid image file (JPEG or PNG)') }
else {
let formData = new FormData()
this.backupstring = this.string
......@@ -975,15 +975,15 @@ export default {
this.$refs.modalShowHosts.show()
},
showLogo () {
if (this.show.logo === null) this.string = ''
else this.string = this.show.logo
if (this.show.logo === null) { this.string = '' }
else { this.string = this.show.logo }
this.file = null
this.$refs.fileinputLogo.reset()
this.$refs.modalLogo.show()
},
showImage () {
if (this.show.image === null) this.string = ''
else this.string = this.show.image
if (this.show.image === null) { this.string = '' }
else { this.string = this.show.image }
this.file = null
this.$refs.fileinputImage.reset()
this.$refs.modalImage.show()
......
function leadingZero (num) {
if (num < 10) return '0' + num
else return num.toString()
if (num < 10) { return '0' + num }
else { return num.toString() }
}
var day = [
......
function compareEpisodesByDate (a, b) {
var dateA = new Date(a.start)
var dateB = new Date(b.start)
if (dateA < dateB) return -1
else if (dateA > dateB) return 1
else return 0
if (dateA < dateB) { return -1 }
else if (dateA > dateB) { return 1 }
else { return 0 }
}
export default {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment