-
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #331 from getmango/feature/eslint
Add ESLint
- Loading branch information
Showing
20 changed files
with
1,819 additions
and
1,699 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { requireConfigFile: false }, | ||
plugins: ['prettier'], | ||
rules: { | ||
eqeqeq: ['error', 'always'], | ||
'object-shorthand': ['error', 'always'], | ||
'prettier/prettier': 'error', | ||
'no-var': 'error', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 80, | ||
"tabWidth": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,17 +6,22 @@ | |
"author": "Alex Ling <[email protected]>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@babel/eslint-parser": "^7.18.9", | ||
"@babel/preset-env": "^7.11.5", | ||
"all-contributors-cli": "^6.19.0", | ||
"eslint": "^8.22.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"gulp": "^4.0.2", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-babel-minify": "^0.5.1", | ||
"gulp-less": "^4.0.1", | ||
"gulp-minify-css": "^1.2.4", | ||
"less": "^3.11.3" | ||
"less": "^3.11.3", | ||
"prettier": "^2.7.1" | ||
}, | ||
"scripts": { | ||
"uglify": "gulp" | ||
"uglify": "gulp", | ||
"lint": "eslint public/js *.js --ext .js" | ||
}, | ||
"dependencies": { | ||
"@fortawesome/fontawesome-free": "^5.14.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,56 @@ | ||
const component = () => { | ||
return { | ||
progress: 1.0, | ||
generating: false, | ||
scanning: false, | ||
scanTitles: 0, | ||
scanMs: -1, | ||
themeSetting: '', | ||
return { | ||
progress: 1.0, | ||
generating: false, | ||
scanning: false, | ||
scanTitles: 0, | ||
scanMs: -1, | ||
themeSetting: '', | ||
|
||
init() { | ||
this.getProgress(); | ||
setInterval(() => { | ||
this.getProgress(); | ||
}, 5000); | ||
init() { | ||
this.getProgress(); | ||
setInterval(() => { | ||
this.getProgress(); | ||
}, 5000); | ||
|
||
const setting = loadThemeSetting(); | ||
this.themeSetting = setting.charAt(0).toUpperCase() + setting.slice(1); | ||
}, | ||
themeChanged(event) { | ||
const newSetting = $(event.currentTarget).val().toLowerCase(); | ||
saveThemeSetting(newSetting); | ||
setTheme(); | ||
}, | ||
scan() { | ||
if (this.scanning) return; | ||
this.scanning = true; | ||
this.scanMs = -1; | ||
this.scanTitles = 0; | ||
$.post(`${base_url}api/admin/scan`) | ||
.then(data => { | ||
this.scanMs = data.milliseconds; | ||
this.scanTitles = data.titles; | ||
}) | ||
.catch(e => { | ||
alert('danger', `Failed to trigger a scan. Error: ${e}`); | ||
}) | ||
.always(() => { | ||
this.scanning = false; | ||
}); | ||
}, | ||
generateThumbnails() { | ||
if (this.generating) return; | ||
this.generating = true; | ||
this.progress = 0.0; | ||
$.post(`${base_url}api/admin/generate_thumbnails`) | ||
.then(() => { | ||
this.getProgress() | ||
}); | ||
}, | ||
getProgress() { | ||
$.get(`${base_url}api/admin/thumbnail_progress`) | ||
.then(data => { | ||
this.progress = data.progress; | ||
this.generating = data.progress > 0; | ||
}); | ||
}, | ||
}; | ||
const setting = loadThemeSetting(); | ||
this.themeSetting = setting.charAt(0).toUpperCase() + setting.slice(1); | ||
}, | ||
themeChanged(event) { | ||
const newSetting = $(event.currentTarget).val().toLowerCase(); | ||
saveThemeSetting(newSetting); | ||
setTheme(); | ||
}, | ||
scan() { | ||
if (this.scanning) return; | ||
this.scanning = true; | ||
this.scanMs = -1; | ||
this.scanTitles = 0; | ||
$.post(`${base_url}api/admin/scan`) | ||
.then((data) => { | ||
this.scanMs = data.milliseconds; | ||
this.scanTitles = data.titles; | ||
}) | ||
.catch((e) => { | ||
alert('danger', `Failed to trigger a scan. Error: ${e}`); | ||
}) | ||
.always(() => { | ||
this.scanning = false; | ||
}); | ||
}, | ||
generateThumbnails() { | ||
if (this.generating) return; | ||
this.generating = true; | ||
this.progress = 0.0; | ||
$.post(`${base_url}api/admin/generate_thumbnails`).then(() => { | ||
this.getProgress(); | ||
}); | ||
}, | ||
getProgress() { | ||
$.get(`${base_url}api/admin/thumbnail_progress`).then((data) => { | ||
this.progress = data.progress; | ||
this.generating = data.progress > 0; | ||
}); | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const alert = (level, text) => { | ||
$('#alert').empty(); | ||
const html = `<div class="uk-alert-${level}" uk-alert><a class="uk-alert-close" uk-close></a><p>${text}</p></div>`; | ||
$('#alert').append(html); | ||
$("html, body").animate({ scrollTop: 0 }); | ||
$('#alert').empty(); | ||
const html = `<div class="uk-alert-${level}" uk-alert><a class="uk-alert-close" uk-close></a><p>${text}</p></div>`; | ||
$('#alert').append(html); | ||
$('html, body').animate({ scrollTop: 0 }); | ||
}; |
Oops, something went wrong.