Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'type' of undefined (destructuring props) #12343

Closed
Baukaalm opened this issue Sep 30, 2019 · 7 comments
Closed

Cannot read property 'type' of undefined (destructuring props) #12343

Baukaalm opened this issue Sep 30, 2019 · 7 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue bug ESLint is working incorrectly needs info Not enough information has been provided to triage this issue

Comments

@Baukaalm
Copy link

Baukaalm commented Sep 30, 2019

const NextComposed = React.forwardRef((props, ref) => {
  const { as, href, prefetch, ...other } = props;

Cannot read property 'type' of undefined Occurred while linting

"extends": ["airbnb"],
  "parser": "babel-eslint",
  "env": {
    "node": true,
    "es6": true
  },
  "parserOptions": {
    "ecmaVersion": 9,
    "sourceType": "module",
    "ecmaFeatures": {
      "experimentalObjectRestSpread": true
    }

eslint v6.4.0

in vscode window at eslint plugin

Parsing error: Unexpected token
  23 | 
  24 | const NextComposed = React.forwardRef((props, ref) => {
> 25 |   const { as, href, prefetch, .other } = props;
     |                               ^
  26 |   return (
@Baukaalm Baukaalm added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Sep 30, 2019
@platinumazure platinumazure added needs info Not enough information has been provided to triage this issue and removed triage An ESLint team member will look at this issue soon labels Sep 30, 2019
@eslint-deprecated
Copy link

Hi @Baukaalm, thanks for the issue. It looks like there's not enough information for us to know how to help you.

If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

Requesting a rule change? Please see Proposing a Rule Change for instructions.

If it's something else, please just provide as much additional information as possible. Thanks!

@Pegase745
Copy link

Pegase745 commented Sep 30, 2019

duplicate #12335

@sackeyjason
Copy link

Here's a workaround: disable the no-useless-rename rule. From my package.json:

"no-useless-rename": [
  "error",
    {
      "ignoreDestructuring": true
    }
  ]

@kaicataldo
Copy link
Member

There are two different errors being reported here. The first one looks like a duplicate of #12335, while the second one looks like a correct syntax error (identifiers can’t begin with a . character).

@finom
Copy link

finom commented Sep 30, 2019

Also getting the same error with ({...foo}) => "bar";

UPD: Forgot to mention that the bug appeared at 6.5.0; I've downgraded eslint to 6.4.0 and the bug is gone.

@mdjermanovic
Copy link
Member

Also getting the same error with ({...foo}) => "bar";

This is also same as #12335.

Tried babel-eslint and it generates ExperimentalRestProperty node in this case, too.

@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Nov 1, 2019
@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that issues failing to reach accepted status after 21 days tend to
never be accepted, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators May 1, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue bug ESLint is working incorrectly needs info Not enough information has been provided to triage this issue
Projects
None yet
Development

No branches or pull requests

7 participants