-
-
Notifications
You must be signed in to change notification settings - Fork 209
11.0.0-beta.0 - Private class methods no-undef error #746
Comments
I also tried to compile, not works. class WebGLRenderer
Code above produces Babel compilation error:
Seems when I have defined next private method, previous was not blocked in method's context. Fun part, if you will rename There is an example PR: https://github.com/Ateiri/your-own-game-engine/pull/9 |
The core ESLint rule won’t be able to handle this syntax correctly. If eslint-plugin-babel doesn’t have a corresponding rule that handles this, it’ll have to be added there for this to work correctly. |
Hi @Ateiri I had a similar problem with a class defined like that: class foo {
...
#myPrivateMethod(arg) {
...
}
...
publicMethod() {
...
this.#myPrivateMethod(arg)
...
}
} This would trigger the following eslint error:
Not sure this is your same problem. If it is, I solved replacing the definition of the private method with: #myPrivateMethod = function (arg) {
...
} Hope it helps |
@gverni Thank you for your message, yeah, but it will create a property, not a method, so this property will be directly written in instance instead of prototype I guess. |
Good point @Ateiri. To help investigate this issue, I created a repo here with the sample private instance method from Babel 7.2.0 release note. The file transpile and execute correctly but the lint causes the |
@gverni as @kaicataldo mentioned, we need to take a look at |
On second look, given that this error is coming from |
I tried using of private class methods, but stuck with
no-undef
error.@babel/core@^7.2.0
, also added as peer dependency.babel-eslint@^11.0.0-beta.0
.Anybody have any suggestions?
The text was updated successfully, but these errors were encountered: