diff --git a/.eslintrc b/.eslintrc index 7a3061766..6a4185080 100644 --- a/.eslintrc +++ b/.eslintrc @@ -15,11 +15,7 @@ ], "rules": { "no-console": "error", - "complexity": ["warn", 15], - "no-unused-vars": ["warn", { - "argsIgnorePattern": "^_", - "varsIgnorePattern": "^_" - }], + "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" diff --git a/src/acl/access-controller.ts b/src/acl/access-controller.ts index 77cb5e01e..7481dc825 100644 --- a/src/acl/access-controller.ts +++ b/src/acl/access-controller.ts @@ -8,10 +8,8 @@ import { graph, NamedNode, UpdateManager } from 'rdflib' import { AccessGroups } from './access-groups' import { DataBrowserContext } from 'pane-registry' import { shortNameForFolder } from './acl-control' -import { currentUser } from '../authn/authn' import * as utils from '../utils' import * as debug from '../debug' -import ns from '../ns' /** * Rendered HTML component used in the databrowser's Sharing pane. diff --git a/src/authn/authn.ts b/src/authn/authn.ts index 388892766..5757000c4 100644 --- a/src/authn/authn.ts +++ b/src/authn/authn.ts @@ -400,20 +400,16 @@ export async function findAppInstances ( } catch (err) { } const index = context.index as { [key: string]: Array } - // eslint-disable-next-line no-console - console.log({ index, visibility }) const thisIndex = index[visibility] - // eslint-disable-next-line no-console - console.log('Failing test?', thisIndex.map(ix => solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix))) const registrations = thisIndex .map(ix => solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix)) - .flat() + .reduce((acc, curr) => acc.concat(curr), []) const instances = registrations .map(reg => solidLogicSingleton.store.each(reg as NamedNode, ns.solid('instance'))) - .flat() + .reduce((acc, curr) => acc.concat(curr), []) const containers = registrations .map(reg => solidLogicSingleton.store.each(reg as NamedNode, ns.solid('instanceContainer'))) - .flat() + .reduce((acc, curr) => acc.concat(curr), []) function unique (arr: NamedNode[]): NamedNode[] { return Array.from(new Set(arr)) diff --git a/src/chat/infinite.js b/src/chat/infinite.js index 0c7b46d36..fcf8d9fc0 100644 --- a/src/chat/infinite.js +++ b/src/chat/infinite.js @@ -843,9 +843,10 @@ export async function infiniteMessageArea (dom, kb, chatChannel, options) { const todayDocument = dateFolder.leafDocumentFromDate(now) live = todayDocument.sameTerm(selectedDocument) } + let selectedMessageTable if (options.selectedMessage && !live) { const selectedDate = dateFolder.dateFromLeafDocument(selectedDocument) - var selectedMessageTable = await createMessageTable(selectedDate, live) + selectedMessageTable = await createMessageTable(selectedDate, live) div.appendChild(selectedMessageTable) earliest.messageTable = selectedMessageTable latest.messageTable = selectedMessageTable diff --git a/src/chat/thread.js b/src/chat/thread.js index 45aaaa462..f4cf352e3 100644 --- a/src/chat/thread.js +++ b/src/chat/thread.js @@ -249,7 +249,7 @@ export function thread (dom, kb, subject, messageStore, options) { }) } - var addMessage = function (message) { + const addMessage = function (message) { const bindings = { '?msg': message, '?creator': kb.any(message, ns.foaf('maker')), @@ -259,7 +259,7 @@ export function thread (dom, kb, subject, messageStore, options) { renderMessage(bindings, true) // fresh from elsewhere } - var renderMessage = function (bindings, fresh) { + const renderMessage = function (bindings, fresh) { const creator = bindings['?creator'] const message = bindings['?msg'] const date = bindings['?date'] @@ -329,7 +329,7 @@ export function thread (dom, kb, subject, messageStore, options) { }, false ) - var sureButton = dom.createElement('button') + const sureButton = dom.createElement('button') sureButton.textContent = 'Delete message' td3.appendChild(sureButton).addEventListener( 'click', diff --git a/src/folders.js b/src/folders.js index 1b50a7d2c..3a853ad6d 100644 --- a/src/folders.js +++ b/src/folders.js @@ -10,7 +10,6 @@ import { store } from './logic' import * as ns from './ns' import * as rdf from 'rdflib' // pull in first avoid cross-refs import * as style from './style' -import * as utils from './utils' import * as widgets from './widgets' const UI = { authn, icons, ns, rdf, store, style, widgets } diff --git a/src/messageArea.js b/src/messageArea.js index b4229fa8e..307602c67 100644 --- a/src/messageArea.js +++ b/src/messageArea.js @@ -241,7 +241,7 @@ export function messageArea (dom, kb, subject, messageStore, options) { }) } - var addMessage = function (message) { + const addMessage = function (message) { const bindings = { '?msg': message, '?creator': kb.any(message, ns.foaf('maker')), @@ -251,7 +251,7 @@ export function messageArea (dom, kb, subject, messageStore, options) { renderMessage(bindings, true) // fresh from elsewhere } - var renderMessage = function (bindings, fresh) { + const renderMessage = function (bindings, fresh) { const creator = bindings['?creator'] const message = bindings['?msg'] const date = bindings['?date'] @@ -321,7 +321,7 @@ export function messageArea (dom, kb, subject, messageStore, options) { }, false ) - var sureButton = dom.createElement('button') + const sureButton = dom.createElement('button') sureButton.textContent = 'Delete message' td3.appendChild(sureButton).addEventListener( 'click', diff --git a/src/table.js b/src/table.js index bcc73616c..7be80ae76 100644 --- a/src/table.js +++ b/src/table.js @@ -13,14 +13,12 @@ // 2014 Core table widget moved into common/table.js - timbl // -import { authn } from './authn/index' import * as debug from './debug' import { icons } from './iconBase' import { store } from './logic' import * as log from './log' import * as ns from './ns' import * as rdf from 'rdflib' // pull in first avoid cross-refs -import * as style from './style' import * as utils from './utils' import * as widgets from './widgets' @@ -109,8 +107,9 @@ export function renderTableViewPane (doc, options) { } // A specifically asked-for query + let table if (givenQuery) { - var table = renderTableForQuery(givenQuery) + table = renderTableForQuery(givenQuery) // lastQuery = givenQuery tableDiv.appendChild(table) } else { @@ -1440,7 +1439,7 @@ export function renderTableViewPane (doc, options) { for (let i = 0; i < columns.length; ++i) { const column = columns[i] const td = doc.createElement('td') - var orig + let orig const columnKey = column.getKey() diff --git a/src/widgets/buttons.ts b/src/widgets/buttons.ts index 45d07e1c4..11240a969 100644 --- a/src/widgets/buttons.ts +++ b/src/widgets/buttons.ts @@ -21,7 +21,7 @@ import { linkIcon, createLinkForURI } from './buttons/iconLinks' /* global alert */ -const { iconBase, originalIconBase } = icons +const { iconBase } = icons const cancelIconURI = iconBase + 'noun_1180156.svg' // black X const checkIconURI = iconBase + 'noun_1180158.svg' // green checkmark; Continue diff --git a/src/widgets/forms.js b/src/widgets/forms.js index 84d67c1cb..77ee57eb1 100644 --- a/src/widgets/forms.js +++ b/src/widgets/forms.js @@ -1217,8 +1217,9 @@ export function makeDescription ( } const editable = kb.updater.editable(dataDoc.uri) + let submit if (editable) { - var submit = widgets.continueButton(dom, saveChange) + submit = widgets.continueButton(dom, saveChange) submit.disabled = true // until the filled has been modified submit.style.visibility = 'hidden' submit.style.float = 'right' @@ -1293,7 +1294,7 @@ export function makeSelectForOptions ( return errorMessageBlock(dom, "Selector: can't mint new with no subform.") } log.debug('makeSelectForOptions: dataDoc=' + dataDoc) - + let actual const getActual = function () { actual = {} if (predicate.sameTerm(ns.rdf('type'))) { @@ -1305,7 +1306,7 @@ export function makeSelectForOptions ( } return actual } - var actual = getActual() + actual = getActual() const onChange = function (_e) { select.disabled = true // until data written back - gives user feedback too @@ -1316,10 +1317,10 @@ export function makeSelectForOptions ( ds.push($rdf.st(subject, predicate, t, dataDoc)) } } + let newObject for (let i = 0; i < select.options.length; i++) { const opt = select.options[i] if (opt.selected && opt.AJAR_mint) { - var newObject if (options.mintClass) { const thisForm = promptForNew( dom, diff --git a/src/widgets/forms/autocomplete/autocompleteField.ts b/src/widgets/forms/autocomplete/autocompleteField.ts index 8c3b4fb29..416f08814 100644 --- a/src/widgets/forms/autocomplete/autocompleteField.ts +++ b/src/widgets/forms/autocomplete/autocompleteField.ts @@ -73,7 +73,7 @@ export function autocompleteField ( callbackFunction(true, '') } - async function deleteOne (result:NamedNode | Literal, name: Literal) { + async function deleteOne (_result:NamedNode | Literal, _name: Literal) { const oldValue = kb.the(subject, property as any, null, doc) if (!oldValue) { callbackFunction(false, 'NO data to elete') diff --git a/src/widgets/forms/autocomplete/autocompletePicker.ts b/src/widgets/forms/autocomplete/autocompletePicker.ts index b494c29e9..8bfa071e0 100644 --- a/src/widgets/forms/autocomplete/autocompletePicker.ts +++ b/src/widgets/forms/autocomplete/autocompletePicker.ts @@ -14,7 +14,6 @@ import { filterByLanguage, getPreferredLanguages, defaultPreferedLangages } from const AUTOCOMPLETE_THRESHOLD = 4 // don't check until this many characters typed const AUTOCOMPLETE_ROWS = 20 // 20? const AUTOCOMPLETE_ROWS_STRETCH = 40 -const AUTOCOMPLETE_DEBOUNCE_MS = 300 /* Autocomplete happens in 6 phases: @@ -271,7 +270,6 @@ export async function renderAutoComplete (dom: HTMLDocument, // var candidatesLoaded = false let lastBindings let loadedEnough = false - const runningTimeout = undefined as any let inputEventHandlerLock = false let allDisplayed = false let lastFilter = undefined as (string | undefined) diff --git a/src/widgets/index.js b/src/widgets/index.js index a9957d27d..e17319a25 100644 --- a/src/widgets/index.js +++ b/src/widgets/index.js @@ -11,8 +11,6 @@ */ /* eslint-disable no-console */ -import * as debug from '../debug' - // Each widget should ideally live in its own file. In order to break up this // monolithic widget index over time, we should add new widgets to the // 'lib/widgets/' directory, and re-export them by merging the module namespaces: diff --git a/test/unit/widgets/buttons/iconLink.test.ts b/test/unit/widgets/buttons/iconLink.test.ts index bc42be078..08bf00971 100644 --- a/test/unit/widgets/buttons/iconLink.test.ts +++ b/test/unit/widgets/buttons/iconLink.test.ts @@ -1,6 +1,6 @@ import { silenceDebugMessages } from '../../../helpers/setup' import { JSDOM, DOMWindow } from 'jsdom' -import { sym, NamedNode } from 'rdflib' +import { NamedNode } from 'rdflib' import { linkIcon, createLinkForURI diff --git a/test/unit/widgets/forms/index.test.ts b/test/unit/widgets/forms/index.test.ts index b3c1ad0ad..27a376726 100644 --- a/test/unit/widgets/forms/index.test.ts +++ b/test/unit/widgets/forms/index.test.ts @@ -1,7 +1,7 @@ import { silenceDebugMessages } from '../../../helpers/setup' -import { namedNode, graph } from 'rdflib' +import { namedNode } from 'rdflib' import * as ns from '../../../../src/ns' -import { solidLogicSingleton, store, kb } from '../../../../src/logic' +import { kb } from '../../../../src/logic' // console.log('@@ solidLogicSingleton', solidLogicSingleton) // @ts-ignore