Skip to content

Commit

Permalink
* Fix some issues, update rules for Vue 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuEXE committed Oct 1, 2024
1 parent 67c6345 commit 8c61432
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 19 deletions.
6 changes: 6 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export default [
'vue/multi-word-component-names': 'off',
'vuejs-accessibility/no-onchange': 'off',

// rule for Vue 3.x , FT is on 2.x
'vue/no-v-for-template-key-on-child': 'off',
'vue/no-v-for-template-key': 'error',
// To be fixed on Vue 3 migration
'vue/no-deprecated-v-on-native-modifier': 'warn',

'vuejs-accessibility/label-has-for': ['error', {
required: {
some: ['nesting', 'id'],
Expand Down
6 changes: 3 additions & 3 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ function runApp() {
requestHeaders.Authorization = invidiousAuthorization.authorization
}
}
// eslint-disable-next-line n/no-callback-literal
callback({ requestHeaders })
})

Expand All @@ -466,7 +466,7 @@ function runApp() {
if (responseHeaders) {
delete responseHeaders['set-cookie']
}
// eslint-disable-next-line n/no-callback-literal
callback({ responseHeaders })
})

Expand Down Expand Up @@ -755,7 +755,7 @@ function runApp() {
// If called multiple times
// Duplicate menu items will be added
if (replaceMainWindow) {
// eslint-disable-next-line
setMenu()
}

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-icon-button/ft-icon-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default defineComponent({
window.addEventListener('resize', this.handleResize)
}
},
beforeDestroy: function () {
beforeUnmount: function () {
if (this.dropdownModalOnMobile) {
window.removeEventListener('resize', this.handleResize)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default defineComponent({
// User might want to search first if they have many playlists
nextTick(() => this.$refs.searchBar.focus())
},
beforeDestroy() {
beforeUnmount() {
document.removeEventListener('keydown', this.keyboardShortcutHandler)
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-prompt/ft-prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default defineComponent({
this.focusItem(0)
})
},
beforeDestroy: function () {
beforeUnmount: function () {
document.removeEventListener('keydown', this.closeEventFunction, true)
nextTick(() => this.lastActiveElement?.focus())
},
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-toast/ft-toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineComponent({
mounted: function () {
FtToastEvents.addEventListener('toast-open', this.open)
},
beforeDestroy: function () {
beforeUnmount: function () {
FtToastEvents.removeEventListener('toast-open', this.open)
},
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export default defineComponent({
this.setCurrentInvidiousInstanceBounce =
debounce(this.setCurrentInvidiousInstance, 500)
},
beforeDestroy: function () {
beforeUnmount: function () {
if (this.currentInvidiousInstance === '') {
// FIXME: If we call an action from here, there's no guarantee it will finish
// before the component is destroyed, which could bring up some problems
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export default defineComponent({
mounted: function () {
document.addEventListener('keydown', this.keyboardShortcutHandler)
},
beforeDestroy: function () {
beforeUnmount: function () {
document.removeEventListener('keydown', this.keyboardShortcutHandler)
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/proxy-settings/proxy-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default defineComponent({
created: function () {
this.debounceEnableProxy = debounce(this.enableProxy, 200)
},
beforeDestroy: function () {
beforeUnmount: function () {
if (this.proxyHostname === '') {
this.updateProxyHostname('127.0.0.1')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default defineComponent({
mounted: function () {
document.addEventListener('keydown', this.keyboardShortcutHandler)
},
beforeDestroy: function () {
beforeUnmount: function () {
document.removeEventListener('keydown', this.keyboardShortcutHandler)
},
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default defineComponent({
return this.watchingCount !== null ? formatNumber(this.watchingCount) : '0'
}
},
beforeDestroy: function () {
beforeUnmount: function () {
this.hasEnded = true
this.liveChatInstance?.stop()
this.liveChatInstance = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export default defineComponent({
navigator.mediaSession.setActionHandler('nexttrack', this.playNextVideo)
}
},
beforeDestroy: function () {
beforeUnmount: function () {
if ('mediaSession' in navigator) {
navigator.mediaSession.setActionHandler('previoustrack', null)
navigator.mediaSession.setActionHandler('nexttrack', null)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/History/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default defineComponent({

this.filterHistoryDebounce = debounce(this.filterHistory, 500)
},
beforeDestroy: function () {
beforeUnmount: function () {
document.removeEventListener('keydown', this.keyboardShortcutHandler)
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Playlist/Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export default defineComponent({
this.handleResize()
window.addEventListener('resize', this.handleResize)
},
beforeDestroy: function () {
beforeUnmount: function () {
window.removeEventListener('resize', this.handleResize)
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Popular/Popular.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineComponent({
this.fetchPopularInfo()
}
},
beforeDestroy: function () {
beforeUnmount: function () {
document.removeEventListener('keydown', this.keyboardShortcutHandler)
},
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default defineComponent({
document.addEventListener('keydown', this.keyboardShortcutHandler)
this.getSubscription()
},
beforeDestroy: function () {
beforeUnmount: function () {
document.removeEventListener('keydown', this.keyboardShortcutHandler)
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Trending/Trending.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default defineComponent({
this.getTrendingInfo()
}
},
beforeDestroy: function () {
beforeUnmount: function () {
document.removeEventListener('keydown', this.keyboardShortcutHandler)
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/UserPlaylists/UserPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default defineComponent({

this.filterPlaylistDebounce = debounce(this.filterPlaylist, 500)
},
beforeDestroy: function () {
beforeUnmount: function () {
document.removeEventListener('keydown', this.keyboardShortcutHandler)
},
methods: {
Expand Down

0 comments on commit 8c61432

Please sign in to comment.