Skip to content

Commit

Permalink
ALL the linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mixmix committed Aug 12, 2018
1 parent 2dbfe1d commit a2742c4
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 25 deletions.
3 changes: 2 additions & 1 deletion app/async/catch-link-click.js
Expand Up @@ -30,7 +30,7 @@ exports.create = function (api) {
if (!anchor) return true

var href = anchor.getAttribute('href')
if (!href || href == '#') return
if (!href || href === '#') return

var url = Url.parse(href)
var opts = {
Expand All @@ -50,6 +50,7 @@ exports.create = function (api) {

const openBackground = ctrlKey
api.router.async.normalise(link, (err, location) => {
if (err) throw err
if (location) api.app.sync.goTo(location, { openBackground })
})
}
Expand Down
6 changes: 3 additions & 3 deletions app/html/scroller.js
Expand Up @@ -49,9 +49,9 @@ function keyscroll (content) {
return function scroll (d) {
selectChild((!curMsgEl || d === 'first') ? content.firstChild
: (!curMsgEl || d === 'last') ? content.lastChild
: d < 0 ? curMsgEl.previousElementSibling || content.firstChild
: d > 0 ? curMsgEl.nextElementSibling || content.lastChild
: curMsgEl)
: d < 0 ? curMsgEl.previousElementSibling || content.firstChild
: d > 0 ? curMsgEl.nextElementSibling || content.lastChild
: curMsgEl)

return curMsgEl
}
Expand Down
2 changes: 1 addition & 1 deletion app/page/posts.js
Expand Up @@ -96,7 +96,7 @@ exports.create = function (api) {

function PageByUpdate (state) {
const createStream = (opts) => {
const { feedId, started, participated, other } = state.show
const { started, participated, other } = state.show
if (!started && !participated && !other) return pull.empty()

return api.sbot.pull.stream(server => {
Expand Down
1 change: 0 additions & 1 deletion app/page/search.js
@@ -1,7 +1,6 @@
const nest = require('depnest')
const { h, Struct, Value } = require('mutant')
const pull = require('pull-stream')
const next = require('pull-next-query')
const Scroller = require('pull-scroll')
const TextNodeSearcher = require('text-node-searcher')

Expand Down
2 changes: 1 addition & 1 deletion app/page/thread.js
Expand Up @@ -111,7 +111,7 @@ exports.create = function (api) {
}
}

function addQuote(value) {
function addQuote (value) {
composer.addQuote(value)
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/sync/catch-keyboard-shortcut.js
Expand Up @@ -79,7 +79,7 @@ function genericShortcuts (ev, { tabs, search, goTo, back }) {
case 76: // l = right
tabs.selectRelative(1)
return goTo(JSON.parse(tabs.currentPage().id))
case 88: // x = close
case 88: // x = close
tabs.closeCurrentTab()
return

Expand Down
6 changes: 3 additions & 3 deletions app/sync/goTo.js
Expand Up @@ -32,6 +32,7 @@ exports.create = function (api) {

// currently do normalisation here only to generate normalised locationId
api.router.async.normalise(location, (err, loc) => {
if (err) throw err
const locationId = api.app.sync.locationId(loc)

var page = tabs.get(locationId)
Expand All @@ -40,11 +41,10 @@ exports.create = function (api) {
tabs.select(locationId)
api.history.sync.push(loc)

if (loc.action == "quote" && page.firstChild && page.firstChild.addQuote) {
if (loc.action === 'quote' && page.firstChild && page.firstChild.addQuote) {
page.firstChild.addQuote(loc.value)
tabs.currentPage().scroll('last')
} else if (loc.action == "reply")
tabs.currentPage().scroll('last')
} else if (loc.action === 'reply') { tabs.currentPage().scroll('last') }

return true
}
Expand Down
2 changes: 1 addition & 1 deletion config.js
Expand Up @@ -4,7 +4,7 @@ const ssbKeys = require('ssb-keys')
const Path = require('path')

const appName = process.env.ssb_appname || 'ssb'
const opts = appName == 'ssb'
const opts = appName === 'ssb'
? null
: null // require('./default-config.json')

Expand Down
5 changes: 2 additions & 3 deletions main.js
Expand Up @@ -48,9 +48,8 @@ const sockets = combine(
)

// remove patchcore reply for our version
var pcReplyIndex = sockets.message.html.action.findIndex(x => x.name == 'reply')
if (pcReplyIndex != -1)
delete sockets.message.html.action[pcReplyIndex]
var pcReplyIndex = sockets.message.html.action.findIndex(x => x.name === 'reply')
if (pcReplyIndex !== -1) { delete sockets.message.html.action[pcReplyIndex] }

const api = entry(sockets, nest('app.html.app', 'first'))
const app = api.app.html.app
Expand Down
5 changes: 2 additions & 3 deletions message/html/compose.js
Expand Up @@ -92,7 +92,7 @@ exports.create = function (api) {
hasContent.set(true)
}

var isPrivate = location.page == 'private' ||
var isPrivate = location.page === 'private' ||
(location.key && !location.value) ||
(location.value && location.value.private)

Expand Down Expand Up @@ -159,8 +159,7 @@ exports.create = function (api) {
}
}

if (location.action == 'quote')
composer.addQuote(location.value)
if (location.action === 'quote') { composer.addQuote(location.value) }

addSuggest(channelInput, (inputText, cb) => {
if (inputText[0] === '#') {
Expand Down
2 changes: 1 addition & 1 deletion message/html/meta/raw.js
Expand Up @@ -54,7 +54,7 @@ function colorKeys (chunks) {

function linkify (text) {
// from ssb-ref
var refRegex = /((?:@|%|&)[A-Za-z0-9\/+]{43}=\.[\w\d]+)/g
var refRegex = /((?:@|%|&)[A-Za-z0-9/+]{43}=\.[\w\d]+)/g

var arr = text.split(refRegex)
for (var i = 1; i < arr.length; i += 2) {
Expand Down
2 changes: 1 addition & 1 deletion message/html/render/blog.js
@@ -1,7 +1,7 @@
const nest = require('depnest')
const Blog = require('scuttle-blog')
const isBlog = require('scuttle-blog/isBlog')
const { h, Value, computed, when, resolve, onceTrue } = require('mutant')
const { h, Value, computed, when, resolve } = require('mutant')
const isEmpty = require('lodash/isEmpty')

exports.gives = nest('message.html.render')
Expand Down
4 changes: 2 additions & 2 deletions message/html/render/contact.js
Expand Up @@ -31,13 +31,13 @@ exports.create = function (api) {
function renderContent ({ contact, following, blocking }) {
const name = api.about.html.link(contact)

if (blocking != undefined) {
if (blocking !== undefined) {
return [
blocking ? 'blocked ' : 'unblocked ',
name
]
}
if (following != undefined) {
if (following !== undefined) {
return [
following ? 'followed ' : 'unfollowed ',
name
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -4,7 +4,7 @@
"description": "patchbay 2, built on patchcore",
"main": "index.js",
"scripts": {
"lint": "standard",
"lint": "standard --fix",
"rebuild": "cross-script npm rebuild --runtime=electron \"--target=$(electron -v)\" \"--abi=$(electron --abi)\" --disturl=https://atom.io/download/atom-shell",
"start": "electron index.js -- --title patchbay",
"start-frameless": "FRAME=false npm start",
Expand Down
4 changes: 2 additions & 2 deletions post-patchcore/message/html/action/quote.js
Expand Up @@ -10,8 +10,8 @@ exports.gives = nest('message.html.action')
exports.create = (api) => {
return nest('message.html.action', function quote (msg) {
return h('a', {
href: '#',
href: '#',
'ev-click': (ev) => { ev.preventDefault(); api.app.sync.goTo({ action: 'quote', key: msg.key, value: msg.value }) }
}, 'Quote')
}, 'Quote')
})
}

0 comments on commit a2742c4

Please sign in to comment.