Skip to content

Commit

Permalink
fix linter spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
solderq35 committed Dec 18, 2023
1 parent 9feaa7c commit 2910fcb
Show file tree
Hide file tree
Showing 30 changed files with 296 additions and 288 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
'generator-star-spacing': 'off',
camelcase: [0, { properties: 'never' }],
'vue/no-use-v-if-with-v-for': 'off',
'space-in-parens': [1, 'always']
'space-in-parens': [1, 'never']
},
parserOptions: {
parser: 'babel-eslint'
Expand Down
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export default {
},
created () {
// Update user variables (if logged in)
this.$store.dispatch( 'user/setUserVars' )
this.$store.dispatch('user/setUserVars')

// Download the cc categories and questions
this.$store.dispatch( 'calculator/downloadCategories' )
this.$store.dispatch('calculator/downloadCategories')
},
data () {
return {
Expand Down
34 changes: 17 additions & 17 deletions src/components/administration/historicalDataDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,26 @@ export default {
},
tableData () {
let data = []
this.histData.forEach( ( entry ) => {
data.push( {
this.histData.forEach((entry) => {
data.push({
date: entry.date,
transportation: entry.totals[0],
consumption: entry.totals[1],
energyAndHeating: entry.totals[2],
food: entry.totals[3],
water: entry.totals[4],
waste: entry.totals[5]
} )
} )
})
})
return data
}
},
methods: {
handleDelete ( row ) {
this.$store.commit( 'user/removeHistData', row )
UserApi.deleteHistData( row )
handleDelete (row) {
this.$store.commit('user/removeHistData', row)
UserApi.deleteHistData(row)
},
confirmDeletion ( row ) {
confirmDeletion (row) {
this.$confirm(
'This will permanently delete your results from ' +
this.$store.getters['user/data'][row].date +
Expand All @@ -94,19 +94,19 @@ export default {
type: 'warning'
}
)
.then( () => {
this.$message( {
.then(() => {
this.$message({
type: 'success',
message: 'Deleted data.'
} )
this.handleDelete( row )
} )
.catch( () => {
this.$message( {
})
this.handleDelete(row)
})
.catch(() => {
this.$message({
type: 'info',
message: 'Delete canceled.'
} )
} )
})
})
}
}
}
Expand Down
38 changes: 23 additions & 15 deletions src/components/administration/oldDataDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default {
tableData () {
let data = []
this.histData.forEach((entry, index) => {
if (index >== data.length - 2) {
if (index >= data.length - 2) {
data.push({
date: entry.date,
transportation: entry.totals[0],
Expand All @@ -85,22 +85,30 @@ export default {
UserApi.deleteHistData(row)
},
confirmDeletion (row) {
this.$confirm('This will permanently delete your results from ' + this.$store.getters['user/data'][row].date + '. Continue?', 'Warning', {
confirmButtonText: 'Delete',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: 'Deleted data.'
this.$confirm(
'This will permanently delete your results from ' +
this.$store.getters['user/data'][row].date +
'. Continue?',
'Warning',
{
confirmButtonText: 'Delete',
cancelButtonText: 'Cancel',
type: 'warning'
}
)
.then(() => {
this.$message({
type: 'success',
message: 'Deleted data.'
})
this.handleDelete(row)
})
this.handleDelete(row)
}).catch(() => {
this.$message({
type: 'info',
message: 'Delete canceled.'
.catch(() => {
this.$message({
type: 'info',
message: 'Delete canceled.'
})
})
})
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/components/calculator/calcCarousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ export default {
}
},
methods: {
setFocus ( newSlideIndex, oldSlideIndex ) {
setFocus (newSlideIndex, oldSlideIndex) {
let scope = this
let carousel = document.querySelector( '.carousel' )
let carousel = document.querySelector('.carousel')

// Listen for the "transitioned" event on the carousel element
if ( carousel ) {
if (carousel) {
carousel.addEventListener(
'transitioned',
function () {
Expand All @@ -176,18 +176,18 @@ export default {
)

// Update the carousel index
this.$nextTick( () => {
this.$refs.carousel.setSlide( newSlideIndex )
} )
this.$nextTick(() => {
this.$refs.carousel.setSlide(newSlideIndex)
})
}
}
},
watch: {
studentType () {
this.$store.commit( {
this.$store.commit({
type: 'user/setStudentType',
newType: this.studentType
} )
})
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/components/calculator/calcDesktop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export default {
return this.$store.getters['calculator/categories']
},
determineTitle () {
if ( this.currentTitle === 0 ) return 'About the Calculator'
else if ( this.currentTitle === 6 ) return 'Waste'
if (this.currentTitle === 0) return 'About the Calculator'
else if (this.currentTitle === 6) return 'Waste'
else return this.categories[this.currentTitle - 1].title // Subtract 1 to remove the Introduction from the calculation
},
progressPercentage () {
return ( this.currentTitle / 6 ) * 100
return (this.currentTitle / 6) * 100
}
},
data () {
Expand All @@ -104,7 +104,7 @@ export default {
},
methods: {
next () {
if ( this.$refs.calcCarousel.$refs.carousel.activeIndex === 0 ) {
if (this.$refs.calcCarousel.$refs.carousel.activeIndex === 0) {
this.lastSlide = true
this.openOffsetsDialog()
} else {
Expand All @@ -113,17 +113,17 @@ export default {
}
},
prev () {
if ( this.lastSlide ) {
if (this.lastSlide) {
this.lastSlide = false
} else {
this.currentTitle--
this.$refs.calcCarousel.$refs.carousel.prev()
}
},
setFocus ( newSlideIndex, oldSlideIndex ) {
setFocus (newSlideIndex, oldSlideIndex) {
let scope = this
let carousel = document.querySelector( '.carousel' )
if ( carousel ) {
let carousel = document.querySelector('.carousel')
if (carousel) {
// Listen for the "transitioned" event on the carousel element
carousel.addEventListener(
'transitioned',
Expand All @@ -134,9 +134,9 @@ export default {
)

// Update the carousel index
this.$nextTick( () => {
this.$refs.carousel.setSlide( newSlideIndex )
} )
this.$nextTick(() => {
this.$refs.carousel.setSlide(newSlideIndex)
})
}
},
// This method opens the "carbon offsets" dialog when the calculator reaches its final page.
Expand All @@ -149,12 +149,12 @@ export default {
cancelButtonText: 'No Thanks',
dangerouslyUseHTMLString: true
}
).then( () => {
).then(() => {
window.open(
'https://fa.oregonstate.edu/sustainability/carbon-offsets-osu-funded-travel',
'_blank'
)
} )
})
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/components/calculator/calcMobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ export default {
return this.$store.getters['calculator/categories'].length < 1
},
determineTitle () {
if ( this.currentTitle === 0 ) return 'About the Calculator'
else if ( this.currentTitle === 6 ) return 'Waste'
if (this.currentTitle === 0) return 'About the Calculator'
else if (this.currentTitle === 6) return 'Waste'
else return this.categories[this.currentTitle - 1].title // Subtract 1 to remove the Introduction from the calculation
},
progressPercentage () {
return ( this.currentTitle / 6 ) * 100
return (this.currentTitle / 6) * 100
}
},
data () {
Expand All @@ -105,26 +105,26 @@ export default {
},
methods: {
next () {
if ( this.$refs.calcCarousel.$refs.carousel.activeIndex === 0 ) {
if (this.$refs.calcCarousel.$refs.carousel.activeIndex === 0) {
this.chartsVisible = true
} else {
this.currentTitle++
this.$refs.calcCarousel.$refs.carousel.next()
}
},
prev () {
if ( this.chartsVisible ) {
if (this.chartsVisible) {
this.chartsVisible = false
} else {
this.currentTitle--
this.$refs.calcCarousel.$refs.carousel.prev()
}
},
setFocus ( newSlideIndex, oldSlideIndex ) {
setFocus (newSlideIndex, oldSlideIndex) {
let scope = this
let carousel = document.querySelector( '.carousel' )
let carousel = document.querySelector('.carousel')

if ( carousel ) {
if (carousel) {
// Listen for the "transitioned" event on the carousel element
carousel.addEventListener(
'transitioned',
Expand All @@ -135,9 +135,9 @@ export default {
)

// Update the carousel index
this.$nextTick( () => {
this.$refs.carousel.setSlide( newSlideIndex )
} )
this.$nextTick(() => {
this.$refs.carousel.setSlide(newSlideIndex)
})
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/components/calculator/graphs/chartComponents/barChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ export default {
fontFamily: 'Open Sans',
padding: 20
},
onHover: function ( e ) {
onHover: function (e) {
e.target.style.cursor = 'pointer'
}
},
hover: {
onHover: function ( e ) {
onHover: function (e) {
e.target.style.cursor = 'default'
}
},
Expand All @@ -76,10 +76,10 @@ export default {
bodyFontFamily: 'Open Sans',
cornerRadius: 4,
callbacks: {
label: ( item ) => {
label: (item) => {
return this.resultsToggle
? parseFloat( item.yLabel ).toFixed( 1 ) + ' kgCO2e'
: parseFloat( item.yLabel ).toFixed( 1 ) + '%'
? parseFloat(item.yLabel).toFixed(1) + ' kgCO2e'
: parseFloat(item.yLabel).toFixed(1) + '%'
}
}
}
Expand Down Expand Up @@ -170,18 +170,18 @@ export default {
this.chartdata.datasets[0].data,
this.dataObj.transportation
)
Object.assign( this.chartdata.datasets[1].data, this.dataObj.consumption )
Object.assign(this.chartdata.datasets[1].data, this.dataObj.consumption)
Object.assign(
this.chartdata.datasets[2].data,
this.dataObj.energyAndHeating
)
Object.assign( this.chartdata.datasets[3].data, this.dataObj.food )
Object.assign( this.chartdata.datasets[4].data, this.dataObj.water )
Object.assign(this.chartdata.datasets[3].data, this.dataObj.food)
Object.assign(this.chartdata.datasets[4].data, this.dataObj.water)
}
},
mounted () {
this.assignStackedData()
this.renderChart( this.chartdata, this.options )
this.renderChart(this.chartdata, this.options)
},
watch: {
dataObj () {
Expand Down
Loading

0 comments on commit 2910fcb

Please sign in to comment.