Open antfu opened 11 months ago
Got a PoC working, https://github.com/antfu/eslint-plugin-unimport, still a lot polishing to do to make it usable tho.
https://github.com/unjs/unimport/assets/11247099/4003d8f6-d8fe-49a1-a115-7afdf3b656b4
Any update on this one?
Describe the feature
One downside of auto-import is that some people would be concerned about the implicitness and uncertainty of where a function has been imported.
Wonder if we can come up with an optional eslint plugin that automatically inserts the import statement into the file.
Unlike the IDE auto-insertion that often injects the wrong path, and only available when you are typing that entry or explicitly clicking on the entry. Unimport maintains a list of imports with unique names, so that you always get the correct path. Meanwhile, with an ESLint Plugin, you can run it with a CLI and even filter the files you want it to enable. Combined with rules like https://www.npmjs.com/package/eslint-plugin-unused-imports, you can get autofix when you add or remove functions. Make the import statements almost fully automated.
Additional information