Skip to content

Commit

Permalink
eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gaplo917 committed May 12, 2023
1 parent 2dc4040 commit df0cacd
Show file tree
Hide file tree
Showing 22 changed files with 126 additions and 57 deletions.
9 changes: 7 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
"ionic": "readonly",
"moment": "readonly"
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 2018
"ecmaVersion": 2018,
"sourceType": "module",
"allowImportExportEverywhere": true
},
"rules": {
"standard/no-callback-literal": 0
"standard/no-callback-literal": 0,
"n/no-callback-literal": 0,
"no-case-declarations": 0
}
}
60 changes: 60 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "webpack serve --mode=development --node-env=development ",
"build": "webpack --mode=production --node-env=production",
"lint": "eslint --fix ./src --ext .js gulpfile.js",
"lint": "eslint --fix ./src --ext .js webpack.config.js",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production --node-env=production",
"watch": "webpack --watch"
Expand All @@ -30,6 +30,8 @@
},
"devDependencies": {
"@babel/core": "^7.21.8",
"@babel/eslint-parser": "^7.21.8",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.21.5",
"@webpack-cli/generators": "^3.0.3",
"babel-loader": "^9.1.0",
Expand Down
6 changes: 3 additions & 3 deletions src/es6/core/bridge/Bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function createIOSNativeBride (cb) {
return window.WVJBCallbacks.push(callback)
}
window.WVJBCallbacks = [callback]
var WVJBIframe = document.createElement('iframe')
const WVJBIframe = document.createElement('iframe')
WVJBIframe.style.display = 'none'
WVJBIframe.src = 'https://__bridge_loaded__'
document.documentElement.appendChild(WVJBIframe)
Expand Down Expand Up @@ -137,8 +137,8 @@ export function createAndroidNativeBridge (cb) {
const uid = uuid()

port.postMessage(JSON.stringify({
uid: uid,
channel: channel,
uid,
channel,
data: JSON.stringify(opt)
}))

Expand Down
2 changes: 1 addition & 1 deletion src/es6/core/bridge/HybridHttp.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class HybridHttp {

this.ngToast.danger({
dismissOnTimeout: true,
content: `<i class="ion-network"> 你的網絡不穩定,請重新嘗試!</i>`,
content: '<i class="ion-network"> 你的網絡不穩定,請重新嘗試!</i>',
combineDuplications: true
})

Expand Down
5 changes: 1 addition & 4 deletions src/es6/core/cheerio-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,9 @@ self.addEventListener('message', function (ev) {
})
break
case 'responseContainText':
const { text } = ev.data
const responseText = html
const result = includes(responseText, text)
self.postMessage({
topic,
data: { responseText, result }
data: { responseText: html, result: includes(html, ev.data.text) }
})
break

Expand Down
2 changes: 1 addition & 1 deletion src/es6/core/controller/AboutController.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class AboutController {
if (Bridge.isAvailable()) {
Bridge.callHandler(Channel.iap)
} else {
this.ngToast.info(`<i class="ion-ios-timer-outline">請使用 iOS 或 Android App 訂閱</i>`)
this.ngToast.info('<i class="ion-ios-timer-outline">請使用 iOS 或 Android App 訂閱</i>')
}
}
}
4 changes: 2 additions & 2 deletions src/es6/core/controller/CMUsersController.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class CMUsersController {
$scope.$on('$ionicView.loaded', (e) => {
AuthService.isLoggedIn().safeApply($scope, isLoggedIn => {
if (!isLoggedIn) {
ngToast.danger(`<i class="ion-alert-circled"> IR 內容管理需要會員權限,請先登入!</i>`)
ngToast.danger('<i class="ion-alert-circled"> IR 內容管理需要會員權限,請先登入!</i>')
this.onBack()
}
}).subscribe()
Expand Down Expand Up @@ -138,7 +138,7 @@ export class CMUsersController {
author: JSON.stringify(author)
})
} else {
this.ngToast.danger(`<i class="ion-alert-circled"> 查看會員需要會員權根,請先登入!</i>`)
this.ngToast.danger('<i class="ion-alert-circled"> 查看會員需要會員權根,請先登入!</i>')
}
}).subscribe()
}
Expand Down
8 changes: 4 additions & 4 deletions src/es6/core/controller/ChatDetailController.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class ChatDetailController {
// must exist in the list
this.recipient = {
id: this.recipientId,
username: username
username
}

this.messages = messages
Expand All @@ -69,7 +69,7 @@ export class ChatDetailController {
const { $timeout, actionUrl, hiddenFormInputs, messageInput: message } = this
if (message === '') {
// empty input
this.ngToast.danger(`<i class="ion-alert-circled"> 不能發送空白訊息!</i>`)
this.ngToast.danger('<i class="ion-alert-circled"> 不能發送空白訊息!</i>')
return
}
const spinnerHtml = `
Expand All @@ -93,7 +93,7 @@ export class ChatDetailController {
method: 'POST',
url: actionUrl,
data: {
message: message,
message,
...hiddenFormInputs
},
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
Expand Down Expand Up @@ -122,7 +122,7 @@ export class ChatDetailController {
requestComposeDialog () {
if (Bridge.isAvailable()) {
Bridge.callHandler(Channel.composeDialog, {
title: `發送訊息`,
title: '發送訊息',
positiveText: '發送',
cancelText: '取消',
placeholder: '訊息'
Expand Down
6 changes: 3 additions & 3 deletions src/es6/core/controller/ChatListController.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ export class ChatListController {
AuthService.getUsername(),
(isLoggedIn, username) => {
return {
isLoggedIn: isLoggedIn,
username: username
isLoggedIn,
username
}
}
).safeApply($scope, ({ isLoggedIn, username }) => {
if (isLoggedIn) {
this.scope.$emit('accountTabUpdate', username)
this.loadChats()
} else {
this.ngToast.danger(`<i class="ion-alert-circled"> 私人訊息需要會員權限,請先登入!</i>`)
this.ngToast.danger('<i class="ion-alert-circled"> 私人訊息需要會員權限,請先登入!</i>')
this.onBack()
}
}).subscribe()
Expand Down
2 changes: 1 addition & 1 deletion src/es6/core/controller/ContentManageController.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class ContentManageController {
$scope.$on('$ionicView.loaded', (e) => {
AuthService.isLoggedIn().safeApply($scope, isLoggedIn => {
if (!isLoggedIn) {
ngToast.danger(`<i class="ion-alert-circled"> IR 內容管理需要會員權限,請先登入!</i>`)
ngToast.danger('<i class="ion-alert-circled"> IR 內容管理需要會員權限,請先登入!</i>')
this.onBack()
} else {
this.isReady = true
Expand Down
6 changes: 3 additions & 3 deletions src/es6/core/controller/MyPostController.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class MyPostController extends IRLifecycleOwner {
if (isLoggedIn) {
this.loadMyPosts()
} else {
this.ngToast.danger(`<i class="ion-alert-circled"> 我的帖子需要會員權限,請先登入!</i>`)
this.ngToast.danger('<i class="ion-alert-circled"> 我的帖子需要會員權限,請先登入!</i>')
this.onBack()
}
}).subscribe()
Expand Down Expand Up @@ -146,10 +146,10 @@ export class MyPostController extends IRLifecycleOwner {
})
.safeApply(this.scope, resp => {
if (resp.status === 200) {
this.ngToast.success(`<i class="ion-ios-checkmark"> 成功移除!</i>`)
this.ngToast.success('<i class="ion-ios-checkmark"> 成功移除!</i>')
this.myposts = this.myposts.filter(it => it.post.id !== id)
} else {
this.ngToast.danger(`<i class="ion-alert-circled"> 移除失敗!</i>`)
this.ngToast.danger('<i class="ion-alert-circled"> 移除失敗!</i>')
}
}).subscribe()
}
Expand Down
2 changes: 1 addition & 1 deletion src/es6/core/controller/MyReplyController.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class MyReplyController extends IRLifecycleOwner {
if (isLoggedIn) {
this.loadMyReplies()
} else {
this.ngToast.danger(`<i class="ion-alert-circled"> 我的回覆需要會員權限,請先登入!</i>`)
this.ngToast.danger('<i class="ion-alert-circled"> 我的回覆需要會員權限,請先登入!</i>')
this.onBack()
}
}).subscribe()
Expand Down
2 changes: 1 addition & 1 deletion src/es6/core/controller/NotificationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class NotificationController {
if (isLoggedIn) {
this.loadNotifications()
} else {
this.ngToast.danger(`<i class="ion-alert-circled"> 帖子消息需要會員權限,請先登入!</i>`)
this.ngToast.danger('<i class="ion-alert-circled"> 帖子消息需要會員權限,請先登入!</i>')
this.onBack()
}
}).subscribe()
Expand Down
4 changes: 2 additions & 2 deletions src/es6/core/controller/TopicListController.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,15 @@ export class TopicListController {
myTopicTutorial () {
swal({
animation: false,
html: `這個是範例版塊。你要點擊 HKEPC 的版塊右邊的<span style="color: #FF6D00; font-size:24px; font-weight: 500"> +1 </span>才能提升喜好程度!`,
html: '這個是範例版塊。你要點擊 HKEPC 的版塊右邊的<span style="color: #FF6D00; font-size:24px; font-weight: 500"> +1 </span>才能提升喜好程度!',
showCancelButton: false
})
}

encourageTopicTutorial () {
swal({
animation: false,
html: `這個是範例版塊。你要點擊右下角 <i class="ion-ios-bookmarks-outline"></i> ,然後開始編緝你的論壇版塊喜好程度!`,
html: '這個是範例版塊。你要點擊右下角 <i class="ion-ios-bookmarks-outline"></i> ,然後開始編緝你的論壇版塊喜好程度!',
showCancelButton: false
})
}
Expand Down
6 changes: 3 additions & 3 deletions src/es6/core/controller/WriteReportController.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class WriteReportController {
if (result) {
swal.close()

this.ngToast.success(`<i class="ion-ios-checkmark"> 成功報告!</i>`)
this.ngToast.success('<i class="ion-ios-checkmark"> 成功報告!</i>')

this.onBack()
} else {
Expand All @@ -106,13 +106,13 @@ export class WriteReportController {
() => swal({
animation: false,
title: '發佈失敗',
text: `網絡異常,請重新嘗試!`,
text: '網絡異常,請重新嘗試!',
type: 'error',
confirmButtonText: '確定'
})
)
} else {
this.ngToast.danger(`<i class="ion-alert-circled"> 標題或內容不能空白!</i>`)
this.ngToast.danger('<i class="ion-alert-circled"> 標題或內容不能空白!</i>')
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/es6/core/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default angular.module('starter.directives', [])
const splits = [content.slice(0, selectionStart), content.slice(selectionStart)]

const openTag = `[size=${size}]`
const closeTag = `[/size]`
const closeTag = '[/size]'

scope.contentModel = `${splits[0]}${openTag}${closeTag}${splits[1]}`

Expand All @@ -138,7 +138,7 @@ export default angular.module('starter.directives', [])
const splits = [content.slice(0, selectionStart), content.slice(selectionStart)]

const openTag = `[color=${size}]`
const closeTag = `[/color]`
const closeTag = '[/color]'

scope.contentModel = `${splits[0]}${openTag}${closeTag}${splits[1]}`

Expand Down Expand Up @@ -301,7 +301,7 @@ export default angular.module('starter.directives', [])
.directive('irSpinner', function () {
return {
restrict: 'E',
template: `<div class="icon"></div>`
template: '<div class="icon"></div>'

}
})
Expand Down
Loading

0 comments on commit df0cacd

Please sign in to comment.