diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000000..1c125a9172 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +cd ./frontend +npm run lint-staged diff --git a/frontend/.eslintignore b/frontend/.eslintignore index e6529fc09c..5cae13b518 100644 --- a/frontend/.eslintignore +++ b/frontend/.eslintignore @@ -1,4 +1,7 @@ build/*.js src/assets +src/styles/deicon/iconfont.js +src/components/canvas/assets/iconfont/iconfont.js public dist +node_modules diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 5de7bd689a..626787c2f4 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -14,16 +14,12 @@ module.exports = { // add your custom rules here //it is base on https://github.com/vuejs/eslint-config-vue rules: { - "vue/max-attributes-per-line": [2, { - "singleline": 10, - "multiline": { - "max": 1, - "allowFirstLine": false - } - }], "vue/singleline-html-element-content-newline": "off", "vue/multiline-html-element-content-newline": "off", - "vue/name-property-casing": ["error", "PascalCase"], + "vue/no-mutating-props": "off", + "vue/multi-word-component-names": "off", + "vue/require-default-prop": "off", + // "vue/name-property-casing": ["error", "PascalCase"], "vue/no-v-html": "off", 'accessor-pairs': 2, 'arrow-spacing': [2, { diff --git a/frontend/package.json b/frontend/package.json index 1395aca36c..ec13897430 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,9 +10,19 @@ "build:stage": "vue-cli-service build --mode staging", "dll": "webpack -p --progress --config ./webpack.dll.conf.js", "preview": "node build/index.js --preview", - "lint": "eslint --ext .js,.vue src", + "lint": "eslint --ext .js,.vue src --fix", + "lint-staged": "lint-staged", "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, + "husky": { + "hooks": { + "pre-commit": "npm run lint-staged" + } + }, + "lint-staged": { + "src/**/*.js": "eslint --ext .js", + "src/**/*.vue": "eslint --ext .vue" + }, "dependencies": { "@antv/g2plot": "^2.4.9", "@antv/l7-maps": "^2.8.35", @@ -74,17 +84,24 @@ "@babel/plugin-proposal-optional-chaining": "^7.18.6", "@babel/register": "7.0.0", "@vue/cli-plugin-babel": "3.6.0", - "@vue/cli-plugin-eslint": "^3.9.1", + "@vue/cli-plugin-eslint": "^5.0.4", "@vue/cli-service": "^3.3.1", "add-asset-html-webpack-plugin": "^3.1.3", - "babel-eslint": "^8.2.2", + "babel-eslint": "^10.1.0", "chalk": "2.4.2", "clean-webpack-plugin": "^1.0.1", "connect": "3.6.6", "copy-webpack-plugin": "^4.6.0", - "eslint": "5.15.3", - "eslint-plugin-vue": "5.2.2", + "eslint": "^7.32.0", + "eslint-config-prettier": "^8.5.0", + "eslint-loader": "^4.0.2", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-vue": "^9.1.0", "html-webpack-plugin": "3.2.0", + "husky": "^8.0.1", + "less": "^3.0.0", + "less-loader": "^5.0.0", + "lint-staged": "^13.0.1", "mockjs": "1.0.1-beta3", "runjs": "^4.1.3", "sass": "^1.33.0", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 4c83f5c23f..184adffb84 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,7 +1,11 @@ @@ -10,7 +14,7 @@ import PluginCom from '@/views/system/plugin/PluginCom' export default { name: 'App', - components: {PluginCom}, + components: { PluginCom }, beforeCreate() { } diff --git a/frontend/src/api/dataset/dataset.js b/frontend/src/api/dataset/dataset.js index d29956a17a..106337e62b 100644 --- a/frontend/src/api/dataset/dataset.js +++ b/frontend/src/api/dataset/dataset.js @@ -246,7 +246,7 @@ export function exportExcel(data) { export function dsTable(page, size, id) { return request({ url: '/datasource/getTables/' + id + '/' + page + '/' + size, - method: 'post', + method: 'post' }) } export default { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree, checkCustomDs } diff --git a/frontend/src/api/panel/panel.js b/frontend/src/api/panel/panel.js index e7da3e0ff7..3a74f445a8 100644 --- a/frontend/src/api/panel/panel.js +++ b/frontend/src/api/panel/panel.js @@ -293,18 +293,17 @@ export function removePanelCache(panelId) { }) } - export function findPanelElementInfo(viewId) { return request({ - url: 'panel/group/findPanelElementInfo/'+viewId, + url: 'panel/group/findPanelElementInfo/' + viewId, method: 'get', loading: false }) } -export function export2AppCheck(panelId){ +export function export2AppCheck(panelId) { return request({ - url: 'panel/group/export2AppCheck/'+panelId, + url: 'panel/group/export2AppCheck/' + panelId, method: 'get', loading: false }) diff --git a/frontend/src/api/system/datasource.js b/frontend/src/api/system/datasource.js index 647cb4445b..365d2b7da3 100644 --- a/frontend/src/api/system/datasource.js +++ b/frontend/src/api/system/datasource.js @@ -152,7 +152,7 @@ export function getDatasourceDetail(id) { return request({ url: `/datasource/get/${id}`, loading: true, - method: 'post', + method: 'post' }) } export default { getDatasourceDetail, dsGrid, addDs, editDs, delDs, validateDs, listDatasource, getSchema } diff --git a/frontend/src/api/system/engine.js b/frontend/src/api/system/engine.js index 3a6c9fdcdc..7028190c18 100644 --- a/frontend/src/api/system/engine.js +++ b/frontend/src/api/system/engine.js @@ -1,5 +1,4 @@ import request from '@/utils/request' -import { validateDs } from '@/api/system/datasource' export function engineMode() { return request({ @@ -35,7 +34,6 @@ export function save(data) { }) } - export function dbPreview(data) { return request({ url: '/dataset/table/dbPreview', @@ -43,4 +41,4 @@ export function dbPreview(data) { loading: true, data }) -} \ No newline at end of file +} diff --git a/frontend/src/api/system/kettle.js b/frontend/src/api/system/kettle.js index e07517b0d3..d7f01e0a78 100644 --- a/frontend/src/api/system/kettle.js +++ b/frontend/src/api/system/kettle.js @@ -1,5 +1,4 @@ import request from '@/utils/request' -import { validateDs } from '@/api/system/datasource' export function validate(data) { return request({ diff --git a/frontend/src/assets/DataEase-0.jpg b/frontend/src/assets/DataEase-0.jpg deleted file mode 100644 index 9e9795332e..0000000000 Binary files a/frontend/src/assets/DataEase-0.jpg and /dev/null differ diff --git a/frontend/src/assets/DataEase-1.jpg b/frontend/src/assets/DataEase-1.jpg deleted file mode 100644 index 0cdc743d6b..0000000000 Binary files a/frontend/src/assets/DataEase-1.jpg and /dev/null differ diff --git a/frontend/src/assets/DataEase-2.jpg b/frontend/src/assets/DataEase-2.jpg deleted file mode 100644 index 46c9ac5281..0000000000 Binary files a/frontend/src/assets/DataEase-2.jpg and /dev/null differ diff --git a/frontend/src/assets/DataEase-3.jpg b/frontend/src/assets/DataEase-3.jpg deleted file mode 100644 index 5a1078e153..0000000000 Binary files a/frontend/src/assets/DataEase-3.jpg and /dev/null differ diff --git a/frontend/src/assets/DataEase-4.jpg b/frontend/src/assets/DataEase-4.jpg deleted file mode 100644 index 55163d03f9..0000000000 Binary files a/frontend/src/assets/DataEase-4.jpg and /dev/null differ diff --git a/frontend/src/assets/DataEase-5.jpg b/frontend/src/assets/DataEase-5.jpg deleted file mode 100644 index 1fe04aa014..0000000000 Binary files a/frontend/src/assets/DataEase-5.jpg and /dev/null differ diff --git a/frontend/src/assets/blue_1.svg b/frontend/src/assets/blue_1.svg deleted file mode 100644 index 15cfcc7946..0000000000 --- a/frontend/src/assets/blue_1.svg +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/components/AssistButton/ColorButton.vue b/frontend/src/components/AssistButton/ColorButton.vue index c4273ce710..1758fa822d 100644 --- a/frontend/src/components/AssistButton/ColorButton.vue +++ b/frontend/src/components/AssistButton/ColorButton.vue @@ -1,7 +1,14 @@ \ No newline at end of file + this.$emit('input', val) + } + } +} + diff --git a/frontend/src/components/gridTable/index.vue b/frontend/src/components/gridTable/index.vue index 178f927aa7..8a8a09ef16 100644 --- a/frontend/src/components/gridTable/index.vue +++ b/frontend/src/components/gridTable/index.vue @@ -3,56 +3,55 @@ - + - +
- + />
\ No newline at end of file + diff --git a/frontend/src/components/gridTable/tableBody.vue b/frontend/src/components/gridTable/tableBody.vue index 7a987865d6..25da98acc6 100644 --- a/frontend/src/components/gridTable/tableBody.vue +++ b/frontend/src/components/gridTable/tableBody.vue @@ -1,25 +1,25 @@ \ No newline at end of file + }) + return nodes + } +} + diff --git a/frontend/src/components/msgCfm/index.js b/frontend/src/components/msgCfm/index.js index 59331628b1..f3d99bfa99 100644 --- a/frontend/src/components/msgCfm/index.js +++ b/frontend/src/components/msgCfm/index.js @@ -2,44 +2,44 @@ export default { methods: { openMessageSuccess(text, type) { - const h = this.$createElement; - const iconClass = `el-icon-${ type || 'success'}`; - const customClass = `de-message-${ type || 'success'} de-message`; + const h = this.$createElement + const iconClass = `el-icon-${type || 'success'}` + const customClass = `de-message-${type || 'success'} de-message` this.$message({ - message: h("p", null, [h("span", null, this.$t(text))]), + message: h('p', null, [h('span', null, this.$t(text))]), iconClass, - customClass, - }); + customClass + }) }, - handlerConfirm(options,confirmButtonTextInfo) { - let { title, content, type = 'danger', cb, confirmButtonText = confirmButtonTextInfo?confirmButtonTextInfo:this.$t('commons.delete'), showCancelButton = true, cancelButtonText = this.$t("commons.cancel"), cancelCb = () => {}, finallyCb = () => {} } = options; - let text = content ? `${ this.$t(title) }
${ this.$t(content) }` : this.$t(title); - const dangerouslyUseHTMLString = Boolean(content); - let customClass = `de-confirm de-confirm-fail ${ dangerouslyUseHTMLString && 'de-use-html'}` - let confirmButtonClass = `de-confirm-${type}-btn de-confirm-btn` + handlerConfirm(options, confirmButtonTextInfo) { + const { title, content, type = 'danger', cb, confirmButtonText = confirmButtonTextInfo || this.$t('commons.delete'), showCancelButton = true, cancelButtonText = this.$t('commons.cancel'), cancelCb = () => {}, finallyCb = () => {} } = options + const text = content ? `${this.$t(title)}
${this.$t(content)}` : this.$t(title) + const dangerouslyUseHTMLString = Boolean(content) + const customClass = `de-confirm de-confirm-fail ${dangerouslyUseHTMLString && 'de-use-html'}` + const confirmButtonClass = `de-confirm-${type}-btn de-confirm-btn` this.$confirm( text, - "", + '', { confirmButtonText, cancelButtonText, showCancelButton, - cancelButtonClass: "de-confirm-btn de-confirm-plain-cancel", + cancelButtonClass: 'de-confirm-btn de-confirm-plain-cancel', dangerouslyUseHTMLString, confirmButtonClass, customClass, - iconClass: "el-icon-warning", + iconClass: 'el-icon-warning' } ) .then(() => { - cb(); + cb() }) .catch((action) => { cancelCb(action) }) .finally(() => { finallyCb() - }); - }, - }, -}; + }) + } + } +} diff --git a/frontend/src/components/msgCfm/keyEnter.js b/frontend/src/components/msgCfm/keyEnter.js index ca0d8f36a0..f91a4aeacc 100644 --- a/frontend/src/components/msgCfm/keyEnter.js +++ b/frontend/src/components/msgCfm/keyEnter.js @@ -1,16 +1,16 @@ export default { - mounted() { - document.addEventListener('keypress', this.entryKey) - }, - destroyed() { - document.removeEventListener('keypress', this.entryKey) - }, - methods: { - entryKey(event) { - const keyCode = event.keyCode - if (keyCode === 13) { - this.$refs.search.blur() - } - }, + mounted() { + document.addEventListener('keypress', this.entryKey) + }, + destroyed() { + document.removeEventListener('keypress', this.entryKey) + }, + methods: { + entryKey(event) { + const keyCode = event.keyCode + if (keyCode === 13) { + this.$refs.search.blur() + } } -} \ No newline at end of file + } +} diff --git a/frontend/src/components/widget/DeWidget/DeDate.vue b/frontend/src/components/widget/DeWidget/DeDate.vue index 8bda125c45..f054608404 100644 --- a/frontend/src/components/widget/DeWidget/DeDate.vue +++ b/frontend/src/components/widget/DeWidget/DeDate.vue @@ -309,7 +309,7 @@ export default { .el-date-picker__time-header { border-bottom: 1px solid var(--BrDateColor, #dfe4ed) !important; } - + .el-picker-panel__footer { border-top: 1px solid var(--BrDateColor, #dfe4ed) !important; background: var(--BgDateColor, #FFFFFF) !important; @@ -329,7 +329,6 @@ export default { background: var(--BgDateColor, #FFFFFF) !important; border:1px solid var(--BrDateColor, #dfe4ed) !important; } - .popper__arrow, .popper__arrow::after { diff --git a/frontend/src/components/widget/DeWidget/DeInputSearch.vue b/frontend/src/components/widget/DeWidget/DeInputSearch.vue index 1011a5fa33..c09179631f 100644 --- a/frontend/src/components/widget/DeWidget/DeInputSearch.vue +++ b/frontend/src/components/widget/DeWidget/DeInputSearch.vue @@ -13,7 +13,11 @@ @dblclick="setEdit" > - + diff --git a/frontend/src/components/widget/DeWidget/DeNumberRange.vue b/frontend/src/components/widget/DeWidget/DeNumberRange.vue index 5f146afbe1..66590a87c0 100644 --- a/frontend/src/components/widget/DeWidget/DeNumberRange.vue +++ b/frontend/src/components/widget/DeWidget/DeNumberRange.vue @@ -1,13 +1,32 @@