`import/no-cycle` not throwing errors
See original GitHub issueI’m trying to add this plugin only for the import/no-cycle rule and running into problems configuring it.
Versions:
| package | version |
|---|---|
| eslint | 8.18.0 |
| eslint-plugin-import | 2.26.0 |
| eslint-config-prettier | 8.5.0 |
| eslint-plugin-prettier | 4.1.0 |
| eslint-plugin-react | 7.30.1 |
src/utils/index.ts:
import * as consts from '../consts';
export * from './oneUtilsFile';
export * from './anotherUtilsFile';
...
src/consts/index.ts:
import * as utils from '../utils';
export * from './oneConstsFile';
export * from './anotherConstsFile';
...
My .eslintrc.js (abbreviated):
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
},
extends: ['eslint:recommended', 'plugin:react/recommended', 'prettier'],
plugins: ['prettier', 'test-selectors', 'import'],
rules: {
'no-console': 'error',
'import/no-cycle': 'error'
},
}
Running eslint throws no errors with this config.
I’ve also tried adding each of the canned rule sets to extends, and being more explicit with the import/no-cycle rule: 'import/no-cycle': ['error', { ignoreExternal: true }]. None of these trigger errors with the no-cycle rule.
Am I using the rule incorrectly? Or doing something else wrong? Thanks!
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
import/no-cycle constantly throws false positives when a file ...
It seems this rule only checks the list of imports rather than checking what is actually imported and whether it has a cycle...
Read more >Eslint error, configuration for rule "import/no-cycle" is invalid
I changed the node_modules/eslint-config-airbnb-base/rules/imports. js "∞" to an integer to continue debugging. Next run showed this error, ...
Read more >Understanding import/no-cycle problem in eslint
I have a some code in which eslint thrown an error of the type: import/no-cycle , but I don't understand where this cyclic...
Read more >throw - JavaScript - MDN Web Docs - Mozilla
The throw statement throws a user-defined exception. ... If no catch block exists among caller functions, the program will terminate.
Read more >8. Errors and Exceptions — Python 3.11.1 documentation
If an exception occurs which does not match the exception named in the except clause, it is passed on to outer try statements;...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ljharb I eventually added
'plugin:import/typescript'to theextendslist in my config file and that solved the problem. I’d thought that having theparserandparserOptionsI do, that wouldn’t be necessary, but it seems it is.If that’s expected, I’ll close this issue.
@ebbishop on rereading this, i think this is working as intended - you definitely must extend
import/typescript(or the equivalent) to have this plugin work properly with TS.