Skip to content

Remove console.logs #2606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ module.exports = {
plugins: ['vue'],

rules: {
'space-before-function-paren': 0,
'space-before-function-paren': 'off',
'comma-dangle': ['error', 'never'],
'vue/no-v-html': 'off',
'no-console': 0,
'no-unused-vars': 1,
'no-undef': 1,
'vue/no-template-key': 1
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-unused-vars': 'warn',
'no-undef': 'warn',
'vue/no-template-key': 'warn'
}
}
9 changes: 2 additions & 7 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { IpcChannels, DBActions, SyncEvents } from '../constants'
import baseHandlers from '../datastores/handlers/base'

if (process.argv.includes('--version')) {
console.log(`v${app.getVersion()}`)
app.exit()
} else {
runApp()
Expand Down Expand Up @@ -172,7 +171,7 @@ function runApp() {
require('vue-devtools').install()
/* eslint-enable */
} catch (err) {
console.log(err)
console.error(err)
}
}

Expand All @@ -195,7 +194,7 @@ function runApp() {
return nativeTheme.shouldUseDarkColors ? '#212121' : '#f1f1f1'
}
}).catch((error) => {
console.log(error)
console.error(error)
// Default to nativeTheme settings if nothing is found.
return nativeTheme.shouldUseDarkColors ? '#212121' : '#f1f1f1'
})
Expand Down Expand Up @@ -258,7 +257,6 @@ function runApp() {

const boundsDoc = await baseHandlers.settings._findBounds()
if (typeof boundsDoc?.value === 'object') {
console.log({ boundsDoc })
const { maximized, fullScreen, ...bounds } = boundsDoc.value
const allDisplaysSummaryWidth = screen
.getAllDisplays()
Expand Down Expand Up @@ -348,8 +346,6 @@ function runApp() {
// Which raises "Object has been destroyed" error
mainWindow = allWindows[0]
}

console.log('closed')
})
}

Expand Down Expand Up @@ -401,7 +397,6 @@ function runApp() {
})

ipcMain.on(IpcChannels.ENABLE_PROXY, (_, url) => {
console.log(url)
session.defaultSession.setProxy({
proxyRules: url
})
Expand Down
4 changes: 0 additions & 4 deletions src/renderer/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ export default Vue.extend({
this.grabAllPlaylists()

if (process.env.IS_ELECTRON) {
console.log('User is using Electron')
ipcRenderer = require('electron').ipcRenderer
this.setupListenersToSyncWindows()
this.activateKeyboardShortcuts()
Expand Down Expand Up @@ -194,11 +193,8 @@ export default Vue.extend({
},

updateTheme: function (theme) {
console.group('updateTheme')
console.log('Theme: ', theme)
document.body.className = `${theme.baseTheme} main${theme.mainColor} sec${theme.secColor}`
document.body.dataset.systemTheme = this.systemTheme
console.groupEnd()
},

checkForNewUpdates: function () {
Expand Down
9 changes: 4 additions & 5 deletions src/renderer/components/data-settings/data-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,7 @@ export default Vue.extend({
}
})
}).catch((err) => {
console.log(err)
console.log('error reading')
console.error(err)
const message = this.$t('Settings.Data Settings.Invalid subscriptions file')
this.showToast({
message: `${message}: ${err}`
Expand Down Expand Up @@ -946,7 +945,7 @@ export default Vue.extend({
this.handleFreetubeImportFile(dbLocation)
fs.unlink(dbLocation, (err) => {
if (err) {
console.log(err)
console.error(err)
}
})
},
Expand Down Expand Up @@ -1285,7 +1284,7 @@ export default Vue.extend({
this.invidiousAPICall(subscriptionsPayload).then((response) => {
resolve(response)
}).catch((err) => {
console.log(err)
console.error(err)
const errorMessage = this.$t('Invidious API Error (Click to copy)')
this.showToast({
message: `${errorMessage}: ${err.responseJSON.error}`,
Expand All @@ -1312,7 +1311,7 @@ export default Vue.extend({
ytch.getChannelInfo({ channelId: channelId }).then(async (response) => {
resolve(response)
}).catch((err) => {
console.log(err)
console.error(err)
const errorMessage = this.$t('Local API Error (Click to copy)')
this.showToast({
message: `${errorMessage}: ${err}`,
Expand Down
7 changes: 0 additions & 7 deletions src/renderer/components/ft-list-dropdown/ft-list-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,5 @@ export default Vue.extend({
listType: function () {
return this.$store.getters.getListType
}
},
mounted: function () {
},
methods: {
goToChannel: function () {
console.log('TODO: ft-list-channel method goToChannel')
}
}
})
3 changes: 0 additions & 3 deletions src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,6 @@ export default Vue.extend({
},

handleOptionsClick: function (option) {
console.log('Handling share')
console.log(option)

switch (option) {
case 'history':
if (this.watched) {
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/components/ft-profile-edit/ft-profile-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ export default Vue.extend({
profile._id = this.profileId
}

console.log(profile)

if (this.isNew) {
this.createProfile(profile)
this.showToast({
Expand Down
10 changes: 3 additions & 7 deletions src/renderer/components/ft-video-player/ft-video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default Vue.extend({
try {
return JSON.parse(this.$store.getters.getDefaultCaptionSettings)
} catch (e) {
console.log(e)
console.error(e)
return {}
}
},
Expand Down Expand Up @@ -343,7 +343,6 @@ export default Vue.extend({
},
methods: {
initializePlayer: async function () {
console.log(this.adaptiveFormats)
const videoPlayer = document.getElementById(this.id)
if (videoPlayer !== null) {
if (!this.useDash) {
Expand Down Expand Up @@ -1034,7 +1033,7 @@ export default Vue.extend({

enableDashFormat: function () {
if (this.dashSrc === null) {
console.log('No dash format available.')
console.warn('No dash format available.')
return
}

Expand All @@ -1047,7 +1046,7 @@ export default Vue.extend({

enableLegacyFormat: function () {
if (this.sourceList.length === 0) {
console.log('No sources available')
console.error('No sources available')
return
}

Expand Down Expand Up @@ -1112,7 +1111,6 @@ export default Vue.extend({
const frameTime = 1 / fps
const dist = frameTime * step
this.player.currentTime(this.player.currentTime() + dist)
console.log(fps)
},

changeVolume: function (volume) {
Expand Down Expand Up @@ -1427,7 +1425,6 @@ export default Vue.extend({
VjsButton.call(this, player, options)
},
handleClick: (event) => {
console.log(event)
const selectedQuality = event.target.innerText
const bitrate = selectedQuality === 'auto' ? 'auto' : parseInt(event.target.attributes.bitrate.value)
this.setDashQualityLevel(bitrate)
Expand Down Expand Up @@ -1685,7 +1682,6 @@ export default Vue.extend({
clearTimeout(this.touchPauseTimeout)
},
toggleShowStatsModal: function() {
console.log(this.format)
if (this.format !== 'dash') {
this.showToast({
message: this.$t('Video.Stats.Video statistics are not available for legacy videos')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ export default Vue.extend({

handlePreferredApiBackend: function (backend) {
this.updateBackendPreference(backend)
console.log(backend)

if (backend === 'local') {
this.updateForceLocalBackendForLegacy(false)
Expand Down
1 change: 0 additions & 1 deletion src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export default Vue.extend({
}
},
mounted: function () {
console.log(this.data)
this.id = this.data.id
this.firstVideoId = this.data.firstVideoId
this.title = this.data.title
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ export default Vue.extend({
this.invidiousAPICall(searchPayload).then((results) => {
this.searchSuggestionsDataList = results.suggestions
}).catch((err) => {
console.log(err)
console.error(err)
if (this.backendFallback) {
console.log(
console.error(
'Error gettings search suggestions. Falling back to Local API'
)
this.getSearchSuggestionsLocal(query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export default Vue.extend({
ytcm.getComments(payload).then((response) => {
this.parseLocalCommentData(response, null)
}).catch((err) => {
console.log(err)
console.error(err)
const errorMessage = this.$t('Local API Error (Click to copy)')
this.showToast({
message: `${errorMessage}: ${err}`,
Expand Down Expand Up @@ -217,7 +217,7 @@ export default Vue.extend({
ytcm.getCommentReplies(payload).then((response) => {
this.parseLocalCommentData(response, payload.index)
}).catch((err) => {
console.log(err)
console.error(err)
const errorMessage = this.$t('Local API Error (Click to copy)')
this.showToast({
message: `${errorMessage}: ${err}`,
Expand Down Expand Up @@ -332,8 +332,7 @@ export default Vue.extend({
this.isLoading = false
this.showComments = true
}).catch((xhr) => {
console.log('found an error')
console.log(xhr)
console.error(xhr)
const errorMessage = this.$t('Invidious API Error (Click to copy)')
this.showToast({
message: `${errorMessage}: ${xhr.responseText}`,
Expand Down Expand Up @@ -389,8 +388,7 @@ export default Vue.extend({
this.commentData[index].showReplies = true
this.isLoading = false
}).catch((xhr) => {
console.log('found an error')
console.log(xhr)
console.error(xhr)
const errorMessage = this.$t('Invidious API Error (Click to copy)')
this.showToast({
message: `${errorMessage}: ${xhr.responseText}`,
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/components/watch-video-info/watch-video-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Vue from 'vue'
import { mapActions } from 'vuex'
import FtCard from '../ft-card/ft-card.vue'
import FtButton from '../ft-button/ft-button.vue'
import FtListDropdown from '../ft-list-dropdown/ft-list-dropdown.vue'
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue'
import FtIconButton from '../ft-icon-button/ft-icon-button.vue'
import FtShareButton from '../ft-share-button/ft-share-button.vue'
Expand All @@ -14,7 +13,6 @@ export default Vue.extend({
components: {
'ft-card': FtCard,
'ft-button': FtButton,
'ft-list-dropdown': FtListDropdown,
'ft-flex-box': FtFlexBox,
'ft-icon-button': FtIconButton,
'ft-share-button': FtShareButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export default Vue.extend({
} else {
switch (this.backendPreference) {
case 'local':
console.log('Getting Chat')
this.getLiveChatLocal()
break
case 'invidious':
Expand Down Expand Up @@ -115,13 +114,12 @@ export default Vue.extend({
this.isLoading = false

this.liveChat.on('start', (liveId) => {
console.log('Live chat is enabled')
this.isLoading = false
})

this.liveChat.on('end', (reason) => {
console.log('Live chat has ended')
console.log(reason)
console.error('Live chat has ended')
console.error(reason)
this.hasError = true
this.showEnableChat = false
this.errorMessage = this.$t('Video["Chat is disabled or the Live Stream has ended."]')
Expand All @@ -141,8 +139,6 @@ export default Vue.extend({
},

parseLiveChatComment: function (comment) {
console.log(comment)

if (this.hasEnded) {
return
}
Expand Down Expand Up @@ -171,13 +167,12 @@ export default Vue.extend({
const liveChatMessage = $('.liveChatMessage')

if (typeof (liveChatComments.get(0)) === 'undefined' && typeof (liveChatMessage.get(0)) === 'undefined') {
console.log("Can't find chat object. Stopping chat connection")
console.error("Can't find chat object. Stopping chat connection")
this.liveChat.stop()
return
}

this.comments.push(comment)
console.log(this.comments.length)

if (typeof (comment.superchat) !== 'undefined') {
this.getRandomColorClass().then((data) => {
Expand Down Expand Up @@ -211,7 +206,6 @@ export default Vue.extend({
}

if (this.comments.length > 150 && this.stayAtBottom) {
console.log('user is not at bottom')
this.comments = this.comments.splice(this.comments.length - 150, this.comments.length)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,6 @@ export default Vue.extend({
this.isLoading = true

this.ytGetPlaylistInfo(this.playlistId).then((result) => {
console.log('done')
console.log(result)

this.playlistTitle = result.title
this.playlistItems = result.items
this.videoCount = result.estimatedItemCount
Expand All @@ -307,7 +304,7 @@ export default Vue.extend({

this.isLoading = false
}).catch((err) => {
console.log(err)
console.error(err)
const errorMessage = this.$t('Local API Error (Click to copy)')
this.showToast({
message: `${errorMessage}: ${err}`,
Expand Down Expand Up @@ -336,9 +333,6 @@ export default Vue.extend({
}

this.invidiousGetPlaylistInfo(payload).then((result) => {
console.log('done')
console.log(result)

this.playlistTitle = result.title
this.videoCount = result.videoCount
this.channelName = result.author
Expand All @@ -348,7 +342,7 @@ export default Vue.extend({

this.isLoading = false
}).catch((err) => {
console.log(err)
console.error(err)
const errorMessage = this.$t('Invidious API Error (Click to copy)')
this.showToast({
message: `${errorMessage}: ${err}`,
Expand Down
Loading