This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev by this push:
     new c28c6fd94 [lint] add pre-commit hook (#1609)
c28c6fd94 is described below

commit c28c6fd94a2da0884e848a288ec22c355e1f8d08
Author: wql <[email protected]>
AuthorDate: Thu Sep 15 18:13:56 2022 +0800

    [lint] add pre-commit hook (#1609)
    
    * [lint] add pre-commit hook
    
    * add license
    
    Co-authored-by: sparkwql <weiqinlin627@gmail>
---
 .husky/_/husky.sh                                  | 55 ++++++++++++++++++++++
 .husky/pre-commit                                  | 24 ++++++++++
 .../streampark-console-webapp/.eslintrc.js         | 13 ++++-
 .../streampark-console-webapp/package.json         |  1 +
 .../src/components/Menu/SideMenu.vue               |  3 --
 .../src/views/flink/app/Add.vue                    |  2 -
 .../src/views/flink/app/AddEdit.js                 |  1 +
 .../src/views/flink/app/Different.vue              |  8 +++-
 .../src/views/flink/app/EditFlink.vue              |  2 -
 .../src/views/flink/app/EditStreamPark.vue         |  2 -
 .../src/views/flink/app/View.vue                   |  3 +-
 .../src/views/flink/notebook/Submit.vue            |  1 -
 .../src/views/flink/project/Edit.vue               |  2 +-
 .../src/views/flink/setting/AddCluster.vue         |  1 -
 .../src/views/flink/setting/EditCluster.vue        |  1 -
 .../src/views/flink/setting/View.vue               |  7 +--
 16 files changed, 102 insertions(+), 24 deletions(-)

diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh
new file mode 100644
index 000000000..de727d709
--- /dev/null
+++ b/.husky/_/husky.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+if [ -z "$husky_skip_init" ]; then
+  debug () {
+    if [ "$HUSKY_DEBUG" = "1" ]; then
+      echo "husky (debug) - $1"
+    fi
+  }
+
+  readonly hook_name="$(basename -- "$0")"
+  debug "starting $hook_name..."
+
+  if [ "$HUSKY" = "0" ]; then
+    debug "HUSKY env variable is set to 0, skipping hook"
+    exit 0
+  fi
+
+  if [ -f ~/.huskyrc ]; then
+    debug "sourcing ~/.huskyrc"
+    . ~/.huskyrc
+  fi
+
+  readonly husky_skip_init=1
+  export husky_skip_init
+  sh -e "$0" "$@"
+  exitCode="$?"
+
+  if [ $exitCode != 0 ]; then
+    echo "husky - $hook_name hook exited with code $exitCode (error)"
+  fi
+
+  if [ $exitCode = 127 ]; then
+    echo "husky - command not found in PATH=$PATH"
+  fi
+
+  exit $exitCode
+fi
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100755
index 000000000..72d14ed44
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1,24 @@
+#!/usr/bin/env sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+. "$(dirname -- "$0")/_/husky.sh"
+
+cd streampark-console/streampark-console-webapp
+npm run lint
diff --git a/streampark-console/streampark-console-webapp/.eslintrc.js 
b/streampark-console/streampark-console-webapp/.eslintrc.js
index 7f71f54af..485b0dba2 100644
--- a/streampark-console/streampark-console-webapp/.eslintrc.js
+++ b/streampark-console/streampark-console-webapp/.eslintrc.js
@@ -18,10 +18,15 @@
 module.exports = {
   'root': true,
   'env': {
+    'browser': true,
     'node': true
   },
+  globals: {
+    $: true,
+  },
   'extends': [
-    'plugin:vue/strongly-recommended'
+    'plugin:vue/strongly-recommended',
+    'eslint:recommended'
   ],
   'parserOptions': {
     'parser': 'babel-eslint'
@@ -75,6 +80,10 @@ module.exports = {
       {
         'ignoreReadBeforeAssign': false
       }
-    ]
+    ],
+    'no-unused-vars': [2, {
+      'vars': 'all',
+      'args': 'none'
+    }],
   }
 }
diff --git a/streampark-console/streampark-console-webapp/package.json 
b/streampark-console/streampark-console-webapp/package.json
index d5f88204a..377e5db32 100644
--- a/streampark-console/streampark-console-webapp/package.json
+++ b/streampark-console/streampark-console-webapp/package.json
@@ -63,6 +63,7 @@
     "eslint": "^5.16.0",
     "eslint-plugin-html": "^5.0.0",
     "eslint-plugin-vue": "^5.2.3",
+    "husky": "^8.0.1",
     "less-loader": "^6.1.1",
     "style-resources-loader": "^1.3.2",
     "vue-cli-plugin-style-resources-loader": "^0.1.4",
diff --git 
a/streampark-console/streampark-console-webapp/src/components/Menu/SideMenu.vue 
b/streampark-console/streampark-console-webapp/src/components/Menu/SideMenu.vue
index 97a200ee1..400c61baa 100644
--- 
a/streampark-console/streampark-console-webapp/src/components/Menu/SideMenu.vue
+++ 
b/streampark-console/streampark-console-webapp/src/components/Menu/SideMenu.vue
@@ -79,9 +79,6 @@ export default {
     onSelect (obj) {
       this.$emit('menuSelect', obj)
     },
-    logoCollapsed () {
-      this.$emit('menuSelect', obj)
-    },
     // 处理菜单隐藏的。。。
     handleHideMenu (array, source) {
       source.filter((x) => { return !x.meta.hidden }).forEach((x) => {
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/app/Add.vue 
b/streampark-console/streampark-console-webapp/src/views/flink/app/Add.vue
index 6fae3012f..c5cfcfe80 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/Add.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/Add.vue
@@ -1500,9 +1500,7 @@
   } from './AddEdit'
 
   import {
-    get as getAlert,
     listWithOutPage as listWithOutPageAlert,
-    send as sendAlert
   } from '@/api/alert'
 
   import {toPomString} from './Pom'
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/app/AddEdit.js 
b/streampark-console/streampark-console-webapp/src/views/flink/app/AddEdit.js
index f46eb14b1..a0615ada6 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/app/AddEdit.js
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/app/AddEdit.js
@@ -186,6 +186,7 @@ export function syntaxError(vue) {
             }]
           )
         } catch (e) {
+          console.log(e)
         }
     }
 }
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/app/Different.vue
 
b/streampark-console/streampark-console-webapp/src/views/flink/app/Different.vue
index 67fdd3fca..00b10c6b4 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/app/Different.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/app/Different.vue
@@ -142,7 +142,9 @@ export default {
         if (this.diffEditor != null) {
           try {
             this.diffEditor.dispose()
-          }catch (e) {}
+          } catch (e) {
+            console.log(e)
+          }
         }
         this.diffEditor = monaco.editor.createDiffEditor(elem, 
this.getOption())
         this.diffEditor.setModel({
@@ -163,7 +165,9 @@ export default {
       if (this.diffEditor != null) {
         try {
           this.diffEditor.dispose()
-        }catch (e) {}
+        }catch (e) {
+          console.log(e)
+        }
       }
     },
 
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/app/EditFlink.vue
 
b/streampark-console/streampark-console-webapp/src/views/flink/app/EditFlink.vue
index ebcfe4cec..016adaade 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/app/EditFlink.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/app/EditFlink.vue
@@ -880,9 +880,7 @@ import {list as listFlinkCluster} from '@/api/flinkCluster'
 import {initPodTemplateEditor} from './AddEdit'
 import SvgIcon from '@/components/SvgIcon'
 import {
-  get as getAlert,
   listWithOutPage as listWithOutPageAlert,
-  send as sendAlert
 } from '@/api/alert'
 
 export default {
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/app/EditStreamPark.vue
 
b/streampark-console/streampark-console-webapp/src/views/flink/app/EditStreamPark.vue
index 9b20a2806..694709761 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/app/EditStreamPark.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/app/EditStreamPark.vue
@@ -1683,9 +1683,7 @@ import {
 } from '@/api/flinkPodtmpl'
 
 import {
-  get as getAlert,
   listWithOutPage as listWithOutPageAlert,
-  send as sendAlert
 } from '@/api/alert'
 
 
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue 
b/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
index 04e7414fe..b0be6be99 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
@@ -1241,9 +1241,8 @@ export default {
 
   computed: {
     columns() {
-      let {sortedInfo, filteredInfo} = this
+      let {sortedInfo} = this
       sortedInfo = sortedInfo || {}
-      filteredInfo = filteredInfo || {}
       return [ {
         title: 'Application Name',
         dataIndex: 'jobName',
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/notebook/Submit.vue
 
b/streampark-console/streampark-console-webapp/src/views/flink/notebook/Submit.vue
index fb99e7179..8be35cb3d 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/notebook/Submit.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/notebook/Submit.vue
@@ -96,7 +96,6 @@
 import * as monaco from 'monaco-editor'
 import {submit} from '@api/notebook'
 import {get} from '@api/tutorial'
-import storage from '@/utils/storage'
 
 export default {
   name: 'Submit',
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue 
b/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
index 952266357..2d91355f4 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
@@ -184,7 +184,7 @@
 
 <script>
 
-import {get, update, branches, gitcheck, exists, jars} from '@api/project'
+import {get, update, branches, gitcheck, exists} from '@api/project'
 import { mapActions, mapGetters } from 'vuex'
 
 export default {
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/setting/AddCluster.vue
 
b/streampark-console/streampark-console-webapp/src/views/flink/setting/AddCluster.vue
index 440fc481b..1ee5776d9 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/setting/AddCluster.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/setting/AddCluster.vue
@@ -516,7 +516,6 @@ import {
   flinkBaseImages as histFlinkBaseImages
 } from '@/api/flinkHistory'
 
-const Base64 = require('js-base64').Base64
 
 export default {
   name: 'AddCluster',
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/setting/EditCluster.vue
 
b/streampark-console/streampark-console-webapp/src/views/flink/setting/EditCluster.vue
index 4eeebffab..fab99e772 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/setting/EditCluster.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/setting/EditCluster.vue
@@ -517,7 +517,6 @@ import {
   flinkBaseImages as histFlinkBaseImages
 } from '@/api/flinkHistory'
 
-const Base64 = require('js-base64').Base64
 
 export default {
   name: 'EditCluster',
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/setting/View.vue 
b/streampark-console/streampark-console-webapp/src/views/flink/setting/View.vue
index 4a464ea3d..3bae76be8 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/setting/View.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/setting/View.vue
@@ -930,11 +930,11 @@ import {
   setDefault,
   sync
 } from '@/api/flinkEnv'
+import {checkHadoop} from '@api/setting'
 
 import {
   list as listCluster,
   create as createCluster,
-  get as getCluster,
   update as updateCluster,
   check as checkCluster,
   start as startCluster,
@@ -946,7 +946,6 @@ import {
   add as addAlert,
   exists as existsAlert,
   update as updateAlert,
-  get as getAlert,
   listWithOutPage as listWithOutPageAlert,
   remove as removeAlert,
   send as sendAlert
@@ -957,8 +956,6 @@ import monaco from '@/views/flink/app/Monaco.yaml'
 import addCluster from './AddCluster'
 import { mapActions } from 'vuex'
 import storage from '@/utils/storage'
-import cluster from '@/store/modules/cluster'
-import { Item } from 'ant-design-vue/es/vc-menu'
 
 export default {
   name: 'Setting',
@@ -1510,7 +1507,7 @@ export default {
 
         }
       }).catch((err) => {
-        callback(new Error('提交表单异常' + err))
+        // callback(new Error('提交表单异常' + err))
       })
       this.alertId = null
     },

Reply via email to