Member Junction
    Preparing search index...

    Base class for all component linter rules.

    Rules extend this class and decorate with @RegisterClass(BaseLintRule, 'rule-name') to be automatically discovered by the linter via MJGlobal's ClassFactory.

    External packages (e.g., Skip-Brain) can define custom rules by extending this class and registering them — the linter will discover them at runtime through the manifest system.

    import { BaseLintRule } from '@memberjunction/react-linter';
    import { RegisterClass } from '@memberjunction/global';

    @RegisterClass(BaseLintRule, 'my-custom-rule')
    export class MyCustomRule extends BaseLintRule {
    Name = 'my-custom-rule';
    AppliesTo = 'all' as const;

    Test(ast, componentName) {
    const violations = [];
    // ... your validation logic
    return violations;
    }
    }
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    • get AppliesTo(): "all" | "child" | "root"

      Scope where this rule applies:

      • 'all': Applies to all components (root and child)
      • 'child': Only applies to child components
      • 'root': Only applies to root components

      Returns "all" | "child" | "root"

    • get Name(): string

      Unique name of the rule (e.g., 'no-import-statements'). Must match the key used in @RegisterClass(BaseLintRule, 'rule-name').

      Returns string

    Methods

    • Test function that analyzes the AST and returns violations.

      Parameters

      • ast: File

        The parsed Babel AST of the component code

      • componentName: string

        Name of the component being linted

      • OptionalcomponentSpec: ComponentSpec

        Optional component specification with metadata

      • Optionaloptions: LinterOptions

        Optional execution options for the component

      • OptionaltypeContext: TypeContext

        Optional shared type context with inferred variable types, entity/query field metadata, and callback parameter types

      Returns Violation[]

      Array of violations found by this rule