ESLint flagged ~20 empty catch blocks and 4 loose-equality comparisons in assets/js/. Auditing each: all ~19 remaining empty catches are localStorage/sessionStorage access (persisted tab/theme/column- visibility state, recent command-palette entries) or the terminal beep's AudioContext calls — genuinely intentional best-effort UX affordances that must silently no-op if storage is disabled/full or audio is blocked, not oversights. One (a viewport-change listener callback) was a real gap: swallowing an arbitrary caller-supplied callback's exception could hide a genuine bug, so that one now logs via console.error instead. Documented the storage/audio convention once in a file-level comment rather than repeating the same explanation on ~19 near-identical one-line try/catches. All 4 flagged loose-equality comparisons turned out to be `== null`/`!= null` checks — the one loose-equality idiom that's deliberately safe (catches both null and undefined in one comparison; ESLint's own eqeqeq rule has a "smart" mode specifically for this). Converting them to strict equality would have been a behavior change (no longer catching undefined), not a fix, so switched .eslintrc.json's eqeqeq rule to "smart" instead — flags every other loose comparison as before, correctly stops flagging this one safe idiom. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lhz7pGMaoTfL5sdYS5XiKv
26 lines
574 B
JSON
26 lines
574 B
JSON
{
|
|
"env": {
|
|
"browser": true,
|
|
"es2021": true
|
|
},
|
|
"extends": "eslint:recommended",
|
|
"parserOptions": {
|
|
"ecmaVersion": 2021,
|
|
"sourceType": "script"
|
|
},
|
|
"globals": {
|
|
"lt": "readonly",
|
|
"module": "writable"
|
|
},
|
|
"rules": {
|
|
"no-undef": "off",
|
|
"no-unused-vars": "warn",
|
|
"no-empty": "warn",
|
|
"no-inner-declarations": "warn",
|
|
"no-useless-escape": "warn",
|
|
"no-regex-spaces": "warn",
|
|
"semi": ["error", "always"],
|
|
"eqeqeq": ["warn", "smart"]
|
|
}
|
|
}
|