-
Notifications
You must be signed in to change notification settings - Fork 13
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
[FEAT] Add option to delete stale files #232
Comments
Thank you for the suggestion! I think there are a few cases we'd have to consider so we don't do destructive actions too aggressively:
|
Good questions. Not sure if my suggestion is worth the potential hassle (especially considering the minor benefit).
I’d expect an incremental migration path to first have both resolvers in the schema, and then only the newer. Once a field gets removed from the schema, I think it can realistically be considered as having been migrated. There is always the git history to retrieve old logic.
Good question. The more I think of it, the more I’m hesitant about the above suggestion. Even if opt-in via a configuration option, this will introduce a convention in the codebase where files might get deleted unexpectedly. One approach could be to prepend a comment to the generated files, and only auto-delete files that start with that comment. |
All great thoughts here @lensbart! It seems like the emerging theme is "somehow detect and track a file generated by this preset". This way, it has a few benefits:
This is also a breaking change to existing codebases so we need a migration path e.g.
Also, this is not the only option, just another one to add to your great suggestions above 🙂 So I'm keen to have more ideas before picking one |
I also think there's a place for a warning/linting style approach? i.e. produce a report of potentially no longer required/unused resolvers. detect resolvers that don't match a schema definition. |
Is your feature request related to a problem? Please describe.
When you’re making a larger change, sometimes many files can be renamed or deleted and created at once. In such a situation, it could be helpful if this plugin would delete all files it doesn’t recognise in the output folders (that is, all files excluding
.graphql
files, mapper files, and files that would be generated if missing).Describe the solution you'd like
This should probably not be the default behaviour, as it is a destructive action that will require the developer to keep unrelated files (for e.g. helper functions) out of the resolvers folders. So I’m thinking of a configuration option
Describe alternatives you've considered
import/no-unused-modules
plugin. This might be a good and sufficient approach, but requires a bit more work to set up, makes assumptions about the tooling (some project might be using Biome or might not be using this plugin, not sure what the performance implications are)Additional context
Not an urgent request, just a friendly suggestion 😊 Thanks
The text was updated successfully, but these errors were encountered: