From 7f248da0b3069f22d4d77530d9e7150039caf8a3 Mon Sep 17 00:00:00 2001 From: liyasthomas Date: Tue, 18 May 2021 11:56:59 +0530 Subject: [PATCH] refactor: lint --- components/app/Contributors.vue | 32 ++- components/app/Extensions.vue | 38 ++- components/app/Footer.vue | 43 ++-- components/app/Header.vue | 315 ++++++++++++----------- components/app/Logo.vue | 1 + components/app/Section.vue | 75 +++--- components/app/Shortcuts.vue | 24 +- components/app/Sidenav.vue | 114 ++++---- components/docs/Collection.vue | 9 +- components/environments/Add.vue | 8 +- components/environments/Edit.vue | 62 +++-- components/environments/Environment.vue | 18 +- components/environments/ImportExport.vue | 105 +++++--- components/environments/index.vue | 75 ++++-- components/firebase/Login.vue | 29 ++- components/realtime/Socketio.vue | 62 +++-- layouts/default.vue | 8 +- package.json | 2 +- 18 files changed, 588 insertions(+), 432 deletions(-) diff --git a/components/app/Contributors.vue b/components/app/Contributors.vue index a34fbfd7..20801f49 100644 --- a/components/app/Contributors.vue +++ b/components/app/Contributors.vue @@ -9,10 +9,10 @@
@@ -40,13 +49,22 @@ rel="noopener" > @@ -67,18 +85,18 @@ export default { props: { show: Boolean, }, - watch: { - show() { - this.hasChromeExtInstalled = hasChromeExtensionInstalled() - this.hasFirefoxExtInstalled = hasFirefoxExtensionInstalled() - }, - }, data() { return { hasChromeExtInstalled: hasChromeExtensionInstalled(), hasFirefoxExtInstalled: hasFirefoxExtensionInstalled(), } }, + watch: { + show() { + this.hasChromeExtInstalled = hasChromeExtensionInstalled() + this.hasFirefoxExtInstalled = hasFirefoxExtensionInstalled() + }, + }, methods: { hideModal() { this.$emit("hide-modal") diff --git a/components/app/Footer.vue b/components/app/Footer.vue index a1469b4d..016b8e63 100644 --- a/components/app/Footer.vue +++ b/components/app/Footer.vue @@ -1,8 +1,16 @@ - - + + diff --git a/components/app/Sidenav.vue b/components/app/Sidenav.vue index 6ed1d356..afd04c12 100644 --- a/components/app/Sidenav.vue +++ b/components/app/Sidenav.vue @@ -6,27 +6,32 @@ seems to mess up the nuxt-link active class. --> language - + topic settings + + - - diff --git a/components/docs/Collection.vue b/components/docs/Collection.vue index 8d665b59..fc92fd71 100644 --- a/components/docs/Collection.vue +++ b/components/docs/Collection.vue @@ -5,13 +5,16 @@ {{ collection.name || $t("none") }} -
+
@@ -20,7 +23,7 @@ diff --git a/components/environments/Add.vue b/components/environments/Add.vue index 1598d1ca..fa68e08e 100644 --- a/components/environments/Add.vue +++ b/components/environments/Add.vue @@ -13,9 +13,9 @@
@@ -57,7 +57,9 @@ export default { methods: { syncEnvironments() { if (fb.currentUser !== null && this.SYNC_ENVIRONMENTS) { - fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments))) + fb.writeEnvironments( + JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)) + ) } }, addNewEnvironment() { @@ -65,7 +67,7 @@ export default { this.$toast.info(this.$t("invalid_environment_name")) return } - let newEnvironment = [ + const newEnvironment = [ { name: this.$data.name, variables: [], diff --git a/components/environments/Edit.vue b/components/environments/Edit.vue index 4af1dd81..9bff9057 100644 --- a/components/environments/Edit.vue +++ b/components/environments/Edit.vue @@ -13,22 +13,26 @@
-
  • @@ -59,7 +63,9 @@ :placeholder="$t('value_count', { count: index + 1 })" :name="'value' + index" :value=" - typeof variable.value === 'string' ? variable.value : JSON.stringify(variable.value) + typeof variable.value === 'string' + ? variable.value + : JSON.stringify(variable.value) " @change=" $store.commit('postwoman/setVariableValue', { @@ -72,10 +78,10 @@
  • @@ -114,8 +120,8 @@ import { getSettingSubject } from "~/newstore/settings" export default { props: { show: Boolean, - editingEnvironment: Object, - editingEnvironmentIndex: Number, + editingEnvironment: { type: Object, default: () => {} }, + editingEnvironmentIndex: { type: Number, default: null }, }, data() { return { @@ -128,15 +134,6 @@ export default { SYNC_ENVIRONMENTS: getSettingSubject("syncEnvironments"), } }, - watch: { - editingEnvironment(update) { - this.name = - this.$props.editingEnvironment && this.$props.editingEnvironment.name - ? this.$props.editingEnvironment.name - : undefined - this.$store.commit("postwoman/setEditingEnvironment", this.$props.editingEnvironment) - }, - }, computed: { editingEnvCopy() { return this.$store.state.postwoman.editingEnvironment @@ -146,10 +143,24 @@ export default { return result === "" ? "" : JSON.stringify(result) }, }, + watch: { + editingEnvironment() { + this.name = + this.$props.editingEnvironment && this.$props.editingEnvironment.name + ? this.$props.editingEnvironment.name + : undefined + this.$store.commit( + "postwoman/setEditingEnvironment", + this.$props.editingEnvironment + ) + }, + }, methods: { syncEnvironments() { if (fb.currentUser !== null && this.SYNC_ENVIRONMENTS) { - fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments))) + fb.writeEnvironments( + JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)) + ) } }, clearContent({ target }) { @@ -158,18 +169,21 @@ export default { this.$toast.info(this.$t("cleared"), { icon: "clear_all", }) - setTimeout(() => (target.innerHTML = 'clear_all'), 1000) + setTimeout( + () => (target.innerHTML = 'clear_all'), + 1000 + ) }, addEnvironmentVariable() { - let value = { key: "", value: "" } + const value = { key: "", value: "" } this.$store.commit("postwoman/addVariable", value) this.syncEnvironments() }, removeEnvironmentVariable(index) { - let variableIndex = index + const variableIndex = index const oldVariables = this.editingEnvCopy.variables.slice() const newVariables = this.editingEnvCopy.variables.filter( - (variable, index) => variableIndex !== index + (_, index) => variableIndex !== index ) this.$store.commit("postwoman/removeVariable", newVariables) @@ -177,7 +191,7 @@ export default { icon: "delete", action: { text: this.$t("undo"), - onClick: (e, toastObject) => { + onClick: (_, toastObject) => { this.$store.commit("postwoman/removeVariable", oldVariables) toastObject.remove() }, diff --git a/components/environments/Environment.vue b/components/environments/Environment.vue index b4103657..066c3edb 100644 --- a/components/environments/Environment.vue +++ b/components/environments/Environment.vue @@ -8,18 +8,22 @@
-