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
67 lines
3.0 KiB
JavaScript
67 lines
3.0 KiB
JavaScript
// FlowDeck — ESLint flat config (v5.2.0).
|
|
// ESLint v9+ requires the flat config format; the legacy `.eslintrc.json`
|
|
// is no longer read. Run with: `npx eslint static/js`.
|
|
//
|
|
// Self-contained on purpose: no dependency on the `globals` npm package so the
|
|
// config works with a globally-installed ESLint (no node_modules required).
|
|
|
|
const browserGlobals = {
|
|
// Browser / DOM
|
|
window: "readonly", document: "readonly", navigator: "readonly",
|
|
location: "readonly", history: "readonly", screen: "readonly",
|
|
localStorage: "readonly", sessionStorage: "readonly", console: "readonly",
|
|
alert: "readonly", confirm: "readonly", prompt: "readonly", fetch: "readonly",
|
|
setTimeout: "readonly", clearTimeout: "readonly", setInterval: "readonly",
|
|
clearInterval: "readonly", requestAnimationFrame: "readonly",
|
|
cancelAnimationFrame: "readonly", requestIdleCallback: "readonly",
|
|
cancelIdleCallback: "readonly", queueMicrotask: "readonly",
|
|
XMLHttpRequest: "readonly", FormData: "readonly", Blob: "readonly",
|
|
File: "readonly", FileReader: "readonly", URL: "readonly",
|
|
URLSearchParams: "readonly", Image: "readonly", Event: "readonly",
|
|
CustomEvent: "readonly", EventSource: "readonly", WebSocket: "readonly",
|
|
DOMParser: "readonly", Node: "readonly", NodeList: "readonly",
|
|
Element: "readonly", HTMLElement: "readonly", getComputedStyle: "readonly",
|
|
matchMedia: "readonly", IntersectionObserver: "readonly",
|
|
MutationObserver: "readonly", ResizeObserver: "readonly",
|
|
performance: "readonly", crypto: "readonly", btoa: "readonly",
|
|
atob: "readonly", structuredClone: "readonly",
|
|
// ECMAScript built-ins
|
|
JSON: "readonly", Math: "readonly", Date: "readonly", Promise: "readonly",
|
|
Object: "readonly", Array: "readonly", String: "readonly", Number: "readonly",
|
|
Boolean: "readonly", Symbol: "readonly", Map: "readonly", Set: "readonly",
|
|
WeakMap: "readonly", WeakSet: "readonly", Error: "readonly",
|
|
TypeError: "readonly", RangeError: "readonly", RegExp: "readonly",
|
|
Proxy: "readonly", Reflect: "readonly", Intl: "readonly",
|
|
parseInt: "readonly", parseFloat: "readonly", isNaN: "readonly",
|
|
isFinite: "readonly", encodeURIComponent: "readonly",
|
|
decodeURIComponent: "readonly", encodeURI: "readonly", decodeURI: "readonly",
|
|
globalThis: "readonly", Infinity: "readonly", NaN: "readonly",
|
|
// FlowDeck front-end libraries
|
|
Alpine: "readonly", htmx: "readonly", Sortable: "readonly",
|
|
// Globals exposed on window by app.js
|
|
openModal: "readonly", closeModal: "readonly",
|
|
// getSvgIcon : script inline de base.html (nonce) ; Prism : CDN des vues ;
|
|
// TextDecoder : API navigateur (ES2015)
|
|
getSvgIcon: "readonly", Prism: "readonly", TextDecoder: "readonly",
|
|
};
|
|
|
|
export default [
|
|
{
|
|
ignores: ["static/js/*.min.js", "static/js/vendor/**"],
|
|
},
|
|
{
|
|
files: ["static/js/**/*.js"],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: "script",
|
|
globals: browserGlobals,
|
|
},
|
|
rules: {
|
|
"no-unused-vars": ["warn", { args: "none" }],
|
|
"no-undef": "warn",
|
|
"no-extra-semi": "warn",
|
|
"no-empty": "warn",
|
|
},
|
|
},
|
|
];
|