Skip to content

Conversation

JounQin
Copy link
Member

@JounQin JounQin commented May 26, 2025

Avoid Cannot redefine plugin "import-x" error


Important

Fixes plugin redefinition error by ensuring a single reference for default export and updates import syntax in README.

  • Behavior:
    • Fixes Cannot redefine plugin "import-x" error by ensuring a single plugin reference for default export in src/index.ts.
    • Updates import syntax in README.md to use { importX } instead of * as importX.
  • Refactor:
    • Combines plugin object with flatConfigs using Object.assign() in src/index.ts.
  • Chores:
    • Adds .changeset/nasty-dolls-check.md to document the patch update.

This description was created by Ellipsis for 8925d8b. You can customize this summary. It will automatically update as commits are pushed.


Summary by CodeRabbit

  • Refactor
    • Enhanced plugin export structure for improved compatibility and ease of use.
  • Chores
    • Added documentation for a patch update related to plugin export handling. No impact on functionality.
  • Documentation
    • Updated import examples in the README for clearer usage of the plugin.

@JounQin JounQin requested review from 43081j and Copilot May 26, 2025 05:28
@JounQin JounQin self-assigned this May 26, 2025
@JounQin JounQin added the bug Something isn't working label May 26, 2025
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (a55dcc7) 3623 3470 95.78%
Head commit (7edc5e1) 3623 (+0) 3470 (+0) 95.78% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#344) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Copy link

changeset-bot bot commented May 26, 2025

🦋 Changeset detected

Latest commit: 8925d8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-import-x Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

coderabbitai bot commented May 26, 2025

Walkthrough

The changes introduce a new changeset file documenting a patch update for the eslint-plugin-import-x package and refactor the default export structure in the main source file. The export logic now consolidates properties using a plugin object and Object.assign for improved maintainability. Additionally, the README was updated to use named imports for importX instead of namespace imports.

Changes

File(s) Change Summary
.changeset/nasty-dolls-check.md Added a changeset file documenting a patch fix for the plugin's default export reference.
src/index.ts Added configs property to plugin; changed default export to Object.assign(plugin, { flatConfigs }); added named export importX.
README.md Changed import style for importX from namespace import to named import in code examples.

Sequence Diagram(s)

sequenceDiagram
    participant Importer as Importer
    participant Plugin as plugin object
    participant FlatConfigs as flatConfigs

    Importer->>src/index.ts: import default
    src/index.ts->>Plugin: create plugin object with meta, configs, rules, etc.
    src/index.ts->>FlatConfigs: reference flatConfigs
    src/index.ts->>Importer: return Object.assign(plugin, { flatConfigs })
Loading

Suggested labels

internal

Suggested reviewers

  • SukkaW

Poem

In the warren where code lines hop,
A plugin’s export got a swap!
With Object.assign, they now unite,
FlatConfigs joins the plugin’s might.
A patch was logged, the docs are neat—
The carrots of structure taste so sweet!
🥕✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/index.ts

Oops! Something went wrong! :(

ESLint: 9.27.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/lib/index.js' imported from /eslint.config.js
at finalizeResolution (node:internal/modules/esm/resolve:274:11)
at moduleResolve (node:internal/modules/esm/resolve:859:10)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:163:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad168d9 and 8925d8b.

📒 Files selected for processing (3)
  • .changeset/nasty-dolls-check.md (1 hunks)
  • README.md (2 hunks)
  • src/index.ts (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/nasty-dolls-check.md
  • src/index.ts
⏰ Context from checks skipped due to timeout of 90000ms (190)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on macos-latest
  • GitHub Check: publish
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 9 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 24 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Walkthrough

This pull request modifies the export structure of the plugin to share the same plugin reference for default export. This change is intended to avoid the error Cannot redefine plugin "import-x". The code now uses Object.assign to merge flatConfigs into the plugin object before exporting it.

Changes

File Summary
src/index.ts Added configs, cjsRequire, importXResolverCompat, and createNodeResolver to the plugin object. Replaced the default export with Object.assign(plugin, { flatConfigs }).

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the default export to reuse a single plugin object reference—preventing repeated plugin definitions that cause the Cannot redefine plugin "import-x" error.

  • Added configs, cjsRequire, importXResolverCompat, and createNodeResolver into the base plugin object
  • Changed the default export to Object.assign(plugin, { flatConfigs }) so it merges flatConfigs into that same plugin reference

Copy link

codesandbox-ci bot commented May 26, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

pkg-pr-new bot commented May 26, 2025

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-import-x@344

commit: 8925d8b

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 7edc5e1 in 53 seconds. Click for details.
  • Reviewed 33 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/index.ts:151
  • Draft comment:
    Including 'configs', 'cjsRequire', 'importXResolverCompat', and 'createNodeResolver' within the plugin object creates a consistent shared reference. This helps avoid plugin redefinition errors.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply states a positive aspect of the code without prompting any further action or consideration from the PR author.
2. src/index.ts:186
  • Draft comment:
    Using Object.assign(plugin, { flatConfigs }) for the default export ensures the same plugin reference is used. Note that this mutates the plugin object—if immutability is a concern, consider alternatives.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_l9kKsxQDtPn8cNxz

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

codacy-production bot commented May 26, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (a55dcc7) 3623 3470 95.78%
Head commit (8925d8b) 3623 (+0) 3470 (+0) 95.78% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#344) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Copy link

codecov bot commented May 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.25%. Comparing base (a55dcc7) to head (8925d8b).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #344   +/-   ##
=======================================
  Coverage   96.25%   96.25%           
=======================================
  Files          92       92           
  Lines        4833     4833           
  Branches     1823     1822    -1     
=======================================
  Hits         4652     4652           
  Misses        180      180           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed 8925d8b in 1 minute and 36 seconds. Click for details.
  • Reviewed 74 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/nasty-dolls-check.md:1
  • Draft comment:
    The changeset note clearly states the patch and fix. Consider adding a brief rationale if needed.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. README.md:101
  • Draft comment:
    Updated import example uses named export ({ importX }) which aligns with the new plugin export pattern.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. src/index.ts:151
  • Draft comment:
    Merging additional properties into the shared plugin object and exporting it via Object.assign ensures a single plugin reference, avoiding redefinition errors.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_rp3xHhHlCHkOV5BG

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@JounQin JounQin merged commit 2c007d0 into master May 26, 2025
88 checks passed
@JounQin JounQin deleted the fix/reference branch May 26, 2025 06:01
@@ -114,7 +114,7 @@ npm install eslint-import-resolver-typescript --save-dev

```js
import js from '@eslint/js'
import * as importX from 'eslint-plugin-import-x'
import { importX } from 'eslint-plugin-import-x'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this now work with the default import too?

i.e. import importX from 'eslint-plugin-import-x'

Copy link
Member Author

@JounQin JounQin May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no: #285, and also no-named-as-default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants