[New] support wildcard patterns in `import/core-modules` setting #3274

Stale Open
andymai opened 7:15pm on July 16, 2026 wants to merge 71 Ξ” into import-js/eslint-plugin-import main from
core-modules-wildcards

Pull Request Overview

  • Opened on July 16, 2026
  • Status Stale Open
  • Commit count 3 with first commit July 16, 2026

Total Delta

71 Total Diff Delta

Open Days

Open 47 weekdays

Test Delta

52 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.0 days Authoring 1 commit before pull request opened for review
 
0.0 days Awaiting first review
 
46.3 days Revising work with 2 commits in response to 0 reviews that left 1 comment

Total time for pull request still awaiting merge (longer than repo's target): 46.3 business days

Author avatar

[New] support wildcard patterns in `import/core-modules` setting

Summary

Addresses https://github.com/import-js/eslint-plugin-import/issues/1281

Recreation of #3200, which became unrecoverable after I deleted the fork β€” apologies for the churn. This is the final state of that PR (post-review), rebased onto current main, with both review comments addressed:


  • Uses minimatch (already a dependency) instead of dynamic regex construction, per review feedback

  • The matching is inlined directly in isBuiltIn β€” no wrapper function, per review feedback

Changes



  • src/core/importType.js: patterns in import/core-modules containing * are matched with minimatch (exact matches still use indexOf first)

  • Tests for basic wildcards (@my-monorepo/*), multiple wildcards (@my-*/*), mixed exact + wildcard lists, and subpaths of wildcard-matched modules


  • no-extraneous-dependencies rule tests for wildcard core-modules

  • README example of wildcard usage

Test plan


  • [x] All existing tests pass

  • [x] New tests in tests/src/core/importType.js and tests/src/rules/no-extraneous-dependencies.js

Notes


  • Non-string entries in the setting are ignored (previously indexOf tolerated them; pattern.includes would have thrown), and minimatch's ! negation / # comment semantics are disabled (nonegate/nocomment) so a pattern like !@foo/* can't accidentally match everything.


  • Known limitation: eslint-module-utils' resolve still does an exact-match Set.has() on import/core-modules (utils/resolve.js), so wildcard entries are honored by importType-based rules but not by resolver-based ones like no-unresolved. Happy to extend this to eslint-module-utils in this PR or a follow-up if that's the preferred direction.

Comments Threads Pending Resolution

Resolved Comment Threads

No resolved comments have been left on this PR.