When utilizing an IDE's autocomplete for overriding methods (Actor's onPreUpdate for example), it will autocomplete the method using param names from the definition of the super class:
Since the params are named with _ prefix in the super method, I get them in my autocomplete too. I then go and remove them manually, kind of ruining the benefits of the autocomplete.
Proposal
I presume this _ is to dodge the no-unused-vars eslint rule. Perhaps there's a better way to do this so that it doesn't affect the public API.
Suggestions:
Disable the no-unused-vars rule for the line of the overridable methods
class Actor {
onPreUpdate(engine, delta) { // eslint-disable-line no-unused-vars
}
// or
/**
* Not sure if this affects the JS doc for the method
**/
// eslint-disable-next-line no-unused-vars
onPreUpdate(engine, delta) {}
}
Customize the no-unused-vars rule to ignore based on some other pattern... perhaps hardcoding engine, delta, as those seem to be the most common... but this isn't very scalable
@mattjennings I agree, this is very goofy looking. And you are 100% right, eslint is the reason. I'd be down to do disable by line on overrides for sure.
Context
When utilizing an IDE's autocomplete for overriding methods (Actor's
onPreUpdate
for example), it will autocomplete the method using param names from the definition of the super class:Since the params are named with
_
prefix in the super method, I get them in my autocomplete too. I then go and remove them manually, kind of ruining the benefits of the autocomplete.Proposal
I presume this
_
is to dodge the no-unused-vars eslint rule. Perhaps there's a better way to do this so that it doesn't affect the public API.Suggestions:
engine
,delta
, as those seem to be the most common... but this isn't very scalable