Browse Source

[Improvement][UI] Add no-var rule for eslint and add 'npm run lint:fix' command (#4225)

Add no-var rule for eslint, and fix related files
Add npm run lint:fix command, which distinguished from the default command npm run lint
The behavior of command npm run lint and command npm run lint:fix should be distinguished
The first command is used to lint only, and the second one is used to lint and fix problems automatically
pull/3/MERGE
Shiwen Cheng 4 years ago committed by GitHub
parent
commit
6f72deff57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      dolphinscheduler-ui/.eslintrc.yml
  2. 3
      dolphinscheduler-ui/package.json
  3. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
  4. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
  5. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue
  6. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
  7. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
  8. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue
  9. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sqoop.vue
  10. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/waterdrop.vue
  11. 2
      dolphinscheduler-ui/src/js/conf/home/pages/datasource/pages/list/_source/createDataSource.vue
  12. 20
      dolphinscheduler-ui/src/js/module/axios/jsonp.js
  13. 14
      dolphinscheduler-ui/src/js/module/axios/querystring.js
  14. 4
      dolphinscheduler-ui/src/js/module/components/transfer/resource.vue
  15. 6
      dolphinscheduler-ui/src/js/module/util/localStorage.js

1
dolphinscheduler-ui/.eslintrc.yml

@ -39,5 +39,6 @@ rules:
no-mixed-operators: 'off'
no-extend-native: 'off'
prefer-const: 'off'
no-var: 'error'
overrides:
- { 'files': ['*.vue'], 'rules': { 'indent': 'off' }}

3
dolphinscheduler-ui/package.json

@ -8,7 +8,8 @@
"dev": "cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.dev.js",
"clean": "rimraf dist",
"start": "npm run dev",
"lint": "eslint ./src --ext .js,.vue --fix",
"lint": "eslint --ext .js,.vue ./src",
"lint:fix": "eslint --ext .js,.vue --fix ./src",
"build:release": "npm run clean && cross-env NODE_ENV=production PUBLIC_PATH=/dolphinscheduler/ui webpack --config ./build/webpack.config.release.js"
},
"dependencies": {

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue

@ -578,7 +578,7 @@
// Update JSP connections
let plumbIns = JSP.JspInstance
var targetId = this.nodeData.id
let targetId = this.nodeData.id
// Update new connections
this.preTasksToAdd.map(sourceId => {
@ -719,7 +719,7 @@
}
// If the workergroup has been deleted, set the default workergroup
for (let i = 0; i < this.store.state.security.workerGroupsListAll.length; i++) {
var workerGroup = this.store.state.security.workerGroupsListAll[i].id
let workerGroup = this.store.state.security.workerGroupsListAll[i].id
if (o.workerGroup === workerGroup) {
break
}

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue

@ -358,8 +358,8 @@
if (element.id === id) {
return element
} else if (element.children !== null) {
var i
var result = null
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue

@ -192,8 +192,8 @@
if (element.id === id) {
return element
} else if (element.children !== null) {
var i
var result = null
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue

@ -197,8 +197,8 @@
if (element.id === id) {
return element
} else if (element.children !== null) {
var i
var result = null
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue

@ -206,8 +206,8 @@
if (element.id === id) {
return element
} else if (element.children !== null) {
var i
var result = null
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue

@ -303,8 +303,8 @@
if (element.id === id) {
return element
} else if (element.children !== null) {
var i
var result = null
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sqoop.vue

@ -854,7 +854,7 @@
* stringify the source params
*/
_handleSourceParams () {
var params = null
let params = null
switch (this.sourceType) {
case 'MYSQL':
this.sourceMysqlParams.srcQuerySql = this.sourceMysqlParams.srcQueryType === '1' && editor
@ -881,7 +881,7 @@
* stringify the target params
*/
_handleTargetParams () {
var params = null
let params = null
switch (this.targetType) {
case 'HIVE':
params = JSON.stringify(this.targetHiveParams)

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/waterdrop.vue

@ -247,8 +247,8 @@
if (element.id === id) {
return element
} else if (element.children !== null) {
var i
var result = null
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}

2
dolphinscheduler-ui/src/js/conf/home/pages/datasource/pages/list/_source/createDataSource.vue

@ -404,7 +404,7 @@
* Get default port by type
*/
_getDefaultPort (type) {
var defaultPort = ''
let defaultPort = ''
switch (type) {
case 'MYSQL':
defaultPort = '3306'

20
dolphinscheduler-ui/src/js/module/axios/jsonp.js

@ -20,7 +20,7 @@ module.exports = jsonp
* Callback index.
*/
var count = 0
let count = 0
/**
* Noop function.
@ -51,19 +51,19 @@ function jsonp (url, opts, fn) {
}
if (!opts) opts = {}
var prefix = opts.prefix || '__jp'
let prefix = opts.prefix || '__jp'
// use the callback name that was passed if one was provided.
// otherwise generate a unique name by incrementing our counter.
var id = opts.name || (prefix + (count++))
let id = opts.name || (prefix + (count++))
var param = opts.param || 'callback'
var timeout = opts.timeout !== null ? opts.timeout : 60000
var enc = encodeURIComponent
let param = opts.param || 'callback'
let timeout = opts.timeout !== null ? opts.timeout : 60000
let enc = encodeURIComponent
/* istanbul ignore next */
var target = document.getElementsByTagName('script')[0] || document.head
var script
var timer
let target = document.getElementsByTagName('script')[0] || document.head
let script
let timer
/* istanbul ignore else */
if (timeout) {
timer = setTimeout(
@ -102,7 +102,7 @@ function jsonp (url, opts, fn) {
url = url.replace('?&', '?')
// debug('jsonp req "%s"', url);
var handler = ({ type }) => {
let handler = ({ type }) => {
/* istanbul ignore else */
if (type === 'error') {
cleanup()

14
dolphinscheduler-ui/src/js/module/axios/querystring.js

@ -15,18 +15,18 @@
* limitations under the License.
*/
/* istanbul ignore next */
var param = function (a) {
var s = []
var rbracket = /\[\]$/
var isArray = function (obj) {
let param = function (a) {
let s = []
let rbracket = /\[\]$/
let isArray = function (obj) {
return Object.prototype.toString.call(obj) === '[object Array]'
}
var add = function (k, v) {
let add = function (k, v) {
v = typeof v === 'function' ? v() : v === null ? '' : v === undefined ? '' : v
s[s.length] = encodeURIComponent(k) + '=' + encodeURIComponent(v)
}
var buildParams = function (prefix, obj) {
var i, len, key
let buildParams = function (prefix, obj) {
let i, len, key
if (prefix) {
if (isArray(obj)) {

4
dolphinscheduler-ui/src/js/module/components/transfer/resource.vue

@ -88,7 +88,7 @@
getParent
*/
getParent (data2, nodeId2) {
var arrRes = []
let arrRes = []
if (data2.length === 0) {
if (nodeId2) {
arrRes.unshift(data2)
@ -96,7 +96,7 @@
return arrRes
}
let rev = (data, nodeId) => {
for (var i = 0, length = data.length; i < length; i++) {
for (let i = 0, length = data.length; i < length; i++) {
let node = data[i]
if (node.id === nodeId) {
arrRes.unshift(node)

6
dolphinscheduler-ui/src/js/module/util/localStorage.js

@ -48,7 +48,7 @@ const localStorage = {
},
getJSON: function (skey, p) {
try {
var d = storage.getItem(skey)
let d = storage.getItem(skey)
if (d) {
d = JSON.parse(d)
return d[p]
@ -59,7 +59,7 @@ const localStorage = {
},
setJSON: function (skey, p, val) {
try {
var f = storage.getItem(skey)
let f = storage.getItem(skey)
f = f ? JSON.parse(f) : {}
f[p] = val
storage.setItem(skey, JSON.stringify(f))
@ -69,7 +69,7 @@ const localStorage = {
},
removeJSON: function (skey, p) {
try {
var d = storage.getItem(skey)
let d = storage.getItem(skey)
if (d) {
d = JSON.parse(d)
delete d[p]

Loading…
Cancel
Save