mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-18 17:21:33 +00:00
feat: update src/js/.eslintrc.js
enable no-undefined rule, and disable no-void rule
This commit is contained in:
parent
e7c91b8ad0
commit
364e16af7f
@ -12,6 +12,8 @@ module.exports = {
|
||||
'plugin:compat/recommended'
|
||||
],
|
||||
rules: {
|
||||
'no-undefined': 'error',
|
||||
'no-void': 0,
|
||||
'object-shorthand': [
|
||||
'error',
|
||||
'always'
|
||||
|
@ -763,7 +763,7 @@ page.getUploads = (params = {}) => {
|
||||
div.className = 'image-container column'
|
||||
div.dataset.id = upload.id
|
||||
|
||||
if (upload.thumb === undefined) {
|
||||
if (typeof upload.thumb === 'undefined') {
|
||||
div.innerHTML = `<a class="image" href="${upload.file}" target="_blank"><h1 class="title">${upload.extname || 'N/A'}</h1></a>`
|
||||
} else {
|
||||
div.innerHTML = `<a class="image" href="${upload.file}" target="_blank"><img alt="${upload.name}" data-src="${upload.thumb}"/></a>`
|
||||
@ -934,7 +934,7 @@ page.setUploadsView = (view, element) => {
|
||||
|
||||
if (view === 'list') {
|
||||
delete localStorage[lsKeys.viewType[page.currentView]]
|
||||
page.views[page.currentView].type = undefined
|
||||
page.views[page.currentView].type = void 0
|
||||
} else {
|
||||
localStorage[lsKeys.viewType[page.currentView]] = view
|
||||
page.views[page.currentView].type = view
|
||||
@ -3127,7 +3127,7 @@ page.getStatistics = (params = {}) => {
|
||||
case 'byteUsage': {
|
||||
if (typeof value === 'object') {
|
||||
// Reasoning: https://github.com/sebhildebrandt/systeminformation/issues/464#issuecomment-756406053
|
||||
const totalForPercentage = value.available !== undefined
|
||||
const totalForPercentage = typeof value.available !== 'undefined'
|
||||
? (value.used + value.available)
|
||||
: value.total
|
||||
parsed = `${page.getPrettyBytes(value.used)} / ${page.getPrettyBytes(value.total)} (${(value.used / totalForPercentage * 100).toFixed(2)}%)`
|
||||
|
@ -850,7 +850,7 @@ page.prepareUploadConfig = () => {
|
||||
default: page.fileIdentifierLength.default,
|
||||
round: true
|
||||
}
|
||||
: undefined,
|
||||
: void 0,
|
||||
help: true, // true means auto-generated, for number-based configs only
|
||||
disabled: fileIdentifierLength && page.fileIdentifierLength.force
|
||||
},
|
||||
@ -979,9 +979,9 @@ page.prepareUploadConfig = () => {
|
||||
} else {
|
||||
const stored = localStorage[lsKeys[key]]
|
||||
if (Array.isArray(conf.select)) {
|
||||
value = conf.select.find(sel => sel.value === stored)
|
||||
? stored
|
||||
: undefined
|
||||
if (conf.select.find(sel => sel.value === stored)) {
|
||||
value = stored
|
||||
}
|
||||
} else {
|
||||
value = stored
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ render.showTogglePrompt = () => {
|
||||
if (value === 'reload') {
|
||||
render.do(true)
|
||||
} else if (value) {
|
||||
const newValue = div.querySelector('#swalRender').checked ? undefined : '0'
|
||||
const newValue = div.querySelector('#swalRender').checked ? void 0 : '0'
|
||||
if (newValue !== localStorage[render.lsKey]) {
|
||||
if (newValue) localStorage[render.lsKey] = newValue
|
||||
else localStorage.removeItem(render.lsKey)
|
||||
|
Loading…
Reference in New Issue
Block a user