From df0414b26e34d57fb8149fc399f95f91999aa359 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Sun, 21 Mar 2021 21:59:28 -0600 Subject: [PATCH] ui: fix eslint errors --- ui/src/main.js | 13 +++++++------ ui/src/views/InstallPackages.vue | 12 ++++++------ ui/src/views/SelectPackages.vue | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ui/src/main.js b/ui/src/main.js index b8f456a..27bb3ea 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -24,7 +24,7 @@ export const i18n = new VueI18n({ // Borrowed from http://tobyho.com/2012/07/27/taking-over-console-log/ function intercept (method) { console[method] = function () { - var message = Array.prototype.slice.apply(arguments).join(' ') + const message = Array.prototype.slice.apply(arguments).join(' ') window.external.invoke( JSON.stringify({ Log: { @@ -37,7 +37,7 @@ function intercept (method) { } // See if we have access to the JSON interface -var hasExternalInterface = false +let hasExternalInterface = false try { window.external.invoke(JSON.stringify({ Test: {} @@ -60,8 +60,8 @@ if (hasExternalInterface) { ) } - var methods = ['log', 'warn', 'error'] - for (var i = 0; i < methods.length; i++) { + const methods = ['log', 'warn', 'error'] + for (let i = 0; i < methods.length; i++) { intercept(methods[i]) } } @@ -97,7 +97,7 @@ function selectFileCallback (name) { window.selectFileCallback = selectFileCallback -var app = new Vue({ +const app = new Vue({ i18n: i18n, router: router, data: { @@ -125,7 +125,8 @@ var app = new Vue({ methods: { exit: function () { axios.get('/api/exit').catch(function (msg) { - var searchLocation = (app.metadata.install_path && app.metadata.install_path.length > 0) ? app.metadata.install_path + const searchLocation = (app.metadata.install_path && app.metadata.install_path.length > 0) + ? app.metadata.install_path : i18n.t('error.location_unknown') app.$router.replace({ diff --git a/ui/src/views/InstallPackages.vue b/ui/src/views/InstallPackages.vue index 85a1700..90b9f4d 100644 --- a/ui/src/views/InstallPackages.vue +++ b/ui/src/views/InstallPackages.vue @@ -39,13 +39,13 @@ export default { }, methods: { install: function () { - var that = this - var app = this.$root + const that = this + const app = this.$root - var results = {} + const results = {} - for (var package_index = 0; package_index < app.config.packages.length; package_index++) { - var current_package = app.config.packages[package_index] + for (let package_index = 0; package_index < app.config.packages.length; package_index++) { + const current_package = app.config.packages[package_index] if (current_package.default != null) { results[current_package.name] = current_package.default } @@ -57,7 +57,7 @@ export default { results.mode = 'force' } - var targetUrl = '/api/start-install' + let targetUrl = '/api/start-install' if (this.is_uninstall) { targetUrl = '/api/uninstall' } diff --git a/ui/src/views/SelectPackages.vue b/ui/src/views/SelectPackages.vue index e152153..5b21053 100644 --- a/ui/src/views/SelectPackages.vue +++ b/ui/src/views/SelectPackages.vue @@ -116,9 +116,9 @@ export default { this.$router.push('/install/regular') return } - var my = this + const my = this this.$http.post('/api/verify-path', `path=${this.$root.$data.install_location}`).then(function (resp) { - var data = resp.data || {} + const data = resp.data || {} if (!data.exists) { my.$router.push('/install/regular') } else {