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

ESLint Plugin? #305

Open
1 task done
antfu opened this issue Dec 8, 2023 · 1 comment
Open
1 task done

ESLint Plugin? #305

antfu opened this issue Dec 8, 2023 · 1 comment
Labels
discussion enhancement New feature or request

Comments

@antfu
Copy link
Member

antfu commented Dec 8, 2023

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

  • Would you be willing to help implement this feature?
@antfu antfu added enhancement New feature or request discussion labels Dec 8, 2023
@antfu
Copy link
Member Author

antfu commented Dec 9, 2023

Got a PoC working, https://github.com/antfu/eslint-plugin-unimport, still a lot polishing to do to make it usable tho.

Screen.Recording.2023-12-08.at.13.18.16.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant