Repository navigation
Enhanced Graph 1.3.1
A submission fix. 1.3.0 was rejected by the plugin directory's automated review, and the
cause was in the diagnostic added while chasing a layout bug.
What the review rejected, and why it was right
Unexpected undescribed directive comment. Include descriptions to explain why the
comment is necessary.
src/view/width-probe.ts:70
src/view/width-probe.ts:190
Disabling 'no-console' is not allowed.
src/view/width-probe.ts:70
src/view/width-probe.ts:190
The width probe printed its report with console.log, silenced by
// eslint-disable-next-line no-console. Both halves were wrong:
- The rule that was actually enabled is
obsidianmd/rule-custom-message, notno-console,
so the directive silenced nothing and was reported as unused — and an unexplained
directive is itself an error. - Explaining it would not have helped.
eslint-comments/require-descriptionwants a
description andeslint-comments/no-restricted-disablerefuses to let that rule be
disabled at all, so a console call in a submitted plugin cannot be silenced. Obsidian's
guideline is that a plugin should not log what it can show instead.
What the probe does now
The report is published on window as enhancedGraphWidthProbe(), and the same report is
offered as a Notice when the event fires. Nothing is logged. Calling the function in the
developer console returns the text; scripts/obsidian-probe*.mjs in the repository read it
over the DevTools protocol, which is how the panel-width bug was actually found and fixed.
It is a better interface than the log it replaces: the name autocompletes, and calling it is
the documentation.
command.probe-official-graph also had a console.info mirroring the report it already
shows as a Notice. Removed for the same reason — the report was in two places and one of
them was against the guidelines.
So this cannot happen again
npm run verify now includes npm run lint:obsidian, which runs the reviewer's own
eslint-plugin-obsidianmd recommended set over src. It is scoped to the three rules the
review actually enforces — the console rule and the two directive rules — because the sample
plugin's configuration is stricter than the reviewer and enabling the rest would fail the
build on warnings the directory accepts.
Verified both ways: restoring the rejected console.log and its directive reproduces the
review's messages exactly, and removing it passes.
Also fixed
The --fix pass used while cleaning this up removed a type assertion in official-graph.ts
that was load-bearing; 85 tests caught it and the change was reverted rather than kept.