summaryrefslogtreecommitdiff
path: root/public/js/lib
diff options
context:
space:
mode:
authorSheogorath2019-05-31 00:27:56 +0200
committerSheogorath2019-05-31 00:30:29 +0200
commit4da68597f701376307fe8849ed57edd3a80833ed (patch)
treefb50db25c63b3b2cb70426ba3eab42007be60134 /public/js/lib
parent3eca0a74ae3d87a42acb7c7b8e39e2c389e3c96c (diff)
Fix eslint warnings
Since we are about to release it's time to finally fix our linting. This patch basically runs eslint --fix and does some further manual fixes. Also it sets up eslint to fail on every warning on order to make warnings visable in the CI process. There should no functional change be introduced. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
Diffstat (limited to 'public/js/lib')
-rw-r--r--public/js/lib/common/login.js32
-rw-r--r--public/js/lib/editor/utils.js14
-rw-r--r--public/js/lib/syncscroll.js4
3 files changed, 25 insertions, 25 deletions
diff --git a/public/js/lib/common/login.js b/public/js/lib/common/login.js
index 18cd377d..28e5b470 100644
--- a/public/js/lib/common/login.js
+++ b/public/js/lib/common/login.js
@@ -60,22 +60,22 @@ export function checkIfAuth (yesCallback, noCallback) {
if (checkLoginStateChanged()) checkAuth = false
if (!checkAuth || typeof cookieLoginState === 'undefined') {
$.get(`${serverurl}/me`)
- .done(data => {
- if (data && data.status === 'ok') {
- profile = data
- yesCallback(profile)
- setLoginState(true, data.id)
- } else {
- noCallback()
- setLoginState(false)
- }
- })
- .fail(() => {
- noCallback()
- })
- .always(() => {
- checkAuth = true
- })
+ .done(data => {
+ if (data && data.status === 'ok') {
+ profile = data
+ yesCallback(profile)
+ setLoginState(true, data.id)
+ } else {
+ noCallback()
+ setLoginState(false)
+ }
+ })
+ .fail(() => {
+ noCallback()
+ })
+ .always(() => {
+ checkAuth = true
+ })
} else if (cookieLoginState) {
yesCallback(profile)
} else {
diff --git a/public/js/lib/editor/utils.js b/public/js/lib/editor/utils.js
index 36e5c121..d87c7e41 100644
--- a/public/js/lib/editor/utils.js
+++ b/public/js/lib/editor/utils.js
@@ -51,7 +51,7 @@ export function insertText (cm, text, cursorEnd = 0) {
let cursor = cm.getCursor()
cm.replaceSelection(text, cursor, cursor)
cm.focus()
- cm.setCursor({line: cursor.line, ch: cursor.ch + cursorEnd})
+ cm.setCursor({ line: cursor.line, ch: cursor.ch + cursorEnd })
}
export function insertLink (cm, isImage) {
@@ -80,7 +80,7 @@ export function insertLink (cm, isImage) {
cm.setSelections(ranges)
} else {
cm.replaceRange(symbol + linkEnd, cursor, cursor)
- cm.setCursor({line: cursor.line, ch: cursor.ch + symbol.length + linkEnd.length})
+ cm.setCursor({ line: cursor.line, ch: cursor.ch + symbol.length + linkEnd.length })
}
}
cm.focus()
@@ -88,8 +88,8 @@ export function insertLink (cm, isImage) {
export function insertHeader (cm) {
let cursor = cm.getCursor()
- let startOfLine = {line: cursor.line, ch: 0}
- let startOfLineText = cm.getRange(startOfLine, {line: cursor.line, ch: 1})
+ let startOfLine = { line: cursor.line, ch: 0 }
+ let startOfLineText = cm.getRange(startOfLine, { line: cursor.line, ch: 1 })
// See if it is already a header
if (startOfLineText === '#') {
cm.replaceRange('#', startOfLine, startOfLine)
@@ -108,14 +108,14 @@ export function insertOnStartOfLines (cm, symbol) {
if (!range.empty()) {
const from = range.from()
const to = range.to()
- let selection = cm.getRange({line: from.line, ch: 0}, to)
+ let selection = cm.getRange({ line: from.line, ch: 0 }, to)
selection = selection.replace(/\n/g, '\n' + symbol)
selection = symbol + selection
cm.replaceRange(selection, from, to)
} else {
- cm.replaceRange(symbol, {line: cursor.line, ch: 0}, {line: cursor.line, ch: 0})
+ cm.replaceRange(symbol, { line: cursor.line, ch: 0 }, { line: cursor.line, ch: 0 })
}
}
- cm.setCursor({line: cursor.line, ch: cursor.ch + symbol.length})
+ cm.setCursor({ line: cursor.line, ch: cursor.ch + symbol.length })
cm.focus()
}
diff --git a/public/js/lib/syncscroll.js b/public/js/lib/syncscroll.js
index cee317ea..d492fbc9 100644
--- a/public/js/lib/syncscroll.js
+++ b/public/js/lib/syncscroll.js
@@ -188,7 +188,7 @@ function buildMapInner (callback) {
}
nonEmptyList.push(0)
- // make the first line go top
+ // make the first line go top
_scrollMap[0] = viewTop
const parts = markdownArea.find('.part').toArray()
@@ -336,7 +336,7 @@ export function syncScrollToView (event, preventAnimate) {
const scrollInfo = editor.getScrollInfo()
const textHeight = editor.defaultTextHeight()
lineNo = Math.floor(scrollInfo.top / textHeight)
- // if reach the last line, will start lerp to the bottom
+ // if reach the last line, will start lerp to the bottom
const diffToBottom = (scrollInfo.top + scrollInfo.clientHeight) - (scrollInfo.height - textHeight)
if (scrollInfo.height > scrollInfo.clientHeight && diffToBottom > 0) {
topDiffPercent = diffToBottom / textHeight