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

Open
andymai opened 11:39am on July 19, 2026 wants to merge 71 Ξ” into import-js/eslint-plugin-import main from
core-modules-wildcards
andymai authored
of work during July 16
Diff Delta:
71
About 44 Diff Delta/hour
Classified as:  General

andymai's Description of Work

Summary

Addresses #1281.

Re-submission of #3274, which was auto-closed when its source fork was accidentally deleted. The commits here are identical to that PR's reviewed final state (head 3510938), restored from refs/pull/3274/head β€” no code changes. #3274 was itself the post-review recreation of #3200; both prior threads are linked below so reviewers keep the full history.

Both review comments from #3200 were already addressed and carried into these commits:


  • 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.

Prior history: #3274 (auto-closed, fork deleted) Β· #3200 (review discussion)

5 total changed files
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
You’ve reached the end of the pull request
All files reviewed β€” nice work, champ! πŸ’ͺ