Skip to content

linters/eslint-rules/plugin-name-as-code

ESLint rule: plugin-name-as-code

Reports an Obsidian plugin’s display name written as plain text in a code comment, and autofixes it by wrapping the name in backticks. TSDoc renders a name in backticks as code, so a doc comment reads the same as the README.

Every comment is read: //, /* *\/ and JSDoc / TSDoc. A name already inside a code span, an inline @link tag (whose target is an identifier) or a URL is left alone. The names come from plugin-names.ts: the shared list, the project’s own manifest.json name, and the rule’s additionalPluginNames option.

Not attempted: a multi-word name broken across two comment lines, which a reader cannot tell from two unrelated words without understanding the prose.

Variable Description
MESSAGE_ID Message ID reported for a plugin name written as plain text in a comment.
PLUGIN_NAME_RULE_SCHEMA The JSON schema of the options the plugin-name rules take.
pluginNameAsCode ESLint rule requiring a plugin name in a comment to be marked as code.