11.0.0-beta.2 - Private method is not defined. (eslintno-undef)
sKopheK opened this issue · comments
Hello,
I'm using experimental implementation of babel's private methods proposal and getting following error:
'setType' is not defined (no-undef)
for the following linted file:
export default class Ship {
#type = null;
constructor(type) {
this.#setType(type);
}
#setType(type) { // error raised on this line
this.#type = type;
}
}
Config files:
package.json
- devDependencies (more dependencies included as I'm using NeutrinoJS):
...
"@babel/plugin-proposal-private-methods": "^7.8.3",
"babel-eslint": "^11.0.0-beta.2",
"eslint": "^6.8.0",
...
.eslintrc.js
module.exports = {
...
"parser": "babel-eslint",
...
};
babel.config.js
(actually have more presents and plugins, but the error persist even when omitted)
module.exports = {
babelrc: false,
presets: [],
plugins: [
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }],
]
};
Furthermore, no linting occurs in the whole method marked as not defined.
I think this has discussed in here #746 but still there is no valid solution for the problem
I think this has discussed in here #746 but still there is no valid solution for the problem
tnx, I believe it's fixed, but waiting for next major Babel release according babel/babel#10752
Same here. I don't believe this. I'm struggling with this private method since early 2019! Babel v8 completion is at 38%, so when we got this working properly?
Is there any solution for that? Private methods are correctly working on babel, but workflow is blocked due to linter...
So we have to wait for Babel 8 to be out for this to be fixed? No workarounds available?
Fixed in @babel/eslint-parser
7.11.0, see https://babel.dev/blog/2020/07/13/the-state-of-babel-eslint#the-future for the renaming guide.