Skip to content

Question: does a custom linter's visitFooNode method need to call super.visitFooNode? #1634

@asilano

Description

@asilano

We have developed a number of customer linters, all of which follow the pattern of having a visitERBContentNode (or similar) override, which performs the required check and the calls super.visitERBContentNode

e.g.

class ERBNoRemoteForLinkToVisitor extends BaseRuleVisitor {
  visitERBContentNode(node) {
    this.checkLinkToTypeConstruct(node);

    super.visitERBContentNode(node);
  }

We do this because it's the pattern established in the sample custom linter that existed in the Herb repo when we first wrote a custom linter.

However, I notice that the linter docs now have two custom linters; .herb/rules/no-inline-styles.mjs and .herb/rules/no-div-tags.mjs. no-inline-styles ends its visitor with the expected call to super.visitHTMLOpenTagNode; but no-div-tags does not call the superclass's method at any point.

Does a custom linter, inheriting from BaseRuleVisitor, need to call super.visitFooNode as part of its visitFooNode overrides?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions