Skip to content

[bug] Inconsistent import ... from ... matching in JS/TS #1848

@alexgorbatchev

Description

@alexgorbatchev

Please read the FAQ for the bug you encountered.

  • I have read the existing FAQ

⏯ Playground Link

https://ast-grep.github.io/playground.html#eyJtb2RlIjoiUGF0Y2giLCJsYW5nIjoidHlwZXNjcmlwdCIsInF1ZXJ5IjoiaW1wb3J0IHsgRm9vIH0gZnJvbSBcImJhclwiIiwicmV3cml0ZSI6IiIsInN0cmljdG5lc3MiOiJyZWxheGVkIiwic2VsZWN0b3IiOiIiLCJjb25maWciOiIiLCJzb3VyY2UiOiJpbXBvcnQgeyBGb28sIEJhciwgQmF6IH0gZnJvbSAnYmFyJ1xuIn0=

💻 Code

No response

🙁 Actual behavior

Source Pattern Match
import { Foo, Bar } from 'bar' import { Foo } from 'bar' YES
import { Foo, Bar, Baz } from 'bar' import { Foo } from 'bar' NO
import { Bar, Foo } from 'bar' import { Foo } from 'bar' NO

🙂 Expected behavior

I would expect either a match in all 3 cases or no match in all 3 cases.

Additional information about the issue

Basically I'm trying to figure out how to use ast-grep to match import statements and can't get this to work. This is happening in relaxed mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions