Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

perf: remove console (log, debug, and warn) messages

liyasthomasa63c0817cc4b
diff --git a/packages/hoppscotch-app/.eslintrc.js b/packages/hoppscotch-app/.eslintrc.js
index 39d99ad61..e1f0ba857 100644
--- a/packages/hoppscotch-app/.eslintrc.js
+++ b/packages/hoppscotch-app/.eslintrc.js
@@ -19,32 +19,15 @@ module.exports = {
"plugin:nuxt/recommended",
],
ignorePatterns: ["helpers/backend/graphql.ts"],
- plugins: ["vue", "prettier"],
+ plugins: ["vue", "nuxt", "prettier"],
// add your custom rules here
rules: {
semi: [2, "never"],
"import/named": "off", // because, named import issue with typescript see: https://github.com/typescript-eslint/typescript-eslint/issues/154
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
- "vue/max-attributes-per-line": "off",
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
- "vue/html-self-closing": [
- "error",
- {
- html: {
- normal: "never",
- void: "always",
- },
- },
- ],
- "vue/singleline-html-element-content-newline": "off",
- "vue/multiline-html-element-content-newline": "off",
- "vue/require-default-prop": "warn",
- "vue/require-prop-types": "warn",
"vue/multi-word-component-names": "off",
- "prettier/prettier": ["warn", { semi: false }],
"import/no-named-as-default": "off",
- "import/prefer-default-export": "off",
"import/no-named-as-default-member": "off",
"import/default": "off",
"no-undef": "off",
diff --git a/packages/hoppscotch-app/helpers/pwa.js b/packages/hoppscotch-app/helpers/pwa.js
index 60d580592..896daa73f 100644
--- a/packages/hoppscotch-app/helpers/pwa.js
+++ b/packages/hoppscotch-app/helpers/pwa.js
@@ -46,9 +46,9 @@ export default () => {
const outcome = await deferredPrompt.userChoice
if (outcome === "accepted") {
- console.log("Hoppscotch was installed successfully.")
+ console.info("Hoppscotch was installed successfully.")
} else {
- console.log(
+ console.info(
"Hoppscotch could not be installed. (Installation rejected by user.)"
)
}
diff --git a/packages/hoppscotch-app/layouts/default.vue b/packages/hoppscotch-app/layouts/default.vue
index a0ca232bd..f100e2ce8 100644
--- a/packages/hoppscotch-app/layouts/default.vue
+++ b/packages/hoppscotch-app/layouts/default.vue
@@ -157,11 +157,11 @@ export default defineComponent({
},
async mounted() {
performMigrations()
- console.log(
+ console.info(
"%cWe ❤︎ open source!",
"background-color:white;padding:8px 16px;border-radius:8px;font-size:32px;color:red;"
)
- console.log(
+ console.info(
"%cContribute: https://github.com/hoppscotch/hoppscotch",
"background-color:black;padding:4px 8px;border-radius:8px;font-size:16px;color:white;"
)
diff --git a/packages/hoppscotch-app/newstore/environments.ts b/packages/hoppscotch-app/newstore/environments.ts
index 02f12f30d..003828878 100644
--- a/packages/hoppscotch-app/newstore/environments.ts
+++ b/packages/hoppscotch-app/newstore/environments.ts
@@ -37,9 +37,9 @@ const dispatchers = defineDispatchers({
{ newIndex }: { newIndex: number }
) {
if (newIndex >= environments.length || newIndex <= -2) {
- console.log(
- `Ignoring possibly invalid current environment index assignment (value: ${newIndex})`
- )
+ // console.log(
+ // `Ignoring possibly invalid current environment index assignment (value: ${newIndex})`
+ // )
return {}
}
diff --git a/packages/hoppscotch-app/nuxt.config.js b/packages/hoppscotch-app/nuxt.config.js
index fe6c1b08f..7c5edb07f 100644
--- a/packages/hoppscotch-app/nuxt.config.js
+++ b/packages/hoppscotch-app/nuxt.config.js
@@ -299,6 +299,14 @@ export default {
parallel: true,
cache: true,
// hardSource: true,
+ terser: {
+ terserOptions: {
+ // https://github.com/terser/terser#compress-options
+ compress: {
+ pure_funcs: ["console.log", "console.debug", "console.warn"],
+ },
+ },
+ },
},
// Generate configuration (https://nuxtjs.org/api/configuration-generate)