Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

chore(lint): enable 38 more zero-cost ESLint safety rules (#3610)

LearningCircuitefbf8403c08b
diff --git a/eslint.config.js b/eslint.config.js
index e905fa3462..4037fd3327 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -100,6 +100,50 @@ export default [
"no-debugger": "error",
"no-redeclare": "error",
"no-throw-literal": "error",
+
+ // --- Zero-cost safety bundle v2 ---
+ // Correctness / real-bug catchers
+ "no-async-promise-executor": "error",
+ "no-class-assign": "error",
+ "no-const-assign": "error",
+ "no-import-assign": "error",
+ "no-setter-return": "error",
+ "no-this-before-super": "error",
+ "no-with": "error",
+ "no-octal": "error",
+ "no-octal-escape": "error",
+ "default-param-last": "error",
+ "no-multi-assign": "error",
+ // Dead / pointless code
+ "no-extra-bind": "error",
+ "no-extra-semi": "error",
+ "no-lone-blocks": "error",
+ "no-sequences": "error",
+ "no-useless-call": "error",
+ "no-useless-computed-key": "error",
+ "no-useless-constructor": "error",
+ "no-useless-rename": "error",
+ "no-useless-return": "error",
+ "no-void": "error",
+ "no-labels": "error",
+ "no-unneeded-ternary": "error",
+ // Prefer literals / modern idioms
+ "no-new-object": "error",
+ "no-array-constructor": "error",
+ "prefer-numeric-literals": "error",
+ "prefer-object-spread": "error",
+ "prefer-promise-reject-errors": "error",
+ "prefer-spread": "error",
+ "prefer-rest-params": "error",
+ "prefer-exponentiation-operator": "error",
+ // Safety discipline
+ "no-iterator": "error",
+ "no-proto": "error",
+ "no-extend-native": "error",
+ "default-case-last": "error",
+ // Formatting (acting as formatter — no Prettier for JS in this repo)
+ "no-trailing-spaces": "error",
+ "no-mixed-spaces-and-tabs": "error",
},
languageOptions: {
diff --git a/src/local_deep_research/web/static/js/collection_details.js b/src/local_deep_research/web/static/js/collection_details.js
index 88b0e492d9..3660421fa3 100644
--- a/src/local_deep_research/web/static/js/collection_details.js
+++ b/src/local_deep_research/web/static/js/collection_details.js
@@ -497,7 +497,7 @@ function formatBytes(bytes) {
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
- return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i];
+ return Math.round(bytes / k ** i * 100) / 100 + ' ' + sizes[i];
}
// Prefer the full escapeHtml from xss-protection.js; inline fallback if it hasn't loaded yet
diff --git a/src/local_deep_research/web/static/js/collections_manager.js b/src/local_deep_research/web/static/js/collections_manager.js
index 39d576b36b..0652c01ae6 100644
--- a/src/local_deep_research/web/static/js/collections_manager.js
+++ b/src/local_deep_research/web/static/js/collections_manager.js
@@ -230,7 +230,7 @@ function formatBytes(bytes) {
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
- return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i];
+ return Math.round(bytes / k ** i * 100) / 100 + ' ' + sizes[i];
}
// Prefer the full escapeHtml from xss-protection.js; inline fallback if it hasn't loaded yet
diff --git a/src/local_deep_research/web/static/js/components/research.js b/src/local_deep_research/web/static/js/components/research.js
index 78340a1fe4..886b712637 100644
--- a/src/local_deep_research/web/static/js/components/research.js
+++ b/src/local_deep_research/web/static/js/components/research.js
@@ -712,8 +712,7 @@
queryInput.addEventListener('keydown', function(event) {
if (event.key === 'Enter') {
if (event.shiftKey) {
- // Allow default behavior (new line)
- return;
+ // Allow default behavior (new line) — fall through
} else if (event.ctrlKey || event.metaKey) {
// Ctrl+Enter or Cmd+Enter = Submit form (common pattern)
event.preventDefault();
diff --git a/src/local_deep_research/web/static/js/components/settings.js b/src/local_deep_research/web/static/js/components/settings.js
index eebf9618a5..a3dfd8f335 100644
--- a/src/local_deep_research/web/static/js/components/settings.js
+++ b/src/local_deep_research/web/static/js/components/settings.js
@@ -2349,7 +2349,6 @@
} catch (e) {
// Mark as invalid and don't include
markInvalidInput(input, 'Invalid JSON format: ' + e.message);
- return;
}
} else {
formData[input.name] = input.value;
diff --git a/src/local_deep_research/web/static/js/deletion/delete_manager.js b/src/local_deep_research/web/static/js/deletion/delete_manager.js
index 275b5ce8f1..a98e82fb3f 100644
--- a/src/local_deep_research/web/static/js/deletion/delete_manager.js
+++ b/src/local_deep_research/web/static/js/deletion/delete_manager.js
@@ -65,7 +65,7 @@ function formatBytes(bytes) {
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
- return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
+ return parseFloat((bytes / k ** i).toFixed(2)) + ' ' + sizes[i];
}
// =============================================================================
diff --git a/src/local_deep_research/web/static/js/news-enhancements.js b/src/local_deep_research/web/static/js/news-enhancements.js
index 5b2c516e45..de0f0e5c28 100644
--- a/src/local_deep_research/web/static/js/news-enhancements.js
+++ b/src/local_deep_research/web/static/js/news-enhancements.js
@@ -31,7 +31,8 @@ document.addEventListener('DOMContentLoaded', function() {
const x = e.clientX - rect.left - size / 2;
const y = e.clientY - rect.top - size / 2;
- ripple.style.width = ripple.style.height = size + 'px';
+ ripple.style.width = size + 'px';
+ ripple.style.height = size + 'px';
ripple.style.left = x + 'px';
ripple.style.top = y + 'px';
diff --git a/src/local_deep_research/web/static/js/pdf_upload_handler.js b/src/local_deep_research/web/static/js/pdf_upload_handler.js
index 8e5091d2f5..a958d2e282 100644
--- a/src/local_deep_research/web/static/js/pdf_upload_handler.js
+++ b/src/local_deep_research/web/static/js/pdf_upload_handler.js
@@ -557,7 +557,7 @@ class PDFUploadHandler {
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
- return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
+ return parseFloat((bytes / k ** i).toFixed(2)) + ' ' + sizes[i];
}
/**
diff --git a/src/local_deep_research/web/static/js/research_form.js b/src/local_deep_research/web/static/js/research_form.js
index 19e5c52082..a1647facf4 100644
--- a/src/local_deep_research/web/static/js/research_form.js
+++ b/src/local_deep_research/web/static/js/research_form.js
@@ -154,9 +154,9 @@ function setupWarningListeners() {
// This will trigger when the research.js calls saveProviderSetting
if (typeof window.saveProviderSetting === 'function') {
const originalSaveProviderSetting = window.saveProviderSetting;
- window.saveProviderSetting = function() {
+ window.saveProviderSetting = function(...args) {
// Call the original function
- const result = originalSaveProviderSetting.apply(this, arguments);
+ const result = originalSaveProviderSetting.apply(this, args);
// After it completes, refetch settings and update warnings
setTimeout(refetchSettingsAndUpdateWarnings, 200);
return result;
diff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.js
index 91f8715726..c782e7058c 100644
--- a/tests/ui_tests/auth_helper.js
+++ b/tests/ui_tests/auth_helper.js
@@ -717,7 +717,7 @@ class AuthHelper {
* Prevents auth from hanging indefinitely in CI when the server is unresponsive.
* Default: 120s CI, 30s local.
*/
- async ensureAuthenticatedWithTimeout(username = null, password, timeoutMs = null) {
+ async ensureAuthenticatedWithTimeout(username = null, password = DEFAULT_TEST_USER.password, timeoutMs = null) {
if (timeoutMs === null) {
timeoutMs = this.isCI ? 120000 : 30000;
}
diff --git a/tests/ui_tests/browser_config.js b/tests/ui_tests/browser_config.js
index ee78f9fa77..19bfafb40b 100644
--- a/tests/ui_tests/browser_config.js
+++ b/tests/ui_tests/browser_config.js
@@ -4,7 +4,7 @@
*/
const BROWSER_CONFIG = {
- headless: process.env.CI ? true : false,
+ headless: Boolean(process.env.CI),
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
diff --git a/tests/ui_tests/playwright/tests/theme-visual-regression.spec.js b/tests/ui_tests/playwright/tests/theme-visual-regression.spec.js
index cc44aa2001..ca6ba1b700 100644
--- a/tests/ui_tests/playwright/tests/theme-visual-regression.spec.js
+++ b/tests/ui_tests/playwright/tests/theme-visual-regression.spec.js
@@ -185,7 +185,7 @@ test.describe('Theme Contrast - Text Readability', () => {
function luminance({ r, g, b }) {
const [rs, gs, bs] = [r, g, b].map(c => {
c = c / 255;
- return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
+ return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
});
return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
}
diff --git a/tests/ui_tests/test_export_functionality.js b/tests/ui_tests/test_export_functionality.js
index 789e048fca..252e337afc 100644
--- a/tests/ui_tests/test_export_functionality.js
+++ b/tests/ui_tests/test_export_functionality.js
@@ -352,7 +352,7 @@ async function testExportFunctionality() {
const exportButton = await page.$('.export-btn, button[data-action="export"], [class*="export"]') ||
await page.evaluate(() => {
const buttons = Array.from(document.querySelectorAll('.dropdown-toggle, button'));
- return buttons.find(b => b.textContent.includes('Export')) ? true : false;
+ return Boolean(buttons.find(b => b.textContent.includes('Export')));
});
if (exportButton) {
log('✅ Export button found', 'success');
@@ -383,7 +383,7 @@ async function testExportFunctionality() {
const printButton = await page.$('.print-btn, button[data-action="print"]') ||
await page.evaluate(() => {
const buttons = Array.from(document.querySelectorAll('button'));
- return buttons.find(b => b.textContent.includes('Print')) ? true : false;
+ return Boolean(buttons.find(b => b.textContent.includes('Print')));
});
if (printButton) {
log('✅ Print button found', 'success');
@@ -393,7 +393,7 @@ async function testExportFunctionality() {
const copyButton = await page.$('.copy-btn, button[data-action="copy"]') ||
await page.evaluate(() => {
const buttons = Array.from(document.querySelectorAll('button'));
- return buttons.find(b => b.textContent.includes('Copy')) ? true : false;
+ return Boolean(buttons.find(b => b.textContent.includes('Copy')));
});
if (copyButton) {
log('✅ Copy button found', 'success');
diff --git a/tests/ui_tests/test_metrics_full_flow.js b/tests/ui_tests/test_metrics_full_flow.js
index e6b722b3d8..5d8390ed6b 100644
--- a/tests/ui_tests/test_metrics_full_flow.js
+++ b/tests/ui_tests/test_metrics_full_flow.js
@@ -111,9 +111,9 @@ async function startAndCompleteResearch(page, query) {
const tokenCount = document.querySelector('.token-count, .tokens-used');
const statusText = statusEl ? statusEl.textContent.toLowerCase() : '';
- const hasProgress = progressEl ? true : false;
- const hasSearches = searchCount ? true : false;
- const hasTokens = tokenCount ? true : false;
+ const hasProgress = Boolean(progressEl);
+ const hasSearches = Boolean(searchCount);
+ const hasTokens = Boolean(tokenCount);
return {
text: statusText,