question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[import/no-cycle] possible false-positive with re-exported names

See original GitHub issue

Given these files:

a.js

import {b} from './internal';
export const a = 'a';

b.js

import {a} from './internal';
export const b = 'b';

internal.js

export * from './a';
export * from './b';

.eslintrc

plugins:
  - import

parserOptions:
  ecmaVersion: 2020
  sourceType: module

rules:
  import/no-cycle: [2]

I see these errors:

a.js
  1:1  error  Dependency cycle detected  import/no-cycle

b.js
  1:1  error  Dependency cycle detected  import/no-cycle

internal.js
  1:1  error  Dependency cycle detected  import/no-cycle
  2:1  error  Dependency cycle detected  import/no-cycle

This is a example of @mweststrate’s internal module pattern and if I understand correctly, there are no actual circular dependencies here. Is it a false-positive or a error in the pattern itself?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ljharbcommented, Mar 3, 2020

1reaction
silverwindcommented, Mar 3, 2020

I guess technically you’re correct. I didn’t really like that pattern anyways so I will avoid it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[import/no-cycle] possible false-positive with re-exported names
Being a cycle is not about touching the filesystem; it's about conceptually creating a situation where two files mutually depend on each other....
Read more >
How to fix/disable seemingly erroneous "No named exports ...
I believe the report is a false positive because when I run the code, everything works fine and I can indeed import the...
Read more >
eslint-plugin-import | Yarn - Package Manager
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names.
Read more >
eslint-plugin-import - NPM Package Overview - Socket.dev
Start using Socket to analyze eslint-plugin-import and its 13 ... export ( no-named-as-default ); Report use of exported name as property of ...
Read more >
node_modules/eslint-plugin-import/CHANGELOG.md · master ...
no -unused-modules : consider exported TypeScript interfaces, types and enums (#1819, thanks @nicolashenry); no-cycle : allow maxDepth option to be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found