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.

Error while configuring react/jsx-props-no-spreading

See original GitHub issue

While setting up my eslint rules, I ran into some issues when configuring jsx-props-no-spreading

Expected: Allow props spreading when the following rule is set

'react/jsx-props-no-spreading': ['error', {
      html: "ignore",
      custom: "ignore",
      exceptions: [],
    }],

Actual: Getting the following error

Error: .eslintrc.js: Configuration for rule “react/jsx-props-no-spreading” is invalid: Value {“html”:“ignore”,“custom”:“ignore”,“exceptions”:[]} should NOT be valid.

Package versions:

"eslint": "^6.2.0",
"eslint-plugin-react": "^7.14.3",

Issue Analytics

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

github_iconTop GitHub Comments

9reactions
sadafk831commented, Jan 24, 2020

Just for the record: If you wish to use the rule and wish to ignore instead of setting it off. This is how you should use: In the rule definition, all the fields are made compulsory and specially exceptions is suppose to have an array of string not empty, so the declaration of rules goes like follow

'react/jsx-props-no-spreading': ['error', {
      html: "ignore",
      custom: "ignore",
      exceptions: [""],
    }],

For setting it off you can use either any of the following

'react/jsx-props-no-spreading': ['off']
'react/jsx-props-no-spreading': 0
7reactions
ljharbcommented, Aug 21, 2019

Set it to “off” then 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable in EsLint "react / jsx-props-no-spreading" error in ...
I want to create a rule in the EsLint configuration to ignore this error but the examples I found do not work. This...
Read more >
eslint-plugin-react/jsx-props-no-spreading.md at master - GitHub
Enforces that there is no spreading for any JSX attribute. This enhances readability of code by being more explicit about what props are...
Read more >
Prop spreading is forbidden warning in React | bobbyhadz
The warning "Props spreading is forbidden" is caused when we use the spread syntax to unpack a props object when passing props to...
Read more >
How to resolve eslint error: "prop spreading is forbidden" in a ...
ES lint discourages the use of prop spreading so that no unwanted/unintended props are being passed to the component.
Read more >
Disable in EsLint “react / jsx-props-no-spreading” error in ...
I want to create a rule in the EsLint configuration to ignore this error but the examples I found do not work. This...
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