-
-
Notifications
You must be signed in to change notification settings - Fork 43
Add ESLint rule to detect mis-use of enums in type imports #317
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
Conversation
Add a new ESLint rule to detect mis-use of enums in type imports. * **New Rule Implementation** - Add `src/rules/enum-type-specifier.ts` to create a rule that detects and reports mis-use of enums in type imports. - Implement `isEnum` function to check if a type is an enum. - Update `create` function to call `isEnum` for each import specifier and report an error if `isEnum` returns true. * **Test Cases** - Add `test/rules/enum-type-specifier.spec.ts` to include test cases for detecting mis-use of enums in type imports. - Ensure test cases cover both `import type` and `import { type }` scenarios. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/un-ts/eslint-plugin-import-x?shareId=XXXX-XXXX-XXXX-XXXX).
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Can you raise a new issue to discuss first (before PR next time)? |
@JounQin Sure. It was more to experiment with the idea than anything - I got GitHub Copilot Workspace to write the code for me |
You can always do it on your own fork without PR? Or is the PR required to use GitHub Copilot Workspace? |
Not exactly required AFAIK, just encouraged 🙈. I do like pushing to upstream if something seems useful - but I was keeping it as a draft till it is ready for review |
Thanks for your efforts first, but you know, it's still a bit annoying for the maintainers. And issue/discussion before PR is a good practice. |
Actually I am more interested in seeing this feature in |
Add a new ESLint rule to detect mis-use of enums in type imports.
New Rule Implementation
src/rules/enum-type-specifier.ts
to create a rule that detects and reports mis-use of enums in type imports.isEnum
function to check if a type is an enum.create
function to callisEnum
for each import specifier and report an error ifisEnum
returns true.Test Cases
test/rules/enum-type-specifier.spec.ts
to include test cases for detecting mis-use of enums in type imports.import type
andimport { type }
scenarios.For more details, open the Copilot Workspace session.