Running my lint script "lint": "eslint --ext .js ."
, gives me this error:
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.
Package.json:
"devDependencies": {
"@babel/core": "7.9.0",
"@babel/runtime": "7.9.2",
"@babel/parser": "7.11.5",
"@react-native-community/eslint-config": "1.0.0",
"babel-eslint": "10.1.0",
"babel-jest": "25.2.3",
"babel-plugin-module-resolver": "4.0.0",
"babel-preset-react-native": "4.0.1",
"bluebird": "3.7.2",
"catharsis": "0.8.11",
"cross-env": "7.0.2",
"escape-string-regexp": "2.0.0",
"eslint": "6.8.0",
"eslint-config-airbnb": "18.1.0",
"eslint-config-react-native": "4.0.0",
"eslint-plugin-import": "2.20.1",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-react": "7.19.0",
"eslint-plugin-react-hooks": "3.0.0",
"eslint-plugin-react-native": "3.8.1",
"husky": "4.2.3",
"jest": "25.2.3",
"jest-fetch-mock": "3.0.3",
"jest-junit": "10.0.0",
"jest-transform-stub": "2.0.0",
"js2xmlparser": "4.0.1",
"jsdoc": "3.6.6",
"klaw": "3.0.0",
"markdown-it": "10.0.0",
"markdown-it-anchor": "5.2.7",
"marked": "0.8.2",
"metro-react-native-babel-preset": "0.59.0",
"mkdirp": "1.0.4",
"node": "12.10.0",
"npm-check": "5.9.2",
"react-test-renderer": "16.13.1",
"redux-mock-store": "1.5.4",
"requizzle": "0.2.3",
"strip-json-comments": "3.1.0",
"taffydb": "2.6.2",
"underscore": "1.10.2"
},
Ensures that there is no resolvable path back to this module via its dependencies. This includes cycles of depth 1 (imported module imports me) to "∞" (or Infinity ), if the maxDepth option is not set.
If you want to disable an ESLint rule in a file or on a specific line, you can add a comment. On a single line: const message = 'foo'; console. log(message); // eslint-disable-line no-console // eslint-disable-next-line no-console console.
To turn off ESLint in the whole file, you can add /* eslint-disable */ in the first line of that file. Alternatively, you can create a file . eslintignore in the root catalog.
ESLint comes with a large number of built-in rules and you can add more rules through plugins. You can modify which rules your project uses either using configuration comments or configuration files. To change a rule setting, you must set the rule ID equal to one of these values: "off" or 0 - turn the rule off.
According to this thread https://github.com/airbnb/javascript/issues/2331#issuecomment-724114465
you need to update eslint-plugin-import
to ^2.22.1
which supports ∞
value.
sharing here what i found that resolved this issue. all the peer dependencies were installed and correct version, however this error was still showing up.
I changed the node_modules/eslint-config-airbnb-base/rules/imports.js
"∞" to an integer to continue debugging. Next run showed this error, ESLint couldn't determine the plugin "import" uniquely.
, which was the underlying problem. it turns out that eslint loads all configs from ancestor directories as described here, https://github.com/eslint/eslint/issues/13385#issuecomment-641252879.
I added "root":true
to the .eslint config file and converted the update to the node_modules/eslint-config-airbnb-base/rules/imports.js
. it now runs. hope it helps others.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With