Skip to content

🐛 Grit plugin: Unexpected node argument with call_expression #6427

Closed

Description

@j2ghz

Environment information

CLI:
  Version:                      2.0.0
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  JS_RUNTIME_VERSION:           v22.14.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         pnpm/10.12.1

What happened?

I created this plugin:

call_expression(function=$f) where {
    $f <: r"[A-Z].*",
    register_diagnostic(
        span = $f,
        message = "Don't call React Components directly"
    )
}

To the best of my understanding of GritQL, this should find all CallExpressions (AST type), and if the name of the called function starts with an upperCase letter, register the diagnostic.

Expected result

What I get instead is Compile Error: ParsePatternError(ParseDiagnostic { span: Some(16..27), message: Unexpected node argument., advice: ParserAdvice { advice_list: [Hint("Node arguments must be patterns, optionally preceeded by a name and an equal sign.")] } }).

If I understand it correctly it complains about function=$f. I tried other variations, like just $f, 0=$f or $0, but they produce Compile Error: FunctionArgument(UnknownArgument { name: "call_expression", argument: "0", valid_args: ["0", "2", "3"] }). At this point I don't think I'm doing it wrong, and that it's a bug.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Activity

  1. added theissue type on Jun 19, 2025
  2. changed the title [-]🐛 Grit plugin: Unexpected node argument[/-] [+]🐛 Grit plugin: Unexpected node argument with call_expression[/+] on Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-Needs triageStatus: this issue needs to be triaged

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions