Skip to content

fix: satisfy the obsidianmd console and settings-heading rules - #223

Merged
chhoumann merged 1 commit into
masterfrom
chore/obsidianmd-lint
Oct 24, 2026
Merged

chhoumann merged 1 commit into
masterfrom
chore/obsidianmd-lint

Conversation

@chhoumann

@chhoumann chhoumann commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

eslint-plugin-obsidianmd@0.4.2 (recommended config) reported four errors in the plugin source. This fixes them.

  • src/main.ts logged Loading MetaEdit / Unloading MetaEdit on every load. Removed.
  • ConsoleErrorLogger.logMessage wrote informational messages with console.log. It now uses console.debug, so they only show at the Verbose console level. Errors and warnings are unchanged.
  • The settings tab opened with a MetaEdit Settings heading, which trips settings-tab/no-problematic-settings-headings twice (the word "settings" and the plugin name). Obsidian's guidelines say not to add a top-level heading, so it is removed rather than renamed.

The repo mirrors obsidianmd rules with core ESLint rules in eslint.config.mjs. Two more are added so these can't come back: no-console (allowing debug, warn, error) and a no-restricted-syntax selector for problematic headings inside a PluginSettingTab. Both were checked against the old files and fire as expected.

Not in scope

Running the upstream plugin still reports sentence-case and prefer-instanceof warnings, plus 77 type-checked typescript-eslint errors (no-unsafe-*, no-base-to-string, and so on) from its bundled recommended-type-checked config. None are obsidianmd rules.

Verification

  • pnpm run lint, pnpm run build, pnpm run test (359 passed).
  • eslint-plugin-obsidianmd@0.4.2 recommended on src/**/*.ts: 0 obsidianmd errors (was 4).
  • The settings tab without the heading was checked in Obsidian as part of the settings migration PR that follows.

Release impact: none beyond the removed heading and quieter console.


Note

Low Risk
Lint and minor UX/logging tweaks only; no auth, data, or core behavior changes beyond quieter console and a removed settings heading.

Overview
Brings the plugin in line with obsidianmd console and settings-tab guidelines, and encodes those checks in the repo’s mirrored ESLint config so regressions are caught locally.

Runtime/logging: Removes load/unload console.log calls from main.ts. Routes informational logger output through console.debug instead of console.log in ConsoleErrorLogger, so routine messages only appear at Verbose console level; errors and warnings are unchanged.

Settings UI: Drops the top-level “MetaEdit Settings” heading from the settings tab, avoiding redundant “settings” / plugin-name headings per Obsidian’s settings-tab rules.

Lint guardrails: Adds no-console (allowing debug, warn, error) and no-restricted-syntax selectors for problematic PluginSettingTab headings (e.g. “settings”, “options”, or the plugin name), extending the existing obsidianmd-style rules in eslint.config.mjs.

Reviewed by Cursor Bugbot for commit 53cd4ed. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add ESLint rules for no-console and settings-tab headings in MetaEdit

Adds ESLint rules that flag console calls in production source (allowing debug, warn, and error) and settings-tab headings that include "settings", "options", or the plugin name. Updates the code to satisfy these rules:

  • Removes the top-level "MetaEdit Settings" heading from the settings tab in metaEditSettingsTab.ts
  • Switches log-level messages in ConsoleErrorLogger.logMessage from console.log to console.debug
  • Removes lifecycle console messages from MetaEdit.onload and MetaEdit.onunload in main.ts
  • Risk: behavioral changes — log-level messages now appear via console.debug (hidden by default in DevTools), and the plugin no longer logs load/unload messages to the console

Macroscope summarized 53cd4ed.

Drop the load/unload console.log calls, route the logger's informational
messages to console.debug, and remove the redundant 'MetaEdit Settings'
heading at the top of the settings tab. Encode both checks in the local
ESLint guideline rules so they cannot regress.
@chhoumann
chhoumann merged commit 69855ca into master Oct 24, 2026
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant