javascript: Configuration for rule "import/no-cycle" is invalid

Oops! Something went wrong! 😦

ESLint: 7.0.0

Error: .eslintrc » eslint-config-airbnb » /node_modules/eslint-config-airbnb-base/index.js » /node_modules/eslint-config-airbnb-base/rules/imports.js: Configuration for rule “import/no-cycle” is invalid: Value “∞” should be integer.

My package json devDependency.

    "@babel/core": "7.9.6",
    "@babel/runtime": "7.9.6",
    "@react-native-community/eslint-config": "0.0.5",
    "@testing-library/jest-native": "3.1.0",
    "@testing-library/react-native": "5.0.3",
    "babel-eslint": "10.1.0",
    "babel-jest": "24.8.0",
    "babel-plugin-inline-import": "3.0.0",
    "eslint": "7.0.0",
    "eslint-config-airbnb": "18.1.0",
    "eslint-config-prettier": "6.10.0",
    "eslint-import-resolver-react-native": "0.2.0",
    "eslint-plugin-import": "2.20.1",
    "eslint-plugin-jsx-a11y": "6.2.3",
    "eslint-plugin-prettier": "3.1.2",
    "eslint-plugin-react": "7.19.0",

This has started occurring from today only. It was working last week.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 37
  • Comments: 23

Commits related to this issue

Most upvoted comments

eslint-config-airbnb-base has a

  "peerDependencies": {
    "eslint": "^5.16.0 || ^6.8.0 || ^7.2.0",
    "eslint-plugin-import": "^2.22.1"

so update your eslint-plugin-import to ^2.22.1 version, which supports “∞” symbol.

It works for me.

I have the same issue.

Replacing with Infinity works like version 14.2.0

When comparing version 14.2.1 with 14.2.0

-   'import/no-cycle': ['error', { maxDepth: Infinity }],
+   'import/no-cycle': ['error', { maxDepth: '∞' }],

I also still have this problem with “eslint-plugin-import” updated to “2.22.1”.

Try to remove node_modules and install it from scratch. Also run npm ls, to check your peer dep versions.

I had the same problems, even after checking peer dependencies and updating accordingly. After tearing my hair for an hour, deleting node_modules and installing again, checking the actual code in the node_modules and adding debugging, I decided to restart VS Code. And the error message was gone. Lesson learned… I hope this can help at least someone else.

Run npm ls - if your peer dep versions are wrong, your dep graph is invalid, and nothing can be expected to work. Specifically, ensure your eslint plugins are updated (and nothing in your package.json should lack a ^, pinning is achieved with a lockfile, not with package.json)

I also still have this problem with “eslint-plugin-import” updated to “2.22.1”.

I have this problem too, but I have “eslint-plugin-import” updated to “2.22.1”.

I have updated eslint-plugin-import to version 2.22.1. Then removed node_modules - rm -rf ./node_modules Then installed them - npm i It worked for me. Thank you!

I had the same issue, but was only seeing the error in Netlify’s pipeline build, not locally. It turns out that react scripts 3.4.1 uses the problematic version of eslint-plugin-import.

In order to fix this issue, I had to upgrade major versions, to react-scripts version 4 (along with major version upgrades to several other packages, including jest and eslint), to accommodate the major version bump. Hope that helps somebody!

I have just encountered this issue today as well. I have eslint-plugin-import updated to 2.22.1 as well. Here’s my package.json file:

  "name": "test",
  "version": "1.0.0",
  "main": "js/index.jsx",
  "license": "MIT",
  "scripts": {
    "watch": "npm run development -- --watch",
    "build": "npm run production",
    "development": "NODE_ENV=development webpack",
    "production": "NODE_ENV=production webpack",
    "lint": "eslint js/src/ --ext .js --ext .jsx"
  "dependencies": {
    "react": "^17.0.1",
    "react-dom": "^17.0.1"
  "devDependencies": {
    "@babel/core": "^7.12.16",
    "@babel/preset-env": "^7.12.16",
    "@babel/preset-react": "^7.12.13",
    "babel-loader": "^8.2.2",
    "eslint": "^7.2.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-plugin-react": "^7.21.5",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-react-hooks": "^4",
    "webpack": "^5.21.2",
    "webpack-cli": "^4.5.0"

Here’s my .eslintrc.json file:

  "env": {
    "browser": true,
    "es2021": true
  "extends": [
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    "ecmaVersion": 12,
    "sourceType": "module"
  "plugins": [
  "rules": {

I should also note that I arrived at this non-functional configuration by running yarn run eslint --init and making the following selections:

✔ How would you like to use ESLint? · style
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · react
✔ Does your project use TypeScript? · No / Yes
✔ Where does your code run? · browser
✔ How would you like to define a style for your project? · guide
✔ Which style guide do you want to follow? · airbnb
✔ What format do you want your config file to be in? · JSON

When eslint prompted me about whether I wanted to install the peer dependencies required by my configuration via npm, I selected “no” (because my project uses yarn to manage dependencies) and installed them myself as dev dependencies with yarn. yarn run eslint --version gives me v7.20.0 in case that’s helpful.

Thanks, @ljharb, for that background, and my apologies to the eslint-config-airbnb-base people for falsely blaming them.

I send no compliments to the people who made a breaking change in a minor release of ESLint 😃