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