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-mixed-operators: 'off'
no-extend-native: 'off' no-extend-native: 'off'
prefer-const: 'off' prefer-const: 'off'
no-var: 'error'
overrides: overrides:
- { 'files': ['*.vue'], 'rules': { 'indent': 'off' }} - { '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", "dev": "cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.dev.js",
"clean": "rimraf dist", "clean": "rimraf dist",
"start": "npm run dev", "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" "build:release": "npm run clean && cross-env NODE_ENV=production PUBLIC_PATH=/dolphinscheduler/ui webpack --config ./build/webpack.config.release.js"
}, },
"dependencies": { "dependencies": {

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

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

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

@ -358,8 +358,8 @@
if (element.id === id) { if (element.id === id) {
return element return element
} else if (element.children !== null) { } else if (element.children !== null) {
var i let i
var result = null let result = null
for (i = 0; result === null && i < element.children.length; i++) { for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id) 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) { if (element.id === id) {
return element return element
} else if (element.children !== null) { } else if (element.children !== null) {
var i let i
var result = null let result = null
for (i = 0; result === null && i < element.children.length; i++) { for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id) 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) { if (element.id === id) {
return element return element
} else if (element.children !== null) { } else if (element.children !== null) {
var i let i
var result = null let result = null
for (i = 0; result === null && i < element.children.length; i++) { for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id) 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) { if (element.id === id) {
return element return element
} else if (element.children !== null) { } else if (element.children !== null) {
var i let i
var result = null let result = null
for (i = 0; result === null && i < element.children.length; i++) { for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id) 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) { if (element.id === id) {
return element return element
} else if (element.children !== null) { } else if (element.children !== null) {
var i let i
var result = null let result = null
for (i = 0; result === null && i < element.children.length; i++) { for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id) 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 * stringify the source params
*/ */
_handleSourceParams () { _handleSourceParams () {
var params = null let params = null
switch (this.sourceType) { switch (this.sourceType) {
case 'MYSQL': case 'MYSQL':
this.sourceMysqlParams.srcQuerySql = this.sourceMysqlParams.srcQueryType === '1' && editor this.sourceMysqlParams.srcQuerySql = this.sourceMysqlParams.srcQueryType === '1' && editor
@ -881,7 +881,7 @@
* stringify the target params * stringify the target params
*/ */
_handleTargetParams () { _handleTargetParams () {
var params = null let params = null
switch (this.targetType) { switch (this.targetType) {
case 'HIVE': case 'HIVE':
params = JSON.stringify(this.targetHiveParams) 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) { if (element.id === id) {
return element return element
} else if (element.children !== null) { } else if (element.children !== null) {
var i let i
var result = null let result = null
for (i = 0; result === null && i < element.children.length; i++) { for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id) 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 * Get default port by type
*/ */
_getDefaultPort (type) { _getDefaultPort (type) {
var defaultPort = '' let defaultPort = ''
switch (type) { switch (type) {
case 'MYSQL': case 'MYSQL':
defaultPort = '3306' defaultPort = '3306'

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

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

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

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

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

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

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

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

Loading…
Cancel
Save