fix no-unused-vars violations

This commit is contained in:
Marcello Fitton
2026-03-03 13:52:11 -08:00
parent a0ce05660e
commit 18158ea7b9
41 changed files with 51 additions and 47 deletions
-1
View File
@@ -3,7 +3,6 @@ const { Document } = require("../models/documents");
const { EventLogs } = require("../models/eventLogs");
const { Invite } = require("../models/invite");
const { SystemSettings } = require("../models/systemSettings");
const { Telemetry } = require("../models/telemetry");
const { User } = require("../models/user");
const { DocumentVectors } = require("../models/vectors");
const { Workspace } = require("../models/workspace");
+1 -1
View File
@@ -21,7 +21,7 @@ function getMimeTypeFromDataUrl(dataUrl) {
try {
const matches = dataUrl.match(/^data:([^;]+);base64,/);
return matches ? matches[1].toLowerCase() : "image/png";
} catch (e) {
} catch {
return "image/png";
}
}
+1 -1
View File
@@ -49,7 +49,7 @@ function workspaceEndpoints(app) {
async (request, response) => {
try {
const user = await userFromSession(request, response);
const { name = null, onboardingComplete = false } = reqBody(request);
const { name = null } = reqBody(request);
const { workspace, message } = await Workspace.new(name, user?.id);
await Telemetry.sendTelemetry(
"workspace_created",
+1 -1
View File
@@ -26,7 +26,7 @@ async function batchDeleteFiles(filesToDelete, batchSize = 500) {
log(
`Deleted batch ${Math.floor(i / batchSize) + 1}: ${batch.length} files`
);
} catch (err) {
} catch {
// If batch fails, try individual files sync
for (const filePath of batch) {
try {
+1 -1
View File
@@ -93,7 +93,7 @@ const Document = {
if (!data) continue;
const docId = uuidv4();
const { pageContent, ...metadata } = data;
const { pageContent: _pageContent, ...metadata } = data;
const newDoc = {
docId,
filename: path.split("/")[1],
+1 -1
View File
@@ -47,7 +47,7 @@ const EmbedChats = {
filterSources: function (chats) {
return chats.map((chat) => {
const { response, ...rest } = chat;
const { sources, ...responseRest } = safeJsonParse(response);
const { sources: _sources, ...responseRest } = safeJsonParse(response);
return { ...rest, response: JSON.stringify(responseRest) };
});
},
+1 -1
View File
@@ -42,7 +42,7 @@ const MobileDevice = {
const tokenData = TemporaryMobileDeviceRequests.get(token);
if (tokenData.expiresAt < Date.now()) return null;
return tokenData;
} catch (error) {
} catch {
return null;
} finally {
TemporaryMobileDeviceRequests.delete(token);
+4 -5
View File
@@ -5,7 +5,6 @@ process.env.NODE_ENV === "development"
const { default: slugify } = require("slugify");
const { isValidUrl, safeJsonParse } = require("../utils/http");
const prisma = require("../utils/prisma");
const { v4 } = require("uuid");
const { MetaGenerator } = require("../utils/boot/MetaGenerator");
const { PGVector } = require("../utils/vectorDbProviders/pgvector");
const { NativeEmbedder } = require("../utils/EmbeddingEngines/native");
@@ -72,7 +71,7 @@ const SystemSettings = {
.filter((setting) => isValidUrl(setting.url))
.slice(0, 3); // max of 3 items in footer.
return JSON.stringify(array);
} catch (e) {
} catch {
console.error(`Failed to run validation function on footer_data`);
return JSON.stringify([]);
}
@@ -138,7 +137,7 @@ const SystemSettings = {
try {
const skills = updates.split(",").filter((skill) => !!skill);
return JSON.stringify(skills);
} catch (e) {
} catch {
console.error(`Could not validate agent skills.`);
return JSON.stringify([]);
}
@@ -147,7 +146,7 @@ const SystemSettings = {
try {
const skills = updates.split(",").filter((skill) => !!skill);
return JSON.stringify(skills);
} catch (e) {
} catch {
console.error(`Could not validate disabled agent skills.`);
return JSON.stringify([]);
}
@@ -163,7 +162,7 @@ const SystemSettings = {
safeJsonParse(updates, [])
);
return JSON.stringify(updatedConnections);
} catch (e) {
} catch {
console.error(`Failed to merge connections`);
return JSON.stringify(existingConnections ?? []);
}
+5 -1
View File
@@ -87,7 +87,11 @@ const User = {
},
filterFields: function (user = {}) {
const { password, web_push_subscription_config, ...rest } = user;
const {
password: _password,
web_push_subscription_config: _web_push_subscription_config,
...rest
} = user;
return { ...rest };
},
_identifyErrorAndFormatMessage: function (error) {
+1 -1
View File
@@ -4,7 +4,7 @@ function waitForElm(selector) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver((mutations) => {
const observer = new MutationObserver((_mutations) => {
if (document.querySelector(selector)) {
resolve(document.querySelector(selector));
observer.disconnect();
@@ -55,7 +55,7 @@ class AzureOpenAiLLM {
url.search = "";
url.hash = "";
return url.href;
} catch (error) {
} catch {
throw new Error(
`"${azureOpenAiEndpoint}" is not a valid URL. Check your settings for the Azure OpenAI provider and set a valid endpoint URL.`
);
@@ -45,7 +45,7 @@ class DellProAiStudioLLM {
const baseURL = new URL(providedBasePath);
const basePath = `${baseURL.origin}/v1/openai`;
return basePath;
} catch (e) {
} catch {
return null;
}
}
@@ -276,7 +276,7 @@ function parseDockerModelRunnerEndpoint(basePath = null, to = "openai") {
else if (to === "ollama") url.pathname = "api";
else if (to === "dmr") url.pathname = "";
return url.toString();
} catch (e) {
} catch {
return basePath;
}
}
+1 -1
View File
@@ -464,7 +464,7 @@ function parseFoundryBasePath(providedBasePath = "") {
const baseURL = new URL(providedBasePath);
const basePath = `${baseURL.origin}/v1`;
return basePath;
} catch (e) {
} catch {
return providedBasePath;
}
}
+1 -1
View File
@@ -89,7 +89,7 @@ class GiteeAILLM {
);
}
async isValidChatCompletionModel(modelName = "") {
async isValidChatCompletionModel(_modelName = "") {
return true;
}
+1 -1
View File
@@ -309,7 +309,7 @@ function parseLemonadeServerEndpoint(basePath = null, to = "openai") {
else if (to === "ollama") url.pathname = "api";
else if (to === "base") url.pathname = ""; // only used for /live
return url.toString();
} catch (e) {
} catch {
return basePath;
}
}
+1 -1
View File
@@ -356,7 +356,7 @@ function parseLMStudioBasePath(providedBasePath = "", apiVersion = "legacy") {
if (apiVersion === "legacy") basePath += `/v1`;
if (apiVersion === "v1") basePath += `/api/v1`;
return basePath;
} catch (e) {
} catch {
return providedBasePath;
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ class MistralLLM {
return 32000;
}
async isValidChatCompletionModel(modelName = "") {
async isValidChatCompletionModel(_modelName = "") {
return true;
}
+1 -1
View File
@@ -242,7 +242,7 @@ function parseNvidiaNimBasePath(providedBasePath = "") {
const baseURL = new URL(providedBasePath);
const basePath = `${baseURL.origin}/v1`;
return basePath;
} catch (e) {
} catch {
return providedBasePath;
}
}
+1
View File
@@ -112,6 +112,7 @@ class PPIOLLM {
* @param {{userPrompt:string, attachments: import("../../helpers").Attachment[]}}
* @returns {string|object[]}
*/
//eslint-disable-next-line
#generateContent({ userPrompt, attachments = [] }) {
if (!attachments.length) {
return userPrompt;
@@ -54,7 +54,7 @@ class PrivatemodeLLM {
const baseURL = new URL(providedBasePath);
const basePath = `${baseURL.origin}/v1`;
return basePath;
} catch (e) {
} catch {
return null;
}
}
@@ -1,4 +1,3 @@
const { toChunks } = require("../../helpers");
const { parseLemonadeServerEndpoint } = require("../../AiProviders/lemonade");
class LemonadeEmbedder {
@@ -44,7 +44,7 @@ class NativeEmbeddingReranker {
if (!NativeEmbeddingReranker.#transformers) return "https://huggingface.co";
try {
return new URL(NativeEmbeddingReranker.#transformers.env.remoteHost).host;
} catch (e) {
} catch {
return this.#fallbackHost;
}
}
+1 -1
View File
@@ -315,7 +315,7 @@ class MCPHypervisor {
try {
new URL(server.url);
} catch (error) {
} catch {
throw new Error(`MCP server "${name}": invalid URL "${server.url}"`);
}
return;
@@ -1,4 +1,4 @@
const { ElevenLabsClient, stream } = require("elevenlabs");
const { ElevenLabsClient } = require("elevenlabs");
class ElevenLabsTTS {
constructor() {
@@ -45,7 +45,7 @@ app.ws("/ws", function (ws, _response) {
})
);
});
} catch (error) {}
} catch {}
});
app.all("*", function (_, response) {
@@ -45,7 +45,7 @@ app.ws("/ws", function (ws, _response) {
})
);
});
} catch (error) {}
} catch {}
});
app.all("*", function (_, response) {
+1
View File
@@ -1,3 +1,4 @@
/* eslint-disable unused-imports/no-unused-vars */
const { EventEmitter } = require("events");
const { APIError } = require("./error.js");
const Providers = require("./providers/index.js");
@@ -1,7 +1,6 @@
// Plugin CAN ONLY BE USE IN DEVELOPMENT.
const { input } = require("@inquirer/prompts");
const chalk = require("chalk");
const { RetryError } = require("../error");
/**
* Command-line Interface plugin. It prints the messages on the console and asks for feedback
@@ -64,7 +64,7 @@ async function validateConnection(identifier = "", connectionConfig = {}) {
try {
const client = getDBClient(identifier, connectionConfig);
return await client.validateConnection();
} catch (error) {
} catch {
console.log(`Failed to connect to ${identifier} database.`);
return {
success: false,
@@ -37,7 +37,7 @@ module.exports.SqlAgentListDatabase = {
);
const connections = (await listSQLConnections()).map((conn) => {
const { connectionString, ...rest } = conn;
const { connectionString: _connectionString, ...rest } = conn;
return rest;
});
return JSON.stringify(connections);
@@ -631,6 +631,7 @@ const webBrowsing = {
query,
language = "en",
hl = "us",
//eslint-disable-next-line
limit = 100,
device_type = "desktop",
proxy_location = "US"
-1
View File
@@ -5,7 +5,6 @@ const Provider = require("./aibitat/providers/ai-provider");
const ImportedPlugin = require("./imported");
const { AgentFlows } = require("../agentFlows");
const MCPCompatibilityLayer = require("../MCP");
const { SystemPromptVariables } = require("../../models/systemPromptVariables");
// This is a list of skills that are built-in and default enabled.
const DEFAULT_SKILLS = [
+2 -2
View File
@@ -136,7 +136,7 @@ async function getDocumentsByFolder(folderName = "") {
const filePath = path.join(folderPath, file);
const rawData = fs.readFileSync(filePath, "utf8");
const cachefilename = `${folderName}/${file}`;
const { pageContent, ...metadata } = JSON.parse(rawData);
const { pageContent: _pageContent, ...metadata } = JSON.parse(rawData);
documents.push({
name: file,
type: "file",
@@ -251,7 +251,7 @@ async function findDocumentInDocuments(documentName = null) {
const fileData = fs.readFileSync(targetFileLocation, "utf8");
const cachefilename = `${folder}/${targetFilename}`;
const { pageContent, ...metadata } = JSON.parse(fileData);
const { pageContent: _pageContent, ...metadata } = JSON.parse(fileData);
return {
name: targetFilename,
type: "file",
@@ -33,7 +33,7 @@ class LLMPerformanceMonitor {
static countTokens(messages = []) {
try {
return this.tokenManager.statsFrom(messages);
} catch (e) {
} catch {
return 0;
}
}
+1 -1
View File
@@ -861,7 +861,7 @@ function isValidURL(input = "") {
try {
new URL(input);
return null;
} catch (e) {
} catch {
return "URL is not a valid URL.";
}
}
+1 -1
View File
@@ -95,7 +95,7 @@ function isValidUrl(urlString = "") {
const url = new URL(urlString);
if (!["http:", "https:"].includes(url.protocol)) return false;
return true;
} catch (e) {}
} catch {}
return false;
}
+1 -1
View File
@@ -157,7 +157,7 @@ async function canRespond(request, response, next) {
}
next();
} catch (e) {
} catch {
response.status(500).json({
id: uuidv4(),
type: "abort",
+3 -2
View File
@@ -1,5 +1,6 @@
/**
* Base class for all Vector Database providers.
/* eslint-disable unused-imports/no-unused-vars */
/* Base class for all Vector Database providers.
* All vector database providers should extend this class and implement/override the necessary methods.
*/
class VectorDatabase {
@@ -119,6 +119,7 @@ class ChromaCloud extends Chroma {
let counter = 1;
for (const chunk of chunks) {
await collection.add(chunk);
//eslint-disable-next-line
counter++;
}
return true;
@@ -313,7 +313,7 @@ class PGVector extends VectorDatabase {
(row) => row.tablename === PGVector.tableName()
);
return !!tableExists;
} catch (err) {
} catch {
return false;
} finally {
if (connection) await connection.end();
@@ -329,7 +329,7 @@ class PGVector extends VectorDatabase {
`SELECT COUNT(id) FROM "${PGVector.tableName()}"`
);
return result.rows[0].count;
} catch (err) {
} catch {
return 0;
} finally {
if (connection) await connection.end();
@@ -354,7 +354,7 @@ class PGVector extends VectorDatabase {
[namespace]
);
return result.rows[0].count;
} catch (err) {
} catch {
return 0;
} finally {
if (connection) await connection.end();
@@ -500,7 +500,7 @@ class PGVector extends VectorDatabase {
try {
connection = await this.connect();
return await this.namespaceExists(connection, namespace);
} catch (err) {
} catch {
return false;
} finally {
if (connection) await connection.end();
@@ -823,7 +823,7 @@ class PGVector extends VectorDatabase {
connection = await this.connect();
await connection.query(`DROP TABLE IF EXISTS "${PGVector.tableName()}"`);
return { reset: true };
} catch (err) {
} catch {
return { reset: false };
} finally {
if (connection) await connection.end();