eslint-plugin-import: [import/no-cycle] Doesn't detect aliased imports

Issue

eslint-plugin-import has an issue with aliased imports not being detected by the rule import/no-cycle.

This following example shows an import with a circular dependency that goes undetected when you change the import from a relative path, ../directory/file, to an aliased import, directoryAlias/file.

Reproducing the issue

/* main.js */

// import unused from '../exports/exporter'; // <-- Throws a no-cycle error when uncommented

import unused from 'exports/exporter'; // <-- Will not throw a no-cycle error, but it should!

export default function () {
  return;
}

Example project

To reproduce: https://github.com/christophermark/eslint-no-cycle-aliases-issue

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 7
  • Comments: 18 (9 by maintainers)

Most upvoted comments

I’ve got a fix ready, and running eslint on the command line verifies that. Now I’m working on adding an “invalid” test for this.