- no-nodejs-modules, no-global-this, and prefer-create-el only exist
to protect the shipped mobile bundle; scope them off for
eslint.config.mts, vitest.config.ts, and src/__tests__/** since none
of that runs inside Obsidian.
- Fix vitest.config.ts's __dirname the same way eslint.config.mts
already was (fileURLToPath(import.meta.url)), since __dirname isn't
defined under ESM.
- Disable no-empty-function (with a description) on the two
intentionally-empty open()/close() mock methods introduced earlier.
- Drop the now-unused `error` catch binding left over from removing
its console.log in an earlier commit.
Preact discards onClick's return value at runtime (unlike React's
synthetic events), so the dozens of existing async onClick={...}
handlers throughout this codebase have always been safe despite
technically mismatching the () => void type React-oriented tooling
expects. Rather than wrap every one in a sync closure, scope
no-misused-promises's checksVoidReturn off for JSX attributes only -
it still catches genuine misuse in forEach/addEventListener/promise
executors, which is where it already caught real issues in the
previous commit.
Fixes the remaining no-floating-promises sites the same way as the
manager files: await inside already-async handlers (confirmDelete
confirmation, settingTab's page-header toggle, commandViewer's
reorder/rename/recolor/mode-change handlers), void for genuine
fire-and-forget (confetti animation, macro command callback,
MacroViewer's save-then-continue calls, sync drag-reorder handlers).
Resolves the rest of the no-unsafe-* family by giving TypeScript
enough information instead of suppressing it:
- Extend the Obsidian module augmentation (types.ts) with
App.commands.removeCommand and Vault.getConfig so util.tsx and
main.ts no longer need @ts-ignore around them.
- Cast event.target to the concrete HTMLElement subtype at each
DOM event handler that reads .value/.checked/.offsetWidth
(ChangeableText, MacroBuilder, commandComponent) instead of
@ts-ignore/@ts-expect-error.
- Cast JSON.parse() results to their known shape (MacroBuilder's
macro clone, locales.test.ts's loadJson, main.ts's loadSettings)
instead of letting `any` flow through.
- Drop menuManager's unusual `this: (_item: MenuItem) => void`
parameter and the .call(this, ...) it required - the returned
closure never reads `this`, so this was both unnecessary and,
under this project's non-strict bind/call/apply typing, exactly
why the arguments passed through untyped. Calling the method
directly is equivalent and fully typed.
- Same root cause for MacroBuilderModal's this.close.bind(this) and
executeMacro.test.ts's .bind() - replaced with equivalent
non-bind forms.
- confirmDeleteModal/mobileModifyModal: inline the h(...) call into
render() instead of round-tripping through an intermediately
VNode-typed field, which is where preact's h() lost prop typing.
- vitest.config.ts-style import.meta.dirname swapped for
fileURLToPath(import.meta.url) in eslint.config.mts, since the
project's TS lib doesn't type import.meta.dirname.
Type-level only; no behavior change beyond what's already covered
by the two preceding commits.
The "open-commander-settings" command id predates this lint rule.
Renaming it would silently break any existing user's saved hotkey
binding for opening Commander's settings, so we keep the id and
scope the rule off for src/main.ts instead of renaming or disabling
inline (obsidianmd disallows inline-disabling this rule).
- Add explicit `(): void` return types to several useEffect cleanup
callbacks (settingTabComponent, ColorPicker, AdvancedToolbarSettings,
mobileModifyComponent).
- Widen Mode's literal union with `(string & {})` instead of a bare
string constituent, preserving autocomplete without the redundant
type warning.
- Drop an unnecessary `as ItemView` cast in pageHeaderManager now that
the preceding instanceof guard already narrows the type.
- Switch eslint.config.mts from the deprecated tseslint.config() to
eslint's own defineConfig().
Type-level only, no runtime behavior change.
Replaces the legacy .eslintrc/.eslintignore (typescript-eslint 5.x) with a
flat eslint.config.mts on typescript-eslint 8.x, preserving the existing
return-type/accessibility rules and adding the obsidianmd recommended rules.
Also bumps the minimatch override, which was pinned to an old major that's
incompatible with the new ESLint 9 toolchain.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>