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

New rule: Report unused import expressions #1414

Open
FloEdelmann opened this issue Jan 25, 2023 · 1 comment
Open

New rule: Report unused import expressions #1414

FloEdelmann opened this issue Jan 25, 2023 · 1 comment
Labels
help wanted Extra attention is needed new rule

Comments

@FloEdelmann
Copy link
Contributor

FloEdelmann commented Jan 25, 2023

I'd like to suggest a rule that reports # import expressions that are not used in the current file:

Fail

# import Foo from 'someOtherFile.graphql'
#        ^^^ Fragment 'Foo' not used in this file, import expression can be removed.

query MyQuery {
  bar
}
# import 'someOtherFile.graphql'

query MyQuery {
  fooField
}

Pass

# import Foo from 'someOtherFile.graphql'

query MyQuery {
  fooField {
    ...Foo
  }
}
# import 'someOtherFile.graphql' # assuming it defines a `Foo` fragment

query MyQuery {
  fooField {
    ...Foo
  }
}
@FloEdelmann FloEdelmann changed the title New rule: Report unused import comment New rule: Report unused import expressions Jan 25, 2023
@dimaMachina
Copy link
Collaborator

Accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed new rule
Development

No branches or pull requests

2 participants