Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

react/prop-types not working with spreads #10

Open
HQidea opened this issue Oct 30, 2018 · 0 comments
Open

react/prop-types not working with spreads #10

HQidea opened this issue Oct 30, 2018 · 0 comments

Comments

@HQidea
Copy link
Collaborator

HQidea commented Oct 30, 2018

Eslint will not output any linting error if there are spreads.

code:

import React, {Component} from 'react';

class A extends Component {
  render() {
    const {a} = this.props;
    const attrs = {};

    return (
      <div {...attrs}>{a}</div>
    );
  }
}

export default A;

.eslintrc.json

{
  "root": true,
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "impliedStrict": true,
      "jsx": true,
      "experimentalObjectRestSpread": true
    }
  },
  "plugins": [
    "react"
  ],
  "rules": {
    "react/prop-types": "error"
  }
}

ref: jsx-eslint/eslint-plugin-react#1958 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant