Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed linters and tests #296

Merged
merged 2 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 172 additions & 60 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"@testing-library/jest-dom": "^5.14.1",
"@types/jest": "^26.0.23",
"@types/webpack-env": "^1.16.0",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"babel-loader": "^8.2.2",
"babel-plugin-inline-import": "^3.0.0",
"babel-preset-es2015": "^6.24.1",
Expand Down
14 changes: 7 additions & 7 deletions src/attach/attachPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = {
return store
}

var div = dom.createElement('div')
const div = dom.createElement('div')
const esc = UI.utils.escapeForXML
div.setAttribute('class', 'attachPane')
div.innerHTML =
Expand Down Expand Up @@ -238,7 +238,7 @@ module.exports = {
}
}

var linkClicked = function (x, event, inverse, refresh) {
const linkClicked = function (x, event, inverse, refresh) {
let s, o
if (inverse) {
// Objectlist
Expand Down Expand Up @@ -292,7 +292,7 @@ module.exports = {
div.appendChild(subjectList)
}

var showObject = function (x, event, selected) {
const showObject = function (x, event, selected) {
if (!selected) {
deselectObject()
preview.innerHTML = '' // Clean out what is there
Expand Down Expand Up @@ -367,7 +367,7 @@ module.exports = {
}
}
let i, b
var buttons = []
const buttons = []
for (i = 0; i < labels.length; i++) {
b = buttons[i] = dom.createElement('td')
b.textContent = labels[i]
Expand Down Expand Up @@ -409,7 +409,7 @@ module.exports = {
)
)

var objectList = UI.widgets.selectorPanel(
const objectList = UI.widgets.selectorPanel(
dom,
kb,
objectType,
Expand All @@ -428,7 +428,7 @@ module.exports = {

// objectList.insertBefore(head, objectList.firstChild)

var preview = dom.createElement('div')
const preview = dom.createElement('div')
preview.setAttribute(
'style',
/* background-color: black; */ 'padding: 0em; margin: 0; height: 100%; overflow:scroll;'
Expand All @@ -446,7 +446,7 @@ module.exports = {
for (const storeURI in stores) {
// var store = findStore(kb,subjects[subjectList.length-1])
const store = kb.sym(storeURI)
var mintBox = dom.createElement('div')
const mintBox = dom.createElement('div')
mintBox.setAttribute(
'style',
'clear: left; width: 20em; margin-top:2em; background-color:#ccc; border-radius: 1em; padding: 1em; font-weight: bold;'
Expand Down
14 changes: 7 additions & 7 deletions src/audio/audioPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module.exports = {
trackRow.textContent = decode(removeExtension(a[2]))
}

var moveOn = function (current, level) {
const moveOn = function (current, level) {
return new Promise(function (resolve) {
level = level || 0
if (!options.chain) return resolve(null)
Expand Down Expand Up @@ -132,7 +132,7 @@ module.exports = {
const endedListener = function (event) {
const current = kb.sym(event.target.getAttribute('src'))
if (!options.chain) return
var tryNext = function (cur) {
const tryNext = function (cur) {
const current = cur
moveOn(current).then(function (next) {
if (!next) {
Expand All @@ -153,7 +153,7 @@ module.exports = {
tryNext(current)
}

var audioControl = function (song, autoplay) {
const audioControl = function (song, autoplay) {
const audio = dom.createElement('audio')
audio.setAttribute('controls', 'yes')
audio.setAttribute('src', song.uri)
Expand All @@ -167,13 +167,13 @@ module.exports = {
const div = dom.createElement('div')
const table = div.appendChild(dom.createElement('table'))
const labelStyle = 'padding: 0.3em; color:white; background-color: black;'
var artistRow = table.appendChild(dom.createElement('tr'))
const artistRow = table.appendChild(dom.createElement('tr'))
artistRow.style.cssText = labelStyle
var albumRow = table.appendChild(dom.createElement('tr'))
const albumRow = table.appendChild(dom.createElement('tr'))
albumRow.style.cssText = labelStyle
var trackRow = table.appendChild(dom.createElement('tr'))
const trackRow = table.appendChild(dom.createElement('tr'))
trackRow.style.cssText = labelStyle
var controlRow = table.appendChild(dom.createElement('tr'))
const controlRow = table.appendChild(dom.createElement('tr'))
guessNames(subject)
controlRow.appendChild(audioControl(subject, options.autoplay))

Expand Down
2 changes: 1 addition & 1 deletion src/classInstancePane.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
div.appendChild(pre)
pre.appendChild(dom.createTextNode(message))
}
var div = dom.createElement('div')
const div = dom.createElement('div')
div.setAttribute('class', 'instancePane')
div.setAttribute(
'style',
Expand Down
16 changes: 8 additions & 8 deletions src/dataContentPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
*/
statementsAsTables: function statementsAsTables (sts, context, initialRoots) {
const myDocument = context.dom
// var outliner = context.getOutliner(myDocument)
// const outliner = context.getOutliner(myDocument)
const rep = myDocument.createElement('table')
const sz = UI.rdf.Serializer(context.session.store)
const res = sz.rootSubjects(sts)
Expand Down Expand Up @@ -138,7 +138,7 @@ module.exports = {
}
return myDocument.createTextNode(obj.value) // placeholder - could be smarter,

case 'BlankNode':
case 'BlankNode': {
if (obj.toNT() in doneBnodes) {
// Break infinite recursion
referencedBnodes[obj.toNT()] = true
Expand All @@ -149,7 +149,7 @@ module.exports = {
return anchor
}
doneBnodes[obj.toNT()] = true // Flag to prevent infinite recursion in propertyTree
var newTable = propertyTree(obj)
const newTable = propertyTree(obj)
doneBnodes[obj.toNT()] = newTable // Track where we mentioned it first
if (
UI.utils.ancestor(newTable, 'TABLE') &&
Expand All @@ -161,7 +161,7 @@ module.exports = {
newTable.style.backgroundColor = 'white'
}
return newTable

}
case 'Collection':
res = myDocument.createElement('table')
res.setAttribute('class', 'collectionAsTables')
Expand Down Expand Up @@ -271,14 +271,14 @@ module.exports = {
)
}

var outliner = context.getOutliner(myDocument)
var kb = context.session.store
var div = myDocument.createElement('div')
const outliner = context.getOutliner(myDocument)
const kb = context.session.store
const div = myDocument.createElement('div')
div.setAttribute('class', 'dataContentPane')
// Because of smushing etc, this will not be a copy of the original source
// We could instead either fetch and re-parse the source,
// or we could keep all the pre-smushed triples.
var sts = kb.statementsMatching(undefined, undefined, undefined, subject) // @@ slow with current store!
const sts = kb.statementsMatching(undefined, undefined, undefined, subject) // @@ slow with current store!

if ($rdf.keepThisCodeForLaterButDisableFerossConstantConditionPolice) {
alternativeRendering()
Expand Down
12 changes: 6 additions & 6 deletions src/form/pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ module.exports = {
// This in general needs a whole lot more thought
// and it connects to the discoverbility through links

// var t = kb.findTypeURIs(subject)
// const t = kb.findTypeURIs(subject)

const me = UI.authn.currentUser()

var box = dom.createElement('div')
const box = dom.createElement('div')
box.setAttribute('class', 'formPane')

if (!me) {
Expand Down Expand Up @@ -112,7 +112,7 @@ module.exports = {

/* Keep tis as a reminder to let a New one have its URI given by user
mention("Where will this information be stored?")
var ele = dom.createElement('input');
const ele = dom.createElement('input');
box.appendChild(ele);
ele.setAttribute('type', 'text');
ele.setAttribute('size', '72');
Expand Down Expand Up @@ -162,7 +162,7 @@ module.exports = {
})
for (const d in docs) docList.push(docs[d], d)
docList.sort()
for (var i = 0; i < docList.length; i++) {
for (let i = 0; i < docList.length; i++) {
const uri = docList[i][1]
if (uri && store.updater.editable(uri)) {
store = store.sym(uri)
Expand All @@ -173,7 +173,7 @@ module.exports = {

// 3. In a workspace store
// @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor)
var _followeach = function (kb, subject, path) {
const _followeach = function (kb, subject, path) {
if (path.length === 0) return [subject]
const oo = kb.each(subject, path[0])
let res = []
Expand All @@ -194,7 +194,7 @@ module.exports = {
mention('Workspace selected OK: ' + ws)

const activities = store.each(undefined, ns.space('workspace'), ws)
for (let j = 0; j < activities.length; i++) {
for (let j = 0; j < activities.length; j++) {
const act = activities[j]

const subjectDoc2 = store.any(ws, ns.space('store'))
Expand Down
Loading