Babel-eslint: 11.0.0-beta.0 - Private Instance Methods - Parsing error: params is not iterable

Created on 6 Feb 2019  路  9Comments  路  Source: babel/babel-eslint

I'm getting following error:
Parsing error: params is not iterable

while linting a file with a private instance method.

Using:
@babel/[email protected]
@babel/[email protected]
@babel/[email protected]
[email protected]
[email protected]

test.js (linted file):

class Person {
  #age = 19;

  #increaseAge() {
    this.#age++;
  }

  birthday() {
    this.#increaseAge();
    alert("Happy Birthday!");
  }
}

.eslintrc.js:

module.exports = {
    "parser": "babel-eslint",
};

babel.config.js:

module.exports = {
    presets: [],
    plugins: [
        "@babel/plugin-proposal-class-properties",
        "@babel/plugin-proposal-private-methods"
    ]
};
bug needs investigation

Most helpful comment

I can confirm this:

    "@babel/plugin-proposal-class-properties": "^7.3.4",
    "@babel/plugin-proposal-private-methods": "^7.3.4",
    "eslint": "5.15.1",
    "babel-eslint": "11.0.0-beta.0"

All 9 comments

I'm also experiencing the same issue. I got around it temporarily by using arrow functions instead:

 #increaseAge = () => {
    this.#age++;
  }

Actually, with the arrow function syntax I get:

Unexpected 'this'. (babel/no-invalid-this)

After digging, I found this related issue: https://github.com/babel/babel/issues/9506

The issue in Babel (babel/babel#9506) is blocked by estree/estree#180.

I can confirm this:

    "@babel/plugin-proposal-class-properties": "^7.3.4",
    "@babel/plugin-proposal-private-methods": "^7.3.4",
    "eslint": "5.15.1",
    "babel-eslint": "11.0.0-beta.0"

I also second this:

"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-private-methods": "^7.6.0",
"eslint": "6.1.0",
"babel-eslint": "11.0.0-beta.0"

Any fix..?

It has been fixed in https://github.com/babel/babel/pull/10914 (Babel v7.8.0)

Was this page helpful?
0 / 5 - 0 ratings