Fixes ESLint errors (#9668)

* fix: apply automatic eslint fixes

* lint: allow hashbang comment for tiddlywiki.js

* lint: first back of manual lint fixes for unused vars

* lint: added more fixes for unused vars

* lint: missed files

* lint: updated eslint config with selected rules from #9669
This commit is contained in:
Saq Imtiaz
2026-02-20 09:38:42 +01:00
committed by GitHub
parent 08f2b8bdf4
commit 785086e0a5
270 changed files with 3827 additions and 3970 deletions

View File

@@ -28,7 +28,6 @@ DynannotateWidget.prototype = new Widget();
Render this widget into the DOM
*/
DynannotateWidget.prototype.render = function(parent,nextSibling) {
var self = this;
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
@@ -57,7 +56,7 @@ DynannotateWidget.prototype.render = function(parent,nextSibling) {
"class": "tc-dynannotation-wrapper",
children: [this.domContent,this.domAnnotations,this.domSnippets,this.domSearches],
document: this.document
})
});
parent.insertBefore(this.domWrapper,nextSibling);
this.domNodes.push(this.domWrapper);
// Apply the selection tracker data to the DOM
@@ -93,7 +92,7 @@ DynannotateWidget.prototype.execute = function() {
DynannotateWidget.prototype.isSnippetMode = function() {
return this.getAttribute("searchDisplay") === "snippet";
}
};
/*
Save the data attributes required by the selection tracker
@@ -202,8 +201,8 @@ DynannotateWidget.prototype.applyAnnotations = function() {
if(self.hasAttribute("popup")) {
$tw.popup.triggerPopup({
domNode: domOverlay,
title: self.getAttribute("popup"),
floating: self.getAttribute("floating"),
title: self.getAttribute("popup"),
floating: self.getAttribute("floating"),
wiki: self.wiki
});
}
@@ -261,8 +260,6 @@ DynannotateWidget.prototype.applySearch = function() {
this.removeSearch();
// Gather parameters
var searchString = this.getAttribute("search",""),
searchMode = this.getAttribute("searchMode"),
searchCaseSensitive = this.getAttribute("searchCaseSensitive","yes") === "yes",
searchMinLength = parseInt(this.getAttribute("searchMinLength","1"),10) || 1;
// Bail if search string too short
if(searchString.length < searchMinLength) {
@@ -301,11 +298,6 @@ DynannotateWidget.prototype.applySnippets = function() {
var textMap = new TextMap(this.domContent);
// Remove any previous snippets
this.removeSnippets();
// Gather parameters
var searchString = this.getAttribute("search",""),
searchMode = this.getAttribute("searchMode"),
searchCaseSensitive = this.getAttribute("searchCaseSensitive","yes") === "yes",
searchMinLength = parseInt(this.getAttribute("searchMinLength","1"),10) || 1;
// Build the map of the text content
var textMap = new TextMap(this.domContent);
// Search for the string

View File

@@ -55,7 +55,7 @@ ElementSpotlight.prototype.querySelectorSafe = function(selector) {
targetNodes = [].slice.call(targetNodes, 1);
didRemoveFirstEntry = true;
}
} while(didRemoveFirstEntry)
} while(didRemoveFirstEntry);
// Return the first result
return targetNodes[0];
};

View File

@@ -31,7 +31,7 @@ SelectionTracker.prototype.handleSelectionChange = function() {
// Helper to get the tiddler title corresponding to a chunk container
var getIdOfContainer = function(domNode) {
return domNode.id;
}
};
// Get information about the selection anchor and focus
var getSelectionInfo = function(targetDomNode,targetOffset) {
// Find the chunk container node
@@ -83,9 +83,9 @@ SelectionTracker.prototype.handleSelectionChange = function() {
childNodeIndex: childNodeIndex,
beforeText: beforeText.join(""),
afterText: afterText.join("")
}
};
}
};
var anchor = getSelectionInfo(selection.anchorNode,selection.anchorOffset),
focus = getSelectionInfo(selection.focusNode,selection.focusOffset);
// Check that the containers share a parent
@@ -155,7 +155,7 @@ SelectionTracker.prototype.handleSelectionChange = function() {
SelectionTracker.prototype.performSelectionActions = function(chunks,variables,actionsTiddler) {
// Invoke the actions, passing the extract tiddler title as a variable
if(actionsTiddler) {
var actions = $tw.wiki.getTiddlerText(actionsTiddler)
var actions = $tw.wiki.getTiddlerText(actionsTiddler);
if(actions) {
var selection = JSON.stringify({chunks: chunks,variables: variables});
$tw.rootWidget.invokeActionString(actions,undefined,undefined,$tw.utils.extend({},variables,{selection: selection}));

View File

@@ -82,7 +82,7 @@ exports.TextMap.prototype.findText = function(targetString,targetPrefix,targetSu
startOffset: startPos - startMetadata.start,
endNode: endMetadata.domNode,
endOffset: (startPos + targetString.length) - endMetadata.start
}
};
}
}
return null;
@@ -116,12 +116,12 @@ exports.TextMap.prototype.search = function(searchString,options) {
} else if(options.mode === "whitespace") {
// Normalise whitespace
regExpString = "(" + searchString.split(/\s+/g).filter(function(word) {
return !!word
return !!word;
}).map($tw.utils.escapeRegExp).join("\\s+") + ")";
} else if(options.mode === "words" || options.mode === "some") {
// Match any word separated by whitespace
regExpString = "(" + searchString.split(/\s+/g).filter(function(word) {
return !!word
return !!word;
}).map($tw.utils.escapeRegExp).join("|") + ")";
} else {
// Normal search
@@ -164,8 +164,8 @@ Given a start container and offset and a search string, return a prefix and suff
*/
exports.TextMap.prototype.extractContext = function(startContainer,startOffset,text) {
var startMetadata = this.metadata.find(function(metadata) {
return metadata.domNode === startContainer
});
return metadata.domNode === startContainer;
});
if(!startMetadata) {
return null;
}