diff --git a/eslint.config.mjs b/eslint.config.mjs index 10beee2..f6ad5c7 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -15,7 +15,7 @@ const sharedGlobals = { }; // Obsidian developer-policy / guideline checks, expressed with core rules so we -// don't pull in eslint-plugin-obsidianmd's dependency tree for seven rules. Each +// don't pull in eslint-plugin-obsidianmd's dependency tree for nine rules. Each // entry mirrors the obsidianmd rule named in its message. Keep this scoped to // production plugin source: tests and harness code legitimately stub Obsidian // globals and should not inherit plugin-review restrictions. @@ -23,6 +23,7 @@ const sharedGlobals = { // `typeof globalThis` guards; none exist in the plugin source. const timerFunctions = ["setTimeout", "setInterval", "clearTimeout", "clearInterval", "requestAnimationFrame"]; const obsidianGuidelineRules = { + "no-console": ["error", { allow: ["debug", "warn", "error"] }], "no-restricted-globals": [ "error", ...timerFunctions.map((name) => ({ @@ -61,6 +62,13 @@ const obsidianGuidelineRules = { selector: "ClassDeclaration[superClass.name='PluginSettingTab'] CallExpression[callee.property.name='createEl'][arguments.0.value=/^h[1-6]$/]", message: "Use new Setting(containerEl).setName(...).setHeading() instead of HTML headings (obsidianmd/settings-tab/no-manual-html-headings).", }, + ...[ + "CallExpression[callee.property.name='setHeading'] > MemberExpression > CallExpression[callee.property.name='setName']", + "CallExpression[callee.property.name='setName'][callee.object.callee.property.name='setHeading']", + ].map((call) => ({ + selector: `ClassDeclaration[superClass.name='PluginSettingTab'] ${call} > Literal.arguments[value=/settings|options|${pluginNamePattern}/i]`, + message: "Don't put 'settings', 'options', or the plugin name in settings headings (obsidianmd/settings-tab/no-problematic-settings-headings).", + })), { selector: `CallExpression[callee.property.name='addCommand'] > ObjectExpression > Property[key.name='name'] > Literal.value[value=/${pluginNamePattern}/i]`, message: "Obsidian already prefixes command names with the plugin name (obsidianmd/commands/no-plugin-name-in-command-name).", diff --git a/src/Settings/metaEditSettingsTab.ts b/src/Settings/metaEditSettingsTab.ts index bfe7760..d7c507f 100644 --- a/src/Settings/metaEditSettingsTab.ts +++ b/src/Settings/metaEditSettingsTab.ts @@ -33,10 +33,6 @@ export class MetaEditSettingsTab extends PluginSettingTab { this.destroySvelteElements(); containerEl.empty(); - new Setting(containerEl) - .setName("MetaEdit Settings") - .setHeading(); - this.addProgressPropertiesSetting(containerEl); this.addAutoPropertiesSetting(containerEl); this.addEditMetaMenuSetting(containerEl); diff --git a/src/logger/consoleErrorLogger.ts b/src/logger/consoleErrorLogger.ts index 8174380..e81be48 100644 --- a/src/logger/consoleErrorLogger.ts +++ b/src/logger/consoleErrorLogger.ts @@ -23,7 +23,7 @@ export class ConsoleErrorLogger extends MetaEditLogger { const log = this.getMetaEditError(logMsg, ErrorLevel.Log); this.addMessageToErrorLog(log); - console.log(this.formatOutputString(log)); + console.debug(this.formatOutputString(log)); } private addMessageToErrorLog(error: MetaEditError): void { diff --git a/src/main.ts b/src/main.ts index aa9efbe..1325f9f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -34,8 +34,6 @@ export default class MetaEdit extends Plugin { private readonly settingsWriter = new SettingsWriter(() => this.saveData(this.settings)); async onload() { - console.log('Loading MetaEdit'); - this.controller = new MetaController(this.app, this); this.bulkEditor = new BulkMetadataEditor(this.app, this); @@ -100,7 +98,6 @@ export default class MetaEdit extends Plugin { } onunload() { - console.log('Unloading MetaEdit'); this.linkMenu.unregisterEvent(); }