fix: A27 lint terminé — eslint 0/0 (285 warnings nettoyés) (v7.25.0)
3 familles, 13 fichiers (+153/−167) :
1. no-empty ×70 = TOUS des `catch (x) {}` vides → `catch { /* volontaire */ }`
(binding optionnel ES2019 + commentaire : passe no-empty ET
no-unused-vars, zéro changement de comportement).
2. no-unused-vars ×171 :
- bindings de catch inutilisés retirés (e/err/ex/e2/e3)
- 24 lignes mortes déterministes, chaque suppression validée par assert
sur le texte exact (`var self = this` ×8, `var lang`, `var acc`,
`var today`, `var path/restored/files/resolved/items/clickEl`,
`uid()`/`propName()` sans un seul appel, `.then` + `resolved++`
compteurs jamais lus)
- `/* exported */` sur les 10 fonctions appelées depuis les attributs
HTML des templates (vérifiées par grep : 1 template chacune) :
setActiveTab/kanbanBoard/filterSystem/sortSystem/newIssueForm/
showNewIssue, importWizard, libraryPage, workspacesPage, settingsInit
3. no-undef ×44 = vrais globaux déclarés dans eslint.config.mjs
(getSvgIcon = script inline de base.html, TextDecoder = API navigateur,
Prism = CDN) + 2 vrais correctifs :
- settings.js : `typeof toast === 'function'` = guard TOUJOURS faux
(pas de toast global) → les toasts timezone/SAML ne s'affichaient
jamais → `window.showToast` (2 sites)
- local_workspace.js : `_wsInitData = window._wsInitData`
(auto-affectation sans effet, global implicite) supprimé
eslint static/js : **0 erreur / 0 warning** (285 → 0) · node --check vert
sur tous les fichiers · suite **1089/1089** · ruff OK · docs à jour
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const LW=(()=>{try{const el=document.getElementById('lw-config');return el?JSON.parse(el.textContent):{}}catch(e){return {}}})();
|
||||
const LW=(()=>{try{const el=document.getElementById('lw-config');return el?JSON.parse(el.textContent):{}}catch{return {}}})();
|
||||
|
||||
console.log('FLOWDECK v2.4.6 — IIFE running, about to set _wsInitData');
|
||||
window._wsInitData = (function() {
|
||||
@@ -17,7 +17,7 @@ window._wsInitData = (function() {
|
||||
target:null,
|
||||
expanded: (function() {
|
||||
try { return JSON.parse(localStorage.getItem('fd_ws_expanded') || '{}'); }
|
||||
catch(e) { return {}; }
|
||||
catch { return {}; }
|
||||
})(),
|
||||
currentFolder: LW.current_folder_id,
|
||||
searchQuery: '',
|
||||
@@ -118,7 +118,7 @@ window._wsInitData = (function() {
|
||||
pendingSyncCount: 0,
|
||||
pinnedIds: (function() {
|
||||
try { return JSON.parse(localStorage.getItem('fd_ws_pinned') || '[]'); }
|
||||
catch(e) { return []; }
|
||||
catch { return []; }
|
||||
})(),
|
||||
|
||||
// Navigation history
|
||||
@@ -223,13 +223,13 @@ window._wsInitData = (function() {
|
||||
window._wsData.closePreviewPanel();
|
||||
}
|
||||
dragging = false;
|
||||
try { localStorage.setItem('fd_peek_width', panel.style.width); } catch(ex) {}
|
||||
try { localStorage.setItem('fd_peek_width', panel.style.width); } catch { /* volontaire */ }
|
||||
handle.releasePointerCapture(e.pointerId);
|
||||
});
|
||||
try {
|
||||
var saved = localStorage.getItem('fd_peek_width');
|
||||
if (saved) panel.style.width = saved;
|
||||
} catch(ex) {}
|
||||
} catch { /* volontaire */ }
|
||||
},
|
||||
|
||||
_recompute() {
|
||||
@@ -252,7 +252,7 @@ window._wsInitData = (function() {
|
||||
if (idx === -1) this.pinnedIds.push(id);
|
||||
else this.pinnedIds.splice(idx, 1);
|
||||
try { localStorage.setItem('fd_ws_pinned', JSON.stringify(this.pinnedIds)); }
|
||||
catch(e) {}
|
||||
catch { /* volontaire */ }
|
||||
this._haptic();
|
||||
},
|
||||
isPinned(id) {
|
||||
@@ -380,7 +380,6 @@ window._wsInitData = (function() {
|
||||
|
||||
_getItemPath(id) {
|
||||
// Build folder path by walking up parent chain via tree
|
||||
var path = [];
|
||||
var found = this._findInTree(this.tree, id);
|
||||
if (!found) return '—';
|
||||
return '/' + found.path.reverse().join('/');
|
||||
@@ -515,7 +514,7 @@ window._wsInitData = (function() {
|
||||
} else {
|
||||
preview = '<div style="text-align:center;padding:30px;color:var(--text-tertiary)">Empty document</div>';
|
||||
}
|
||||
} catch(e) {
|
||||
} catch {
|
||||
preview = '<pre style="background:var(--bg-tertiary);padding:14px;border-radius:6px;overflow:auto;font-size:12px;font-family:monospace;white-space:pre-wrap;">' + this._escHtml(String(content).substring(0, 3000)) + '</pre>';
|
||||
}
|
||||
|
||||
@@ -533,7 +532,7 @@ window._wsInitData = (function() {
|
||||
}
|
||||
}
|
||||
body.innerHTML = preview || '<div style="color:var(--text-tertiary);text-align:center;padding:20px">(empty)</div>';
|
||||
} catch(e) {
|
||||
} catch {
|
||||
body.innerHTML = '<div style="text-align:center;padding:20px;color:var(--text-tertiary)">Preview not available</div>';
|
||||
}
|
||||
},
|
||||
@@ -602,7 +601,7 @@ window._wsInitData = (function() {
|
||||
} else {
|
||||
if (window.showToast) window.showToast('Not a text file', 'error');
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
if (window.showToast) window.showToast('Copy failed', 'error');
|
||||
}
|
||||
},
|
||||
@@ -634,7 +633,7 @@ window._wsInitData = (function() {
|
||||
if (window.appState && window.appState.refreshFavorites) window.appState.refreshFavorites();
|
||||
if (window.showToast) window.showToast(node.favorited ? 'Added to Favorites' : 'Removed from Favorites', 'success');
|
||||
}
|
||||
} catch(e) {}
|
||||
} catch { /* volontaire */ }
|
||||
},
|
||||
|
||||
async setItemIcon(node, icon) {
|
||||
@@ -652,7 +651,7 @@ window._wsInitData = (function() {
|
||||
this.displayTree = [...this.tree];
|
||||
this._reloadAfterAction();
|
||||
if (window.showToast) window.showToast('Icon updated', 'success');
|
||||
} catch(e) {
|
||||
} catch {
|
||||
if (window.showToast) window.showToast('Failed to update icon', 'error');
|
||||
}
|
||||
},
|
||||
@@ -741,7 +740,7 @@ window._wsInitData = (function() {
|
||||
this._computeFilteredTableItems();
|
||||
this._ctxRefreshAvail();
|
||||
}
|
||||
} catch(e) {}
|
||||
} catch { /* volontaire */ }
|
||||
},
|
||||
|
||||
_markTree(nodes, depth) {
|
||||
@@ -873,7 +872,7 @@ window._wsInitData = (function() {
|
||||
if (node) { node.name = newName; }
|
||||
this._reloadAfterAction();
|
||||
}
|
||||
} catch(e) {}
|
||||
} catch { /* volontaire */ }
|
||||
},
|
||||
|
||||
esc(s) {
|
||||
@@ -1012,7 +1011,7 @@ window._wsInitData = (function() {
|
||||
|
||||
_saveExpandedState() {
|
||||
try { localStorage.setItem('fd_ws_expanded', JSON.stringify(this.expanded)); }
|
||||
catch(e) {}
|
||||
catch { /* volontaire */ }
|
||||
},
|
||||
_reloadAfterAction() {
|
||||
this._saveExpandedState();
|
||||
@@ -1051,7 +1050,6 @@ window._wsInitData = (function() {
|
||||
this._saveExpandedState();
|
||||
if (window.appState && window.appState.refreshSidebarTree) window.appState.refreshSidebarTree();
|
||||
if (window.FlowDeck && window.FlowDeck.syncPageTitle) window.FlowDeck.syncPageTitle(node.id, n);
|
||||
var self = this;
|
||||
if (this.folderStack && this.folderStack.length) {
|
||||
this.folderStack.forEach(function(f) { if (String(f.id) === String(node.id)) f.name = n; });
|
||||
}
|
||||
@@ -1155,7 +1153,6 @@ window._wsInitData = (function() {
|
||||
if (!ids.length || !ids[0]) return;
|
||||
// Restore via API (soft-delete undo) — single or bulk
|
||||
var self = this;
|
||||
var restored = 0;
|
||||
var total = ids.length;
|
||||
function restoreOne(i) {
|
||||
if (i >= total) {
|
||||
@@ -1163,7 +1160,6 @@ window._wsInitData = (function() {
|
||||
return;
|
||||
}
|
||||
fetch('/api/local-workspace/items/' + ids[i] + '/restore', {headers: {'X-CSRF-Token': (document.cookie.match(/csrf_token=([^;]+)/)||[])[1]||''}, method: 'POST' })
|
||||
.then(function(r) { if (r.ok) restored++; })
|
||||
.finally(function() { restoreOne(i + 1); });
|
||||
}
|
||||
restoreOne(0);
|
||||
@@ -1274,7 +1270,6 @@ window._wsInitData = (function() {
|
||||
_fetchRetry(url, json) {
|
||||
var maxRetries = 2;
|
||||
var delay = 300;
|
||||
var self = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
function attempt(n) {
|
||||
fetch(url).then(function(r) {
|
||||
@@ -1432,7 +1427,7 @@ window._wsInitData = (function() {
|
||||
}
|
||||
return lines.join('\n').substring(0, 500) || '(empty)';
|
||||
}
|
||||
} catch(e) {}
|
||||
} catch { /* volontaire */ }
|
||||
}
|
||||
// Fallback: raw text
|
||||
return String(content).substring(0, 500);
|
||||
@@ -1575,7 +1570,6 @@ window._wsInitData = (function() {
|
||||
// Find parent node id from the onclick attribute or data
|
||||
var li = parentFolder.closest('.ws-tree-item');
|
||||
if (li) {
|
||||
var clickEl = li.querySelector('.name.folder');
|
||||
// Try to extract ID from onclick or the onclick handler
|
||||
// Use data attributes if available, otherwise fall back
|
||||
}
|
||||
@@ -1646,7 +1640,6 @@ window._wsInitData = (function() {
|
||||
var items = ev.dataTransfer.items;
|
||||
if (!items) return;
|
||||
|
||||
var self = this;
|
||||
var dtFiles = ev.dataTransfer.files;
|
||||
|
||||
// Check if any item is a directory (WebKit only)
|
||||
@@ -1700,7 +1693,6 @@ window._wsInitData = (function() {
|
||||
function doUpload() {
|
||||
// Build structure
|
||||
var structure = [];
|
||||
var files = [];
|
||||
for (var i = 0; i < allItems.length; i++) {
|
||||
structure.push({path: allItems[i].path, type: allItems[i].type});
|
||||
}
|
||||
@@ -1711,7 +1703,6 @@ window._wsInitData = (function() {
|
||||
if (allItems[i].type === 'file') fileEntries.push(allItems[i]);
|
||||
}
|
||||
|
||||
var resolved = 0;
|
||||
var formData = new FormData();
|
||||
formData.append('structure', JSON.stringify(structure));
|
||||
if (parentId) formData.append('parent_id', parentId);
|
||||
@@ -1725,10 +1716,8 @@ window._wsInitData = (function() {
|
||||
var fe = fileEntries[idx];
|
||||
fe.entry.file(function(file) {
|
||||
formData.append('files', file, fe.path);
|
||||
resolved++;
|
||||
addFile(idx + 1);
|
||||
}, function() {
|
||||
resolved++;
|
||||
addFile(idx + 1);
|
||||
});
|
||||
}
|
||||
@@ -1779,7 +1768,6 @@ window._wsInitData = (function() {
|
||||
if (r.ok) {
|
||||
this.uploadStatus = '✓ ' + d.items.length + ' item(s) uploaded';
|
||||
this.uploadProgress = 100;
|
||||
var items = d.items || [];
|
||||
setTimeout(function() {
|
||||
self.uploading = false;
|
||||
self._reloadAfterAction();
|
||||
@@ -1789,7 +1777,7 @@ window._wsInitData = (function() {
|
||||
this.uploadProgress = 0;
|
||||
setTimeout(function() { self.uploading = false; }, 2000);
|
||||
}
|
||||
} catch(e) {
|
||||
} catch {
|
||||
this.uploadStatus = '✗ Network error';
|
||||
this.uploadProgress = 0;
|
||||
setTimeout(function() { self.uploading = false; }, 2000);
|
||||
@@ -1802,7 +1790,7 @@ window._wsInitData = (function() {
|
||||
var r = await fetch('/api/local-workspace/tags', { cache: 'no-store' });
|
||||
var d = await r.json();
|
||||
this.workspaceTags = d.tags || [];
|
||||
} catch(e) { this.workspaceTags = []; }
|
||||
} catch { this.workspaceTags = []; }
|
||||
},
|
||||
|
||||
// Mise à jour OPTIMISTE du compteur d'un tag dans la barre de tags :
|
||||
@@ -1859,7 +1847,7 @@ window._wsInitData = (function() {
|
||||
await this.loadWorkspaceTags();
|
||||
this._computeFilteredTableItems();
|
||||
}
|
||||
} catch(e) {}
|
||||
} catch { /* volontaire */ }
|
||||
this.tagInputId = null;
|
||||
},
|
||||
|
||||
@@ -1876,7 +1864,7 @@ window._wsInitData = (function() {
|
||||
await this.loadWorkspaceTags();
|
||||
this._computeFilteredTableItems();
|
||||
}
|
||||
} catch(e) {}
|
||||
} catch { /* volontaire */ }
|
||||
},
|
||||
|
||||
_updateNodeTags(nodes, itemId, tag, action, removeTagId) {
|
||||
@@ -1983,7 +1971,7 @@ window._wsInitData = (function() {
|
||||
this._collectFolders(d.tree || [], folders, 0);
|
||||
this._moveAllCandidates = folders;
|
||||
this.moveCandidates = folders.slice(0, 50);
|
||||
} catch(e) {
|
||||
} catch {
|
||||
this._moveAllCandidates = [];
|
||||
this.moveCandidates = [];
|
||||
}
|
||||
@@ -2014,7 +2002,7 @@ window._wsInitData = (function() {
|
||||
headers: {'X-CSRF-Token': (document.cookie.match(/csrf_token=([^;]+)/)||[])[1]||'', 'Content-Type':'application/json'},
|
||||
body: JSON.stringify({ parent_id: parentId || null })
|
||||
});
|
||||
} catch(e) {}
|
||||
} catch { /* volontaire */ }
|
||||
}
|
||||
this.clearSelection();
|
||||
this._reloadAfterAction();
|
||||
@@ -2026,7 +2014,6 @@ window._wsInitData = (function() {
|
||||
// Injecter toutes les props comme globales pour Alpine (résout les 36 erreurs de scope)
|
||||
var _wsKeys = Object.keys(window._wsInitData);
|
||||
for (var _i = 0; _i < _wsKeys.length; _i++) {
|
||||
try { window[_wsKeys[_i]] = window._wsInitData[_wsKeys[_i]]; } catch(e) {}
|
||||
try { window[_wsKeys[_i]] = window._wsInitData[_wsKeys[_i]]; } catch { /* volontaire */ }
|
||||
}
|
||||
_wsInitData = window._wsInitData;
|
||||
console.log('FLOWDECK v2.4.6 — IIFE done, _wsInitData keys:', Object.keys(window._wsInitData).length);
|
||||
|
||||
Reference in New Issue
Block a user