Browse Source

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

liyasthomas 3 years ago
parent
commit
a63c0817cc

+ 1 - 18
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",

+ 2 - 2
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.)"
         )
       }

+ 2 - 2
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;"
     )

+ 3 - 3
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 {}
     }
 

+ 8 - 0
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)