-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Refactoring suggestions #72
Comments
This sounds very interesting. Any idea how can we locate those in a robust way what won't create incorrect results? |
ESlint has a feature for this: https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions Finding duplicate code, however, is an np-complete problem, that's not trivial to implement even with a low guarantee. |
Some of them already implemented in GraphQL Altair: altair-graphql/altair#745 (comment). |
One other thing to keep in mind: ESLint operates on one file at a time, so if you have duplicate code across multiple files, ESLint will not be able to handle that, it will only be able to make a suggestion if it sees duplicate code in the same file. |
|
Idea: find similar things and suggest refactorings. Is it possible?
E.g. find similar types and suggest to extract them into interface, find similar sets of fields in operations and suggest to extract them into fragments, find similar input values and suggest to extract them into variables.
Or vice versa: find fragments and variables that used only in one place and suggest to inline them.
The text was updated successfully, but these errors were encountered: