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.

Invalid config for react/jsx-uses-react?

See original GitHub issue

I’m using atom, with the nuclide plugin and sometimes, the linter doesn’t work.

Here’s the error I see in the console:

/Users/tommy.leunen/.atom/packages/nuclide/pkg/nuclide-diagnostics-store/lib/LinterAdapter.js:20 Uncaught (in promise) Error: /Users/tommy.leunen/dev/project/node_modules/eslint-config-airbnb/rules/react.js:
    Configuration for rule "react/jsx-uses-react" is invalid:
    Value "[object Object]" has more items than allowed.

Referenced from: airbnb
Referenced from: /Users/tommy.leunen/dev/project/.eslintrc
    at validateRuleOptions (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-validator.js:116:15)
    at /Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-validator.js:163:13
    at Array.forEach (native)
    at Object.validate (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-validator.js:162:35)
    at load (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-file.js:523:19)
    at /Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-file.js:392:36
    at Array.reduceRight (native)
    at applyExtends (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-file.js:363:28)
    at load (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-file.js:530:22)
    at /Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-file.js:392:36
    at Array.reduceRight (native)
    at applyExtends (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-file.js:363:28)
    at Object.load (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/config/config-file.js:530:22)
    at loadConfig (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/config.js:64:33)
    at new Config (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/config.js:233:38)
    at CLIEngine.executeOnText (/Users/tommy.leunen/dev/project/node_modules/eslint/lib/cli-engine.js:748:28)

I don’t override the jsx-uses-react rule. eslint-config-airbnb@9.0.1 eslint-plugin-react@5.2.2

It looks like this happen when linting a file that doesn’t have any JSX.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
ljharbcommented, Aug 12, 2016

The usual cause of this error is that your editor is using the global eslint instead of the local one - although the stack trace doesn’t seem to indicate that.

You may want to update to the latest eslint, eslint-config-airbnb, and eslint-plugin-react, but I’m not sure why your error is happening.

1reaction
alextrasterocommented, Mar 24, 2017

@ljharb happened to me with atom

    "eslint": "^2.5.3",
    "eslint-config-airbnb": "^6.1.0",
    "eslint-plugin-import": "^2.0.1",
    "eslint-plugin-jsx-a11y": "^2.2.3",
    "eslint-plugin-react": "^4.2.3",

removing the “global eslint instead of the local one” solved this for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error keeps popping up: Configuration for rule "react/jsx-uses ...
I have tried a reinstall of eslint, eslint-plugin-import, eslint-config-airbnb, eslint-plugin-react, but no results. any ideas? error: Error: C ...
Read more >
12 essential ESLint rules for React - LogRocket Blog
Introduction. ESLint has a comprehensive set of rules for JavaScript code that cover stylistic choices and prevent common bugs. Using ESLint ...
Read more >
Invalid Hook Call Warning - React
There are three common reasons you might be seeing it: You might have mismatching versions of React and React DOM. You might be...
Read more >
eslint-plugin-react | Yarn - Package Manager
owner jsx-eslint63.1mMIT7.31.11TS vulns 0 vulnerabilities. React specific linting rules for ESLint ... npm install eslint eslint-plugin-react --save-dev.
Read more >
Eslint-plugin-react NPM
If you are using the new JSX transform from React 17, extend react/jsx-runtime in your eslint config (add "plugin:react/jsx-runtime" to "extends" ) to ......
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