~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
chore(lint): enable 24 more zero-cost ESLint safety rules (#3617)
LearningCircuitb1112ebcf79d
diff --git a/eslint.config.js b/eslint.config.jsindex 4037fd3327..cd369200d7 100644--- a/eslint.config.js+++ b/eslint.config.js@@ -144,6 +144,37 @@ export default [// Formatting (acting as formatter — no Prettier for JS in this repo)"no-trailing-spaces": "error","no-mixed-spaces-and-tabs": "error",++ // --- Zero-cost safety bundle v3 ---+ // Correctness / real-bug catchers+ "no-implicit-globals": "error",+ "no-new-native-nonconstructor": "error",+ "no-new-require": "error",+ "no-new-wrappers": "error",+ "no-nonoctal-decimal-escape": "error",+ "no-shadow-restricted-names": "error",+ "no-unmodified-loop-condition": "error",+ "no-unreachable-loop": "error",+ "no-useless-backreference": "error",+ "no-duplicate-imports": "error",+ // Prefer modern idioms+ "prefer-regex-literals": "error",+ "no-object-constructor": "error",+ "logical-assignment-operators": ["error", "always"],+ "operator-assignment": "error",+ // Dead / pointless code+ "no-undef-init": "error",+ "no-template-curly-in-string": "error",+ "no-multi-str": "error",+ "no-confusing-arrow": ["error", { "allowParens": true }],+ // Accessors & classes+ "grouped-accessor-pairs": "error",+ "no-unused-private-class-members": "error",+ // Style discipline+ "func-name-matching": "error",+ "require-yield": "error",+ "symbol-description": "error",+ "yoda": "error",},languageOptions: {diff --git a/src/local_deep_research/web/static/js/components/library_search.js b/src/local_deep_research/web/static/js/components/library_search.jsindex 051afee565..479dc73aea 100644--- a/src/local_deep_research/web/static/js/components/library_search.js+++ b/src/local_deep_research/web/static/js/components/library_search.js@@ -81,7 +81,7 @@ function getCsrfToken() {* @returns {Promise<Object>} API response { success, results, query }*/async function performSemanticSearch(collectionId, query, limit) {- limit = limit || 20;+ limit ||= 20;const url = (typeof URLBuilder !== 'undefined')? URLBuilder.build(URLS.LIBRARY_API.COLLECTION_SEARCH, collectionId): '/library/api/collections/' + collectionId + '/search';@@ -112,7 +112,7 @@ async function performSemanticSearch(collectionId, query, limit) {* @returns {Promise<Array>} merged, deduplicated results sorted by similarity DESC*/async function searchAllCollections(collectionIds, query, limit) {- limit = limit || 20;+ limit ||= 20;if (!collectionIds || collectionIds.length === 0) return [];// Search in batches to avoid overwhelming the serverdiff --git a/src/local_deep_research/web/static/js/components/logpanel.js b/src/local_deep_research/web/static/js/components/logpanel.jsindex c37339fca2..1e09288615 100644--- a/src/local_deep_research/web/static/js/components/logpanel.js+++ b/src/local_deep_research/web/static/js/components/logpanel.js@@ -21,7 +21,7 @@const MAX_LOG_ENTRIES = 500;// Shared state for log panel- window._logPanelState = window._logPanelState || {+ window._logPanelState ||= {expanded: false,queuedLogs: [],logCount: 0,diff --git a/src/local_deep_research/web/static/js/components/research.js b/src/local_deep_research/web/static/js/components/research.jsindex 886b712637..7c926cffcf 100644--- a/src/local_deep_research/web/static/js/components/research.js+++ b/src/local_deep_research/web/static/js/components/research.js@@ -332,7 +332,7 @@const searchDropdownInstance = window.setupCustomDropdown(searchEngineInput,searchEngineDropdownList,- () => searchEngineOptions.length > 0 ? searchEngineOptions : [{ value: '', label: 'No search engines available' }],+ () => (searchEngineOptions.length > 0 ? searchEngineOptions : [{ value: '', label: 'No search engines available' }]),(value, item) => {selectedSearchEngineValue = value;diff --git a/src/local_deep_research/web/static/js/components/settings.js b/src/local_deep_research/web/static/js/components/settings.jsindex a3dfd8f335..73c23dfa54 100644--- a/src/local_deep_research/web/static/js/components/settings.js+++ b/src/local_deep_research/web/static/js/components/settings.js@@ -3488,12 +3488,12 @@const modelDropdownControl = window.setupCustomDropdown(settingsModelInput,modelDropdownList,- () => modelOptions.length > 0 ? modelOptions : [+ () => (modelOptions.length > 0 ? modelOptions : [{ value: 'gpt-4o', label: 'GPT-4o (OpenAI)' },{ value: 'gpt-3.5-turbo', label: 'GPT-3.5 Turbo (OpenAI)' },{ value: 'claude-3-5-sonnet-latest', label: 'Claude 3.5 Sonnet (Anthropic)' },{ value: 'llama3', label: 'Llama 3 (Ollama)' }- ],+ ]),(value) => {SafeLogger.log('Model selected:', value);@@ -3630,7 +3630,7 @@const dropdown = window.setupCustomDropdown(searchEngineInput,dropdownList,- () => searchEngineOptions.length > 0 ? searchEngineOptions : [{ value: 'auto', label: 'Auto (Default)' }],+ () => (searchEngineOptions.length > 0 ? searchEngineOptions : [{ value: 'auto', label: 'Auto (Default)' }]),(value) => {SafeLogger.log('Search engine selected:', value);// Update the hidden input value@@ -4297,9 +4297,9 @@const modelDropdownControl = window.setupCustomDropdown(modelInput,modelDropdownList, // Use correct variable name- () => filteredModels.length > 0 ? filteredModels : [+ () => (filteredModels.length > 0 ? filteredModels : [{ value: 'no-models', label: 'No models available for this provider' }- ],+ ]),(value) => {SafeLogger.log('Selected model:', value);// Save the selectiondiff --git a/src/local_deep_research/web/static/js/pages/news.js b/src/local_deep_research/web/static/js/pages/news.jsindex 42f3e2cb67..8775f56373 100644--- a/src/local_deep_research/web/static/js/pages/news.js+++ b/src/local_deep_research/web/static/js/pages/news.js@@ -2079,8 +2079,8 @@ function getCSRFToken() {const NEWS_CARD_CONFIG = {getId: (r) => r.research_id || '',getTitle: (r) => r.research_title || r.title || 'Untitled',- getUrl: (r) => (typeof URLBuilder !== 'undefined' && r.research_id)- ? URLBuilder.resultsPage(r.research_id) : '#',+ getUrl: (r) => ((typeof URLBuilder !== 'undefined' && r.research_id)+ ? URLBuilder.resultsPage(r.research_id) : '#'),getBadges: () => [{ icon: 'newspaper', label: 'News' }],getDate: (r) => r.research_created_at,getSubtitle: () => null,@@ -2450,7 +2450,7 @@ async function monitorResearch(researchId, query = null) {const statusResponse = await fetch(URLBuilder.researchStatus(researchId));if (statusResponse.ok) {const statusData = await statusResponse.json();- query = query || statusData.query || 'News Analysis';+ query ||= statusData.query || 'News Analysis';// Show the progress card immediatelyconst container = document.getElementById('news-feed-content');diff --git a/src/local_deep_research/web/static/js/services/socket.js b/src/local_deep_research/web/static/js/services/socket.jsindex 156005e2c4..adc3796d74 100644--- a/src/local_deep_research/web/static/js/services/socket.js+++ b/src/local_deep_research/web/static/js/services/socket.js@@ -294,7 +294,7 @@ window.socket = (function() {}// Initialize message tracking if not exists- window._processedSocketMessages = window._processedSocketMessages || new Map();+ window._processedSocketMessages ||= new Map();// Process logs from progress_log if availableif (data.progress_log && typeof data.progress_log === 'string') {@@ -391,7 +391,7 @@ window.socket = (function() {}// Make sure global tracking is initialized- window._processedSocketMessages = window._processedSocketMessages || new Map();+ window._processedSocketMessages ||= new Map();// Generate a message keyconst messageKey = `${data.log_entry.time || new Date().toISOString()}-${data.log_entry.message}`;@@ -574,7 +574,7 @@ window.socket = (function() {}, 3000);// Store the interval ID for later cleanup- window.pollIntervals = window.pollIntervals || {};+ window.pollIntervals ||= {};window.pollIntervals[id] = pollInterval;};diff --git a/src/local_deep_research/web/static/js/utils/log-helpers.js b/src/local_deep_research/web/static/js/utils/log-helpers.jsindex c455ef1c82..a2be24537d 100644--- a/src/local_deep_research/web/static/js/utils/log-helpers.js+++ b/src/local_deep_research/web/static/js/utils/log-helpers.js@@ -51,7 +51,7 @@for (let i = 0; i < str.length; i++) {const char = str.charCodeAt(i);hash = ((hash << 5) - hash) + char;- hash = hash & hash; // Convert to 32bit integer+ hash &= hash; // Convert to 32bit integer}return hash.toString();}diff --git a/tests/infrastructure_tests/test_xss_protection.test.js b/tests/infrastructure_tests/test_xss_protection.test.jsindex 23534c32ca..bdb4f9ea03 100644--- a/tests/infrastructure_tests/test_xss_protection.test.js+++ b/tests/infrastructure_tests/test_xss_protection.test.js@@ -20,8 +20,8 @@ const mockDOMPurify = {addHook: jest.fn((hookName, callback) => {// Mock addHook for tabnabbing protection// Stores callbacks but doesn't execute them in tests- mockDOMPurify._hooks = mockDOMPurify._hooks || {};- mockDOMPurify._hooks[hookName] = mockDOMPurify._hooks[hookName] || [];+ mockDOMPurify._hooks ||= {};+ mockDOMPurify._hooks[hookName] ||= [];mockDOMPurify._hooks[hookName].push(callback);}),_hooks: {}diff --git a/tests/js/utils/form-validation.test.js b/tests/js/utils/form-validation.test.jsindex 3747a3bc4b..c00ac8a649 100644--- a/tests/js/utils/form-validation.test.js+++ b/tests/js/utils/form-validation.test.js@@ -101,7 +101,7 @@ describe('FormValidator', () => {});it('clears error state when field becomes valid', () => {- validator.addValidation(input, (val) => val ? null : 'Required');+ validator.addValidation(input, (val) => (val ? null : 'Required'));input.value = '';validator.validateField(input);expect(input.classList.contains('ldr-field-invalid')).toBe(true);diff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.jsindex c782e7058c..2a02455cba 100644--- a/tests/ui_tests/auth_helper.js+++ b/tests/ui_tests/auth_helper.js@@ -98,7 +98,7 @@ function generateRandomUsername() {random = crypto.randomBytes(4).readUInt32BE(0);} while (random >= limit); // Reject values that would cause bias- random = random % 1000;+ random %= 1000;return `testuser_${timestamp}_${random}`;}diff --git a/tests/ui_tests/playwright/tests/theme-visual-regression.spec.js b/tests/ui_tests/playwright/tests/theme-visual-regression.spec.jsindex ca6ba1b700..d45ec9c561 100644--- a/tests/ui_tests/playwright/tests/theme-visual-regression.spec.js+++ b/tests/ui_tests/playwright/tests/theme-visual-regression.spec.js@@ -184,7 +184,7 @@ test.describe('Theme Contrast - Text Readability', () => {*/function luminance({ r, g, b }) {const [rs, gs, bs] = [r, g, b].map(c => {- c = c / 255;+ c /= 255;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_settings_errors.js b/tests/ui_tests/test_settings_errors.jsindex b5d4890407..ed9fc52848 100644--- a/tests/ui_tests/test_settings_errors.js+++ b/tests/ui_tests/test_settings_errors.js@@ -77,7 +77,7 @@ async function testSettingsChange() {}} else {// For input, change the value- el.value = el.value + '_test';+ el.value += '_test';el.dispatchEvent(new Event('change', { bubbles: true }));}}, settingInput);