Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sort-imports): empty named imports being considered side-effect imports #129

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

hampus-stravito
Copy link
Contributor

Description

I noticed a bug when writing some code in a project where I have set up this plugin (thank you by the way, it helps out a lot!). When I wrote a named import but didn't specify anything to be imported it was being considered a side-effect import and moved to the bottom of the list of imports. Turns out there is no way to distinguish a side-effect import from an empty named import from looking at the AST, so the only thing I could think of what to look for a } from string in the nodes code to make it not being considered a side-effect import 🙂

Additional context

Output from AST explorer

ast explorer output

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.
  • Read contribution guidelines.

@azat-io azat-io merged commit ca69069 into azat-io:main Apr 15, 2024
5 checks passed
@azat-io
Copy link
Owner

azat-io commented Apr 24, 2024

Released in v2.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants