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.
- leftRibbonManager was comparing i.name === i.name (always true)
instead of i.name === pair.name when locating a ribbon item to
recolor/remove, so items sharing an icon with a different-named
command could be matched incorrectly. Now compares against pair.name.
- Replace two stray references to the global `app` with the plugin's
own `app` reference (this.plugin.app / plugin.app), consistent with
the rest of the codebase.
- Use Object.prototype.hasOwnProperty.call() instead of calling
hasOwnProperty directly on values that may not inherit from
Object.prototype.
- Import Command/PluginManifest in types.ts so the Obsidian module
augmentation resolves them instead of relying on ambient globals.
- Drop a leftover console.log of an expected/benign cancellation
error in the "Add command" menu action.
Removes eslint-disable comments left over from the pre-flat-config
setup that no longer suppress anything (mostly no-unused-vars on
unused function params, which typescript-eslint doesn't flag by
default) and adds required descriptions to the handful that are
still load-bearing. Also replaces an `as any` cast for the
text-formatting-toolbar third-party API with a locally-typed cast,
since disabling no-explicit-any isn't allowed by the obsidianmd
config. Comment/typing only, no behavior change.
- Remove unused imports (getIconIds, setIcon, exp, arrayMoveMutable, etc.)
- Add missing explicit return types on functions and arrow functions
- Add public accessibility modifier to PageHeaderManager.buttons
- Fix mixed spaces/tabs in constants.ts and commandComponent.tsx
- Wrap case block declaration in MacroBuilder.tsx to fix no-case-declarations
- Add eslint-disable comments for false-positive no-unused-vars on
function type annotation parameter names and TypeScript enum members
- Remove dead forceUpdate reference in MacroBuilder.tsx (was referencing
this in a function component)
Reduces from 64 errors + 2 warnings to 0 errors + 2 warnings (the remaining
warnings are intentional non-null assertions).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>