🚨 Eslint规则更新

This commit is contained in:
chaos-zhu 2024-08-19 10:39:40 +08:00
parent e333fa5aa3
commit 9f40aeddf5
6 changed files with 25 additions and 14 deletions

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"cSpell.ignoreWords": [
"Onekey"
]
}

View File

@ -28,6 +28,9 @@ module.exports = {
quotes: ['error', 'single'], // 引号single单引 double双引
semi: ['error', 'never'], // 结尾分号never禁止 always必须
'comma-dangle': ['error', 'never'], // 对象拖尾逗号
'space-before-blocks': ['error', 'always'],
'space-in-parens': ['error', 'never'],
'keyword-spacing': ['error', { 'before': true, 'after': true }],
'no-redeclare': ['error', { builtinGlobals: true }], // 禁止重复对象声明
'no-multi-assign': 0,
'no-restricted-globals': 0,

View File

@ -57,7 +57,7 @@ function sendEmail({ service, user, pass }, title, content) {
async function asyncSendNotice(noticeAction, title, content) {
try {
let sw = await getNotifySwByType(noticeAction) // 获取对应动作的通知开关
console.log(noticeAction, sw)
console.log('notify swtich: ', noticeAction, sw)
if (!sw) return
let notifyConfig = await readNotifyConfig()
let { type } = notifyConfig

View File

@ -34,8 +34,10 @@ module.exports = {
'vue/singleline-html-element-content-newline': 0,
// js
'space-before-blocks': ['error', 'always',],
'space-in-parens': ['error', 'never',],
'keyword-spacing': ['error', { 'before': true, 'after': true },],
'no-async-promise-executor': 0,
'comma-dangle': 0,
'import/no-extraneous-dependencies': 0,
'no-console': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',

View File

@ -100,6 +100,7 @@ const rules = reactive({
})
const handleLogin = () => {
console.log(loginForm)
loginFormRefs.value.validate().then(() => {
let { jwtExpires, loginName, pwd } = loginForm
jwtExpires = isSession.value ? '12h' : `${ jwtExpires }h`
@ -124,7 +125,7 @@ const handleLogin = () => {
.then(async () => {
$router.push('/setting')
})
} else{
} else {
$router.push('/')
}
})

View File

@ -53,7 +53,7 @@
<el-table-column label="操作">
<template #default="{ row }">
<el-button
v-if="!row.pendding"
v-if="!row.pending"
v-show="row.id !== 'own'"
:loading="row.loading"
type="danger"
@ -174,7 +174,7 @@ const loading = ref(false)
const formVisible = ref(false)
const socket = ref(null)
let recordList = ref([])
let penddingRecord = ref([])
let pendingRecord = ref([])
let checkAll = ref(false)
let indeterminate = ref(false)
const updateFormRef = ref(null)
@ -194,13 +194,13 @@ let isExecuting = computed(() => timeRemaining.value > 0)
const hasConfigHostList = computed(() => hostList.value.filter(item => item.isConfig))
const tableData = computed(() => {
return penddingRecord.value.concat(recordList.value).map(item => {
return pendingRecord.value.concat(recordList.value).map(item => {
item.loading = false
return item
})
})
const expandRows = computed(() => {
let rows = tableData.value.filter(item => item.pendding).map(item => item.id)
let rows = tableData.value.filter(item => item.pending).map(item => item.id)
return rows
})
@ -240,7 +240,7 @@ const createExecShell = (hosts = [], command = 'ls', timeout = 60) => {
console.log('onekey socket已连接', socket.value.id)
socket.value.on('ready', () => {
penddingRecord.value = [] //
pendingRecord.value = [] //
})
socket.value.emit('create', { hosts, token: token.value, command, timeout })
@ -249,8 +249,8 @@ const createExecShell = (hosts = [], command = 'ls', timeout = 60) => {
loading.value = false
if (Array.isArray(result) && result.length > 0) {
// console.log('output', result)
result = result.map(item => ({ ...item, pendding: true }))
penddingRecord.value = result
result = result.map(item => ({ ...item, pending: true }))
pendingRecord.value = result
nextTick(() => {
document.querySelectorAll('.detail_content_box').forEach(container => {
container.scrollTop = container.scrollHeight
@ -267,8 +267,8 @@ const createExecShell = (hosts = [], command = 'ls', timeout = 60) => {
})
if (Array.isArray(result) && result.length > 0) {
// console.log('output', result)
result = result.map(item => ({ ...item, pendding: true }))
penddingRecord.value = result
result = result.map(item => ({ ...item, pending: true }))
pendingRecord.value = result
}
})
socket.value.on('create_fail', (reason) => {
@ -374,7 +374,7 @@ function execOnekey() {
if (hosts.length === 0) {
return $message.error('请选择主机')
}
await getOnekeyRecord() // penddingRecordlist
await getOnekeyRecord() // pendingRecordlist
createExecShell(hosts, command, timeout)
formVisible.value = false
})
@ -399,7 +399,7 @@ const handleRemoveAll = async () => {
})
.then(async () => {
await $api.deleteOnekeyRecord('ALL')
penddingRecord.value = []
pendingRecord.value = []
await getOnekeyRecord()
$message.success('success')
})