Skip to content

Commit 3b8b7e2

Browse files
committed
Ran lint-fix
1 parent 31c8e9f commit 3b8b7e2

3 files changed

Lines changed: 47 additions & 49 deletions

File tree

src/pad.js

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ const utils = require('./utils')
2727
* @param {NamedNode} author - The author of text being displayed
2828
* @returns {String} The CSS color generated, constrained to be light for a background color
2929
*/
30-
UI.pad.lightColorHash = function(author) {
31-
var hash = function(x) {
32-
return x.split('').reduce(function(a, b) {
30+
UI.pad.lightColorHash = function (author) {
31+
var hash = function (x) {
32+
return x.split('').reduce(function (a, b) {
3333
a = (a << 5) - a + b.charCodeAt(0)
3434
return a & a
3535
}, 0)
@@ -43,10 +43,10 @@ UI.pad.lightColorHash = function(author) {
4343
//
4444
// This is more general tham the pad.
4545
//
46-
UI.pad.renderPartipants = function(dom, table, padDoc, subject, me, options) {
46+
UI.pad.renderPartipants = function (dom, table, padDoc, subject, me, options) {
4747
table.setAttribute('style', 'margin: 0.8em;')
4848

49-
var newRowForParticpation = function(parp) {
49+
var newRowForParticpation = function (parp) {
5050
var person = kb.any(parp, ns.wf('participant'))
5151
var tr
5252
if (!person) {
@@ -71,12 +71,12 @@ UI.pad.renderPartipants = function(dom, table, padDoc, subject, me, options) {
7171
return tr
7272
}
7373

74-
var syncTable = function() {
75-
var parps = kb.each(subject, ns.wf('participation')).map(function(parp) {
74+
var syncTable = function () {
75+
var parps = kb.each(subject, ns.wf('participation')).map(function (parp) {
7676
return [kb.anyValue(parp, UI.ns.cal('dtstart')) || '9999-12-31', parp]
7777
})
7878
parps.sort() // List in order of joining
79-
var participations = parps.map(function(p) {
79+
var participations = parps.map(function (p) {
8080
return p[1]
8181
})
8282
utils.syncTableToArray(table, participations, newRowForParticpation)
@@ -95,13 +95,13 @@ UI.pad.renderPartipants = function(dom, table, padDoc, subject, me, options) {
9595
* @param {NamedNode} me - The logged in user
9696
*
9797
*/
98-
UI.pad.participationObject = function(subject, padDoc, me) {
99-
return new Promise(function(resolve, reject) {
98+
UI.pad.participationObject = function (subject, padDoc, me) {
99+
return new Promise(function (resolve, reject) {
100100
if (!me) {
101101
throw new Error('Not user id')
102102
}
103103

104-
var parps = kb.each(subject, ns.wf('participation')).filter(function(pn) {
104+
var parps = kb.each(subject, ns.wf('participation')).filter(function (pn) {
105105
return kb.holds(pn, ns.wf('participant'), me)
106106
})
107107
if (parps.length > 1) {
@@ -124,7 +124,7 @@ UI.pad.participationObject = function(subject, padDoc, me) {
124124
padDoc
125125
)
126126
]
127-
kb.updater.update([], ins, function(uri, ok, errorMessage) {
127+
kb.updater.update([], ins, function (uri, ok, errorMessage) {
128128
if (!ok) {
129129
reject(new Error('Error recording your partipation: ' + errorMessage))
130130
} else {
@@ -143,11 +143,11 @@ UI.pad.participationObject = function(subject, padDoc, me) {
143143
* @param {DOMNode} refreshable - A DOM element whose refresh() is to be called if the change works
144144
*
145145
*/
146-
UI.pad.recordParticipation = function(subject, padDoc, refreshable) {
146+
UI.pad.recordParticipation = function (subject, padDoc, refreshable) {
147147
var me = UI.authn.currentUser()
148148
if (!me) return // Not logged in
149149

150-
var parps = kb.each(subject, ns.wf('participation')).filter(function(pn) {
150+
var parps = kb.each(subject, ns.wf('participation')).filter(function (pn) {
151151
return kb.holds(pn, ns.wf('participant'), me)
152152
})
153153
if (parps.length > 1) {
@@ -170,7 +170,7 @@ UI.pad.recordParticipation = function(subject, padDoc, refreshable) {
170170
padDoc
171171
)
172172
]
173-
kb.updater.update([], ins, function(uri, ok, errorMessage) {
173+
kb.updater.update([], ins, function (uri, ok, errorMessage) {
174174
if (!ok) {
175175
throw new Error('Error recording your partipation: ' + errorMessage)
176176
}
@@ -185,7 +185,7 @@ UI.pad.recordParticipation = function(subject, padDoc, refreshable) {
185185

186186
// Record my participation and display participants
187187
//
188-
UI.pad.manageParticipation = function(
188+
UI.pad.manageParticipation = function (
189189
dom,
190190
container,
191191
padDoc,
@@ -209,7 +209,7 @@ UI.pad.manageParticipation = function(
209209
return table
210210
}
211211

212-
UI.pad.notepad = function(dom, padDoc, subject, me, options) {
212+
UI.pad.notepad = function (dom, padDoc, subject, me, options) {
213213
options = options || {}
214214
var exists = options.exists
215215
var table = dom.createElement('table')
@@ -239,7 +239,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
239239
downstreamStatus.setAttribute('style', 'width:50%')
240240
}
241241

242-
var complain = function(message, upstream) {
242+
var complain = function (message, upstream) {
243243
console.log(message)
244244
if (options.statusArea) {
245245
;(upstream ? upstreamStatus : downstreamStatus).appendChild(
@@ -248,13 +248,13 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
248248
}
249249
}
250250

251-
var clearStatus = function(_upsteam) {
251+
var clearStatus = function (_upsteam) {
252252
if (options.statusArea) {
253253
options.statusArea.innerHTML = ''
254254
}
255255
}
256256

257-
var setPartStyle = function(part, colors, pending) {
257+
var setPartStyle = function (part, colors, pending) {
258258
var chunk = part.subject
259259
colors = colors || ''
260260
var baseStyle =
@@ -290,7 +290,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
290290
part.setAttribute('style', style + colors)
291291
}
292292

293-
var removePart = function(part) {
293+
var removePart = function (part) {
294294
var chunk = part.subject
295295
if (!chunk) throw new Error('No chunk for line to be deleted!') // just in case
296296
var prev = kb.any(undefined, PAD('next'), chunk)
@@ -308,7 +308,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
308308
var label = chunk.uri.slice(-4)
309309
console.log('Deleting line ' + label)
310310

311-
updater.update(del, ins, function(uri, ok, errorMessage, response) {
311+
updater.update(del, ins, function (uri, ok, errorMessage, response) {
312312
if (ok) {
313313
var row = part.parentNode
314314
var before = row.previousSibling
@@ -322,7 +322,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
322322
setPartStyle(part, 'color: black; background-color: #ffd;') // yellow
323323
part.state = 0 // Needs downstream refresh
324324
utils.beep(0.5, 512) // Ooops clash with other person
325-
setTimeout(function() {
325+
setTimeout(function () {
326326
// Ideally, beep! @@
327327
reloadAndSync() // Throw away our changes and
328328
// updater.requestDownstreamAction(padDoc, reloadAndSync)
@@ -338,13 +338,13 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
338338
})
339339
} // removePart
340340

341-
var changeIndent = function(part, chunk, delta) {
341+
var changeIndent = function (part, chunk, delta) {
342342
var del = kb.statementsMatching(chunk, PAD('indent'))
343343
var current = del.length ? Number(del[0].object.value) : 0
344344
if (current + delta < -3) return // limit negative indent
345345
var newIndent = current + delta
346346
var ins = $rdf.st(chunk, PAD('indent'), newIndent, padDoc)
347-
updater.update(del, ins, function(uri, ok, errorBody) {
347+
updater.update(del, ins, function (uri, ok, errorBody) {
348348
if (!ok) {
349349
console.log(
350350
"Indent change FAILED '" +
@@ -388,8 +388,8 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
388388
return (iCaretPos)
389389
}
390390
*/
391-
var addListeners = function(part, chunk) {
392-
part.addEventListener('keydown', function(event) {
391+
var addListeners = function (part, chunk) {
392+
part.addEventListener('keydown', function (event) {
393393
var queueProperty, queue
394394
// up 38; down 40; left 37; right 39 tab 9; shift 16; escape 27
395395
switch (event.keyCode) {
@@ -467,7 +467,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
467467
}
468468
})
469469

470-
var updateStore = function(part) {
470+
var updateStore = function (part) {
471471
var chunk = part.subject
472472
setPartStyle(part, undefined, true)
473473
var old = kb.any(chunk, ns.sioc('content')).value
@@ -498,7 +498,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
498498
newOne +
499499
"' "
500500
)
501-
updater.update(del, ins, function(uri, ok, errorBody, xhr) {
501+
updater.update(del, ins, function (uri, ok, errorBody, xhr) {
502502
if (!ok) {
503503
// alert("clash " + errorBody);
504504
console.log(
@@ -516,7 +516,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
516516
setPartStyle(part, 'color: black; background-color: #fdd;')
517517
part.state = 0 // Needs downstream refresh
518518
utils.beep(0.5, 512) // Ooops clash with other person
519-
setTimeout(function() {
519+
setTimeout(function () {
520520
updater.requestDownstreamAction(padDoc, reloadAndSync)
521521
}, 1000)
522522
} else {
@@ -551,7 +551,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
551551
})
552552
}
553553

554-
part.addEventListener('input', function inputChangeListener(_event) {
554+
part.addEventListener('input', function inputChangeListener (_event) {
555555
// console.log("input changed "+part.value);
556556
setPartStyle(part, undefined, true) // grey out - not synced
557557
console.log(
@@ -575,7 +575,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
575575
}) // listener
576576
} // addlisteners
577577

578-
var newPartAfter = function(tr1, chunk, before) {
578+
var newPartAfter = function (tr1, chunk, before) {
579579
// @@ take chunk and add listeners
580580
var text = kb.any(chunk, ns.sioc('content'))
581581
text = text ? text.value : ''
@@ -604,7 +604,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
604604
return part
605605
}
606606

607-
var newChunk = function(ele, before) {
607+
var newChunk = function (ele, before) {
608608
// element of chunk being split
609609
var kb = UI.store
610610
var indent = 0
@@ -652,7 +652,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
652652
}
653653

654654
console.log(' Fresh chunk ' + label + ' proposed')
655-
updater.update(del, ins, function(uri, ok, errorBody, _xhr) {
655+
updater.update(del, ins, function (uri, ok, errorBody, _xhr) {
656656
if (!ok) {
657657
// alert("Error writing new line " + label + ": " + errorBody);
658658
console.log(' ERROR writing new line ' + label + ': ' + errorBody)
@@ -679,10 +679,10 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
679679
})
680680
}
681681

682-
var consistencyCheck = function() {
682+
var consistencyCheck = function () {
683683
var found = []
684684
var failed = 0
685-
function complain2(msg) {
685+
function complain2 (msg) {
686686
complain(msg)
687687
failed++
688688
}
@@ -731,7 +731,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
731731
}
732732

733733
var sts = kb.statementsMatching(undefined, ns.sioc('contents'))
734-
sts.map(function(st) {
734+
sts.map(function (st) {
735735
if (!found[st.subject.uri]) {
736736
complain2('Loose chunk! ' + st.subject.uri)
737737
}
@@ -741,7 +741,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
741741
}
742742

743743
// Ensure that the display matches the current state of the
744-
var sync = function() {
744+
var sync = function () {
745745
// var first = kb.the(subject, PAD('next'))
746746
if (kb.each(subject, PAD('next')).length !== 1) {
747747
var msg =
@@ -808,7 +808,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
808808

809809
// Refresh the DOM tree
810810

811-
var refreshTree = function(root) {
811+
var refreshTree = function (root) {
812812
if (root.refresh) {
813813
root.refresh()
814814
return
@@ -820,7 +820,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
820820

821821
var reloading = false
822822

823-
var checkAndSync = function() {
823+
var checkAndSync = function () {
824824
console.log(' reloaded OK')
825825
clearStatus()
826826
if (!consistencyCheck()) {
@@ -830,16 +830,16 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
830830
}
831831
}
832832

833-
var reloadAndSync = function() {
833+
var reloadAndSync = function () {
834834
if (reloading) {
835835
console.log(' Already reloading - stop')
836836
return // once only needed
837837
}
838838
reloading = true
839839
var retryTimeout = 1000 // ms
840-
var tryReload = function() {
840+
var tryReload = function () {
841841
console.log('try reload - timeout = ' + retryTimeout)
842-
updater.reload(updater.store, padDoc, function(ok, message, xhr) {
842+
updater.reload(updater.store, padDoc, function (ok, message, xhr) {
843843
reloading = false
844844
if (ok) {
845845
checkAndSync()
@@ -894,7 +894,7 @@ UI.pad.notepad = function(dom, padDoc, subject, me, options) {
894894
$rdf.st(subject, PAD('next'), subject, padDoc)
895895
]
896896

897-
updater.update([], insertables, function(uri, ok, errorBody) {
897+
updater.update([], insertables, function (uri, ok, errorBody) {
898898
if (!ok) {
899899
complain(errorBody)
900900
} else {

test/unit/acl/access-controller.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ describe('AccessController', () => {
1010
it('exists', () => {
1111
expect(AccessController).toBeTruthy()
1212
})
13-
// leaving this for now
14-
15-
13+
/* leaving this for now
1614
const subject = new RdfLib.NamedNode('testing')
1715
const noun = 'noun'
1816
const context = new DataBrowserContext()

test/unit/table.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ describe('renderTableViewPane', () => {
44
it('exists', () => {
55
expect(renderTableViewPane).toBeInstanceOf(Function)
66
})
7-
/*
7+
/*
88
it('runs', () => {
99
const doc = null
10-
const options = {}
10+
const options = { sourceDocument: null, tableClass: null, query: null }
1111
expect(renderTableViewPane(doc, options))
1212
}) */
1313
})

0 commit comments

Comments
 (0)