Skip to content

script-utils/linters/eslint-rules/require-component-suffix

ESLint rule: require-component-suffix

Reports an error when a class that extends Component (from Obsidian, directly or transitively) does not have a name ending with Component (or ComponentBase for abstract base classes).

Classes whose inheritance chain includes any of the Obsidian framework classes that extend Component (e.g. Plugin, View, MarkdownRenderChild, Menu, HoverPopover, QueryController) are excluded because they follow Obsidian’s own naming conventions.

The rule uses the TypeScript type checker to walk the full inheritance chain, so it works regardless of how many intermediate classes sit between the user’s class and Component.

VariableDescription
MESSAGE_ID_ABSTRACT_NEEDS_BASEMessage ID reported when an abstract class extends Component but its name does not end with ComponentBase.
MESSAGE_ID_BASE_NOT_ABSTRACTMessage ID reported when a class name ends with ComponentBase but the class is not abstract.
MESSAGE_ID_MISSING_SUFFIXMessage ID reported when a class extends Component but its name does not end with Component.
requireComponentSuffix