Fix .eslintrc.json for client-side JS files

I can't remember why I extended the config with "eslint:recommended" instead of "standard" back then. I know I wanted to force an older ecmaversion, but even then it would still work just fine with standard.
I've fixed it now to use standard. I've also applied auto-fix to dashboard.js and home.js, which fixed some stray or missing whitespaces, as well as the indenting of case's inside switch statement.
This commit is contained in:
Bobby Wibowo 2018-09-07 22:02:04 +07:00
parent 7587bfa408
commit ed7612bd89
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
3 changed files with 44 additions and 65 deletions

View File

@ -7,33 +7,16 @@
"browser": true
},
"extends": [
"eslint:recommended"
"standard"
],
"rules": {
"curly": [
"error",
"all"
],
"no-console": 0,
"semi": [
"error",
"never"
],
"space-before-function-paren": [
"error",
{
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
],
"quotes": [
"error",
"single"
],
"indent": [
"error",
2
]
}
}

View File

@ -141,43 +141,43 @@ page.domClick = function (event) {
var action = element.dataset.action
switch (action) {
case 'page-prev':
if (page.currentView.pageNum === 0) {
return swal('Can\'t do that!', 'This is already the first page!', 'warning')
}
return page.getUploads(page.currentView.album, page.currentView.pageNum - 1, element)
case 'page-next':
return page.getUploads(page.currentView.album, page.currentView.pageNum + 1, element)
case 'view-list':
return page.setFilesView('list', element)
case 'view-thumbs':
return page.setFilesView('thumbs', element)
case 'clear-selection':
return page.clearSelection()
case 'add-selected-files-to-album':
return page.addSelectedFilesToAlbum()
case 'bulk-delete':
return page.deleteSelectedFiles()
case 'select-file':
return page.selectFile(element, event)
case 'add-to-album':
return page.addSingleFileToAlbum(id)
case 'delete-file':
return page.deleteFile(id)
case 'select-all-files':
return page.selectAllFiles(element)
case 'display-thumbnail':
return page.displayThumbnail(id)
case 'delete-file-by-names':
return page.deleteFileByNames()
case 'submit-album':
return page.submitAlbum(element)
case 'edit-album':
return page.editAlbum(id)
case 'delete-album':
return page.deleteAlbum(id)
case 'get-new-token':
return page.getNewToken(element)
case 'page-prev':
if (page.currentView.pageNum === 0) {
return swal('Can\'t do that!', 'This is already the first page!', 'warning')
}
return page.getUploads(page.currentView.album, page.currentView.pageNum - 1, element)
case 'page-next':
return page.getUploads(page.currentView.album, page.currentView.pageNum + 1, element)
case 'view-list':
return page.setFilesView('list', element)
case 'view-thumbs':
return page.setFilesView('thumbs', element)
case 'clear-selection':
return page.clearSelection()
case 'add-selected-files-to-album':
return page.addSelectedFilesToAlbum()
case 'bulk-delete':
return page.deleteSelectedFiles()
case 'select-file':
return page.selectFile(element, event)
case 'add-to-album':
return page.addSingleFileToAlbum(id)
case 'delete-file':
return page.deleteFile(id)
case 'select-all-files':
return page.selectAllFiles(element)
case 'display-thumbnail':
return page.displayThumbnail(id)
case 'delete-file-by-names':
return page.deleteFileByNames()
case 'submit-album':
return page.submitAlbum(element)
case 'edit-album':
return page.editAlbum(id)
case 'delete-album':
return page.deleteAlbum(id)
case 'get-new-token':
return page.getNewToken(element)
}
}
@ -1246,7 +1246,6 @@ page.setFileLength = function (fileLength, element) {
page.changeToken = function () {
axios.get('api/tokens')
.then(function (response) {
if (response.data.success === false) {
if (response.data.description === 'No token provided') {
return page.verifyToken(page.token)
@ -1275,7 +1274,6 @@ page.changeToken = function () {
' </a>\n' +
' </div>\n' +
'</div>'
})
.catch(function (error) {
console.log(error)
@ -1385,7 +1383,6 @@ page.sendNewPassword = function (pass, element) {
page.isLoading(element, false)
return swal('An error occurred!', 'There was an error with the request, please check the console for more information.', 'error')
})
}
page.setActiveMenu = function (activeItem) {

View File

@ -25,7 +25,8 @@ var imageExtensions = ['.webp', '.jpg', '.jpeg', '.bmp', '.gif', '.png']
page.checkIfPublic = function () {
axios.get('api/check')
.then(function (response) { page.private = response.data.private
.then(function (response) {
page.private = response.data.private
page.enableUserAccounts = response.data.enableUserAccounts
page.maxFileSize = response.data.maxFileSize
page.chunkSize = response.data.chunkSize
@ -38,7 +39,6 @@ page.checkIfPublic = function () {
button.innerText = 'Error occurred. Reload the page?'
return swal('An error occurred!', 'There was an error with the request, please check the console for more information.', 'error')
})
}
page.preparePage = function () {
@ -302,12 +302,12 @@ page.uploadUrls = function (button) {
if (button.classList.contains('is-loading')) { return }
button.classList.add('is-loading')
function done(error) {
function done (error) {
if (error) { swal('An error occurred!', error, 'error') }
button.classList.remove('is-loading')
}
function run() {
function run () {
var albumid = page.album
var previewsContainer = tabDiv.getElementsByClassName('uploads')[0]
var urls = document.getElementById('urls').value
@ -333,12 +333,12 @@ page.uploadUrls = function (button) {
}
})
function post(i) {
function post (i) {
if (i === files.length) { return done() }
var file = files[i]
function posted(result) {
function posted (result) {
file.previewElement.querySelector('.progress').style.display = 'none'
if (result.success) {
page.updateTemplate(file, result.files[0])
@ -477,7 +477,6 @@ page.createAlbum = function () {
return swal('An error occurred!', 'There was an error with the request, please check the console for more information.', 'error')
})
})
}
// Handle image paste event