I'm implementing a client-side application using ECMAScript6 and use JSHint for static code analysis. I often use the following pattern in my code:
class MyClass {
constructor() {
//This is how I would like to call myMethod
myMethod();
//This is how I should call myMethod to make JSHint analysis pass
this.myMethod();
}
myMethod(){
//Implementation
}
}
My primary language is Java so I expect that simply calling myMethod() should be ok. However without adding this to method call I'm getting "'myMethod' is not defined" warning from JSHint. My questions are:
- Is it correct to make calls without this in such situation? (e.g. in PHP you always need to add $this-> to non-static method call)
- If that's correct to make calls without this is there any way (any .jshintrc flag) to turn off this warning in JSHint?