mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
Upgraded to ESLint 7
This commit is contained in:
parent
0307730251
commit
c40478dd0a
46
.eslintrc.js
46
.eslintrc.js
@ -1,37 +1,25 @@
|
||||
module.exports = {
|
||||
"root": true,
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9 // 2018
|
||||
root: true,
|
||||
parserOptions: {
|
||||
ecmaVersion: 9 // 2018
|
||||
},
|
||||
"env": {
|
||||
"node": true
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
"extends": [
|
||||
"standard"
|
||||
extends: [
|
||||
'standard'
|
||||
],
|
||||
"rules": {
|
||||
"curly": [
|
||||
"error",
|
||||
"multi",
|
||||
"consistent"
|
||||
rules: {
|
||||
curly: [
|
||||
'error',
|
||||
'multi',
|
||||
'consistent'
|
||||
],
|
||||
"no-throw-literal": 0,
|
||||
"no-var": "error",
|
||||
"prefer-const": [
|
||||
"error",
|
||||
{
|
||||
"destructuring": "any",
|
||||
"ignoreReadBeforeAssign": false
|
||||
}
|
||||
'no-throw-literal': 0,
|
||||
'object-shorthand': [
|
||||
'error',
|
||||
'always'
|
||||
],
|
||||
"object-shorthand": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"standard/no-callback-literal": 0
|
||||
'standard/no-callback-literal': 0
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ const gulp = require('gulp')
|
||||
const cssnano = require('cssnano')
|
||||
const del = require('del')
|
||||
const buble = require('gulp-buble')
|
||||
const eslint = require('gulp-eslint')
|
||||
const eslint = require('gulp-eslint7')
|
||||
const gulpif = require('gulp-if')
|
||||
const nodemon = require('gulp-nodemon')
|
||||
const postcss = require('gulp-postcss')
|
||||
|
@ -59,17 +59,17 @@
|
||||
"bulma": "~0.9.1",
|
||||
"cssnano": "~4.1.10",
|
||||
"del": "~6.0.0",
|
||||
"eslint": "~6.8.0",
|
||||
"eslint-config-standard": "~14.1.1",
|
||||
"eslint": "~7.12.1",
|
||||
"eslint-config-standard": "~16.0.0",
|
||||
"eslint-plugin-compat": "~3.8.0",
|
||||
"eslint-plugin-import": "~2.22.1",
|
||||
"eslint-plugin-node": "~11.1.0",
|
||||
"eslint-plugin-promise": "~4.2.1",
|
||||
"eslint-plugin-standard": "~4.0.1",
|
||||
"eslint-plugin-standard": "~4.0.2",
|
||||
"gulp": "~4.0.2",
|
||||
"gulp-buble": "~0.9.0",
|
||||
"gulp-cli": "~2.3.0",
|
||||
"gulp-eslint": "~6.0.0",
|
||||
"gulp-eslint7": "~0.3.0",
|
||||
"gulp-if": "~3.0.0",
|
||||
"gulp-nodemon": "~2.5.0",
|
||||
"gulp-postcss": "~9.0.0",
|
||||
|
@ -1,36 +1,25 @@
|
||||
module.exports = {
|
||||
"root": true,
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 7, // 2016
|
||||
"sourceType": "script"
|
||||
root: true,
|
||||
parserOptions: {
|
||||
ecmaVersion: 7, // 2016
|
||||
sourceType: 'script'
|
||||
},
|
||||
"env": {
|
||||
"browser": true
|
||||
env: {
|
||||
browser: true
|
||||
},
|
||||
"extends": [
|
||||
"standard",
|
||||
"plugin:compat/recommended"
|
||||
extends: [
|
||||
'standard',
|
||||
'plugin:compat/recommended'
|
||||
],
|
||||
"rules": {
|
||||
"curly": [
|
||||
"error",
|
||||
"multi",
|
||||
"consistent"
|
||||
rules: {
|
||||
curly: [
|
||||
'error',
|
||||
'multi',
|
||||
'consistent'
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"object-shorthand": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"prefer-const": [
|
||||
"error",
|
||||
{
|
||||
"destructuring": "any",
|
||||
"ignoreReadBeforeAssign": false
|
||||
}
|
||||
'object-shorthand': [
|
||||
'error',
|
||||
'always'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -625,8 +625,9 @@ page.getUploads = (params = {}) => {
|
||||
<i class="icon-cancel"></i>
|
||||
</span>
|
||||
</a>
|
||||
${params.all ? '' : `
|
||||
<a class="button is-small is-warning is-outlined" title="Bulk add to album" data-action="add-selected-uploads-to-album">
|
||||
${params.all
|
||||
? ''
|
||||
: `<a class="button is-small is-warning is-outlined" title="Bulk add to album" data-action="add-selected-uploads-to-album">
|
||||
<span class="icon">
|
||||
<i class="icon-plus"></i>
|
||||
</span>
|
||||
@ -736,12 +737,13 @@ page.getUploads = (params = {}) => {
|
||||
div.innerHTML += `
|
||||
<input type="checkbox" class="checkbox" title="Select" data-index="${i}" data-action="select"${upload.selected ? ' checked' : ''}>
|
||||
<div class="controls">
|
||||
${upload.thumb ? `
|
||||
<a class="button is-small is-primary" title="Display preview" data-action="display-preview">
|
||||
${upload.thumb
|
||||
? `<a class="button is-small is-primary" title="Display preview" data-action="display-preview">
|
||||
<span class="icon">
|
||||
<i class="${upload.type !== 'other' ? `icon-${upload.type}` : 'icon-doc-inv'}"></i>
|
||||
</span>
|
||||
</a>` : ''}
|
||||
</a>`
|
||||
: ''}
|
||||
<a class="button is-small is-info clipboard-js" title="Copy link to clipboard" data-clipboard-text="${upload.file}">
|
||||
<span class="icon">
|
||||
<i class="icon-clipboard"></i>
|
||||
@ -762,8 +764,9 @@ page.getUploads = (params = {}) => {
|
||||
<p class="name" title="${upload.file}">${upload.name}</p>
|
||||
${showOriginalNames ? `<p class="originalname" title="${upload.original}">${upload.original}</p>` : ''}
|
||||
<p class="prettybytes">${upload.appendix ? `<span>${upload.appendix}</span> – ` : ''}${upload.prettyBytes}</p>
|
||||
${hasExpiryDateColumn && upload.prettyExpiryDate ? `
|
||||
<p class="prettyexpirydate">EXP: ${upload.prettyExpiryDate}</p>` : ''}
|
||||
${hasExpiryDateColumn && upload.prettyExpiryDate
|
||||
? `<p class="prettyexpirydate">EXP: ${upload.prettyExpiryDate}</p>`
|
||||
: ''}
|
||||
</div>
|
||||
`
|
||||
|
||||
@ -828,8 +831,9 @@ page.getUploads = (params = {}) => {
|
||||
<i class="icon-clipboard"></i>
|
||||
</span>
|
||||
</a>
|
||||
${params.all ? '' : `
|
||||
<a class="button is-small is-warning is-outlined" title="Add to album" data-action="add-to-album">
|
||||
${params.all
|
||||
? ''
|
||||
: `<a class="button is-small is-warning is-outlined" title="Add to album" data-action="add-to-album">
|
||||
<span class="icon">
|
||||
<i class="icon-plus"></i>
|
||||
</span>
|
||||
@ -1098,8 +1102,8 @@ page.uploadFiltersHelp = element => {
|
||||
const all = Boolean(element.dataset.all)
|
||||
const content = document.createElement('div')
|
||||
content.style = 'text-align: left'
|
||||
content.innerHTML = `${all ? `
|
||||
There are 2 filter keys, namely <b>user</b> (username) and <b>ip</b>.
|
||||
content.innerHTML = `${all
|
||||
? `There are 2 filter keys, namely <b>user</b> (username) and <b>ip</b>.
|
||||
These keys can be specified more than once.
|
||||
For usernames with whitespaces, wrap them with double quotes (<code>"</code>).
|
||||
Special cases such as uploads by non-registered users or have no IPs respectively, use <code>user:-</code> or <code>ip:-</code>.
|
||||
@ -1108,15 +1112,14 @@ page.uploadFiltersHelp = element => {
|
||||
Negation sign can also be used to exclude the special cases mentioned above (i.e. <code>-user:-</code> or <code>-ip:-</code>).
|
||||
|
||||
If you know the ID of a user's album, you can list its uploads with <b>albumid</b> key.
|
||||
Negation sign works for this key as well.
|
||||
` : `
|
||||
There is only 1 filter key, namely <b>albumid</b>.
|
||||
Negation sign works for this key as well.`
|
||||
: `There is only 1 filter key, namely <b>albumid</b>.
|
||||
This key can be specified more than once.
|
||||
Special case such as uploads with no albums, use <code>albumid:-</code>.
|
||||
|
||||
To exclude certain albums while still listing every other uploads, add negation sign (<code>-</code>) before the keys.
|
||||
Negation sign can also be used to exclude the special case mentioned above (i.e. <code>-albumid:-</code>).
|
||||
`}
|
||||
Negation sign can also be used to exclude the special case mentioned above (i.e. <code>-albumid:-</code>).`}
|
||||
|
||||
There are 2 range keys: <b>date</b> (upload date) and <b>expiry</b> (expiry date).
|
||||
Their format is: <code>"YYYY/MM/DD HH:MM:SS-YYYY/MM/DD HH:MM:SS"</code> ("from" date and "to" date respectively).
|
||||
You may specify only one of the dates.
|
||||
@ -1146,8 +1149,10 @@ page.uploadFiltersHelp = element => {
|
||||
Excluding certain keywords is also supported by adding negation sign before the keywords.
|
||||
|
||||
<b>Internal steps:</b>
|
||||
${all ? `- Query uploads passing ALL exclusion filter keys OR matching ANY filter keys, if any.
|
||||
- Refine matches` : '- Filter uploads'} using date key, if any.
|
||||
${all
|
||||
? `- Query uploads passing ALL exclusion filter keys OR matching ANY filter keys, if any.
|
||||
- Refine matches`
|
||||
: '- Filter uploads'} using date key, if any.
|
||||
- Refine matches using expiry key, if any.
|
||||
- Refine matches using type-is keys, if any.
|
||||
- Refine matches using ANY non-keyed keywords, if any.
|
||||
@ -1155,13 +1160,15 @@ page.uploadFiltersHelp = element => {
|
||||
- Sort matches using sorting keys, if any.
|
||||
|
||||
<b>Examples:</b>
|
||||
${all ? `- Uploads from users named "demo" AND/OR "John Doe" AND/OR non-registered users:
|
||||
${all
|
||||
? `- Uploads from users named "demo" AND/OR "John Doe" AND/OR non-registered users:
|
||||
<code>user:demo user:"John Doe" user:-</code>
|
||||
- ALL uploads, but NOT the ones from user named "demo" AND "John Doe":
|
||||
<code>-user:demo -user:"John Doe"</code>
|
||||
- Uploads from IP "127.0.0.1" AND which file names match "*.rar" OR "*.zip":
|
||||
<code>ip:127.0.0.1 *.rar *.zip</code>
|
||||
` : ''}- Uploads without albums:
|
||||
`
|
||||
: ''}- Uploads without albums:
|
||||
<code>albumid:-</code>
|
||||
- ALL uploads, but NOT the ones from album with ID 69:
|
||||
<code>-albumid:69</code>
|
||||
@ -1176,9 +1183,9 @@ page.uploadFiltersHelp = element => {
|
||||
- Sort matches by "size" column in ascending and descending order respectively:
|
||||
<code>${all ? 'user:"John Doe"' : '*.txt'} sort:size</code>
|
||||
<code>*.mp4 ${all ? 'user:- ' : ''}sort:size:d</code>
|
||||
${!page.permissions.moderator ? `
|
||||
<b>Notice:</b> Regular users may face some limitations in the amount of keys that can be used at a time.
|
||||
` : ''}
|
||||
${!page.permissions.moderator
|
||||
? '<b>Notice:</b> Regular users may face some limitations in the amount of keys that can be used at a time.'
|
||||
: ''}
|
||||
<b>Friendly reminder:</b> This window can be scrolled up!
|
||||
`.trim().replace(/^\s*/g, '').replace(/\n/g, '<br>')
|
||||
|
||||
@ -1399,11 +1406,10 @@ page.postBulkDeleteUploads = (params = {}) => {
|
||||
if (!response) return
|
||||
|
||||
if (response.data.success === false)
|
||||
if (response.data.description === 'No token provided') {
|
||||
if (response.data.description === 'No token provided')
|
||||
return page.verifyToken(page.token)
|
||||
} else {
|
||||
else
|
||||
return swal('An error occurred!', response.data.description, 'error')
|
||||
}
|
||||
|
||||
const failed = Array.isArray(response.data.failed) ? response.data.failed : []
|
||||
if (failed.length === params.values.length)
|
||||
@ -1907,11 +1913,10 @@ page.editAlbum = id => {
|
||||
if (!response) return
|
||||
|
||||
if (response.data.success === false)
|
||||
if (response.data.description === 'No token provided') {
|
||||
if (response.data.description === 'No token provided')
|
||||
return page.verifyToken(page.token)
|
||||
} else {
|
||||
else
|
||||
return swal('An error occurred!', response.data.description, 'error')
|
||||
}
|
||||
|
||||
if (response.data.identifier)
|
||||
swal('Success!', `The album's new identifier is: ${response.data.identifier}.`, 'success')
|
||||
@ -1998,11 +2003,10 @@ page.submitAlbum = element => {
|
||||
|
||||
page.updateTrigger(element)
|
||||
if (response.data.success === false)
|
||||
if (response.data.description === 'No token provided') {
|
||||
if (response.data.description === 'No token provided')
|
||||
return page.verifyToken(page.token)
|
||||
} else {
|
||||
else
|
||||
return swal('An error occurred!', response.data.description, 'error')
|
||||
}
|
||||
|
||||
swal('Woohoo!', 'Album was created successfully.', 'success', {
|
||||
buttons: false,
|
||||
@ -2023,11 +2027,10 @@ page.getAlbumsSidebar = () => {
|
||||
if (!response) return
|
||||
|
||||
if (response.data.success === false)
|
||||
if (response.data.description === 'No token provided') {
|
||||
if (response.data.description === 'No token provided')
|
||||
return page.verifyToken(page.token)
|
||||
} else {
|
||||
else
|
||||
return swal('An error occurred!', response.data.description, 'error')
|
||||
}
|
||||
|
||||
const albums = response.data.albums
|
||||
const count = response.data.count
|
||||
@ -2514,11 +2517,10 @@ page.createUser = () => {
|
||||
if (!response) return
|
||||
|
||||
if (response.data.success === false)
|
||||
if (response.data.description === 'No token provided') {
|
||||
if (response.data.description === 'No token provided')
|
||||
return page.verifyToken(page.token)
|
||||
} else {
|
||||
else
|
||||
return swal('An error occurred!', response.data.description, 'error')
|
||||
}
|
||||
|
||||
const div = document.createElement('div')
|
||||
div.innerHTML = `
|
||||
@ -2613,11 +2615,10 @@ page.editUser = id => {
|
||||
if (!response) return
|
||||
|
||||
if (response.data.success === false)
|
||||
if (response.data.description === 'No token provided') {
|
||||
if (response.data.description === 'No token provided')
|
||||
return page.verifyToken(page.token)
|
||||
} else {
|
||||
else
|
||||
return swal('An error occurred!', response.data.description, 'error')
|
||||
}
|
||||
|
||||
let autoClose = true
|
||||
const div = document.createElement('div')
|
||||
|
@ -802,12 +802,14 @@ page.prepareUploadConfig = () => {
|
||||
fileLength: {
|
||||
display: fileIdentifierLength,
|
||||
label: 'File identifier length',
|
||||
number: fileIdentifierLength ? {
|
||||
min: page.fileIdentifierLength.min,
|
||||
max: page.fileIdentifierLength.max,
|
||||
default: page.fileIdentifierLength.default,
|
||||
round: true
|
||||
} : undefined,
|
||||
number: fileIdentifierLength
|
||||
? {
|
||||
min: page.fileIdentifierLength.min,
|
||||
max: page.fileIdentifierLength.max,
|
||||
default: page.fileIdentifierLength.default,
|
||||
round: true
|
||||
}
|
||||
: undefined,
|
||||
help: true, // true means auto-generated, for number-based configs only
|
||||
disabled: fileIdentifierLength && page.fileIdentifierLength.force
|
||||
},
|
||||
@ -820,10 +822,12 @@ page.prepareUploadConfig = () => {
|
||||
stripTags: {
|
||||
display: page.stripTagsConfig,
|
||||
label: 'Strip tags',
|
||||
select: page.stripTagsConfig ? [
|
||||
{ value: page.stripTagsConfig.default ? 'default' : '1', text: 'Yes' },
|
||||
{ value: page.stripTagsConfig.default ? '0' : 'default', text: 'No' }
|
||||
] : null,
|
||||
select: page.stripTagsConfig
|
||||
? [
|
||||
{ value: page.stripTagsConfig.default ? 'default' : '1', text: 'Yes' },
|
||||
{ value: page.stripTagsConfig.default ? '0' : 'default', text: 'No' }
|
||||
]
|
||||
: null,
|
||||
help: `Whether to strip tags (e.g. EXIF) from your uploads.<br>
|
||||
This only applies to regular image${page.stripTagsConfig && page.stripTagsConfig.video ? ' and video' : ''} uploads (i.e. not URL uploads).`,
|
||||
disabled: page.stripTagsConfig && page.stripTagsConfig.force
|
||||
|
Loading…
Reference in New Issue
Block a user