feat(ui): lint js code

This commit is contained in:
liushuyu 2022-03-31 03:41:39 -06:00
parent 3727e4185b
commit c61c068ed0
No known key found for this signature in database
GPG Key ID: 23D1CE4534419437
4 changed files with 1599 additions and 4063 deletions

View File

@ -19,19 +19,19 @@
"vue-router": "^3.5.2" "vue-router": "^3.5.2"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.5.14", "@vue/cli-plugin-babel": "^5.0.4",
"@vue/cli-plugin-eslint": "^4.5.14", "@vue/cli-plugin-eslint": "^5.0.4",
"@vue/cli-service": "^4.5.14", "@vue/cli-service": "^5.0.4",
"@vue/eslint-config-standard": "^6.1.0", "@vue/eslint-config-standard": "^6.1.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"eslint": "^7.28.0", "eslint": "^7.28.0",
"eslint-plugin-import": "^2.25.2", "eslint-plugin-import": "^2.25.4",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0", "eslint-plugin-promise": "^6.0.0",
"eslint-plugin-standard": "^4.1.0", "eslint-plugin-standard": "^4.1.0",
"eslint-plugin-vue": "^7.19.1", "eslint-plugin-vue": "^8.5.0",
"express": "^4.17.1", "express": "^4.17.3",
"http-proxy-middleware": "^2.0.1", "http-proxy-middleware": "^2.0.4",
"vue-template-compiler": "^2.6.14" "vue-template-compiler": "^2.6.14"
} }
} }

View File

@ -15,7 +15,7 @@
* @param data POST data. Optional. * @param data POST data. Optional.
*/ */
export function stream_ajax (path, callback, successCallback, failCallback, data) { export function stream_ajax (path, callback, successCallback, failCallback, data) {
var req = new XMLHttpRequest() const req = new XMLHttpRequest()
console.log('Making streaming HTTP request to ' + path) console.log('Making streaming HTTP request to ' + path)
@ -28,23 +28,23 @@ export function stream_ajax (path, callback, successCallback, failCallback, data
} }
}) })
var buffer = '' let buffer = ''
var seenBytes = 0 let seenBytes = 0
req.onreadystatechange = function () { req.onreadystatechange = function () {
if (req.readyState > 2) { if (req.readyState > 2) {
buffer += req.responseText.substr(seenBytes) buffer += req.responseText.substr(seenBytes)
var pointer let pointer
while ((pointer = buffer.indexOf('\n')) >= 0) { while ((pointer = buffer.indexOf('\n')) >= 0) {
var line = buffer.substring(0, pointer).trim() const line = buffer.substring(0, pointer).trim()
buffer = buffer.substring(pointer + 1) buffer = buffer.substring(pointer + 1)
if (line.length === 0) { if (line.length === 0) {
continue continue
} }
var contents = JSON.parse(line) const contents = JSON.parse(line)
callback(contents) callback(contents)
} }
@ -59,9 +59,9 @@ export function stream_ajax (path, callback, successCallback, failCallback, data
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
if (data != null) { if (data != null) {
var form = '' let form = ''
for (var key in data) { for (const key in data) {
if (!data[key]) { if (!data[key]) {
continue continue
} }

View File

@ -27,7 +27,7 @@ export default {
// See if we need to migrate yuzu to mainline // See if we need to migrate yuzu to mainline
let need_migrate = false let need_migrate = false
for (const package_id in this.$root.metadata.database.packages) { for (const package_id in this.$root.metadata.database.packages) {
var name = this.$root.metadata.database.packages[package_id].name const name = this.$root.metadata.database.packages[package_id].name
if ((name.indexOf('Nightly') !== -1 || name.indexOf('Canary') !== -1)) { if ((name.indexOf('Nightly') !== -1 || name.indexOf('Canary') !== -1)) {
console.log('Migration needed (found "' + name + '", move to mainline)') console.log('Migration needed (found "' + name + '", move to mainline)')
@ -38,7 +38,7 @@ export default {
// Migration step: enable mainline // Migration step: enable mainline
for (const sub_package_id in this.$root.config.packages) { for (const sub_package_id in this.$root.config.packages) {
var name = this.$root.config.packages[sub_package_id].name const name = this.$root.config.packages[sub_package_id].name
if (name === 'yuzu') { if (name === 'yuzu') {
this.$root.config.packages[sub_package_id].default = true this.$root.config.packages[sub_package_id].default = true
break break

File diff suppressed because it is too large Load Diff