-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inherits
replacement recommendation is not dev friendly
#147
Comments
inherits
entry is not dev friendlyinherits
replacement recommendation is not dev friendly
Again. Legacy does not mean deprecated. And there are cases where I purposefully did not use ES6 classes. The easiest replacement are the three lines i cited above. |
The ES6 class syntax is easier to understand for most people in my experience, and it's so widely used, new JavaScript developers might not even know about It's completely okay if you prefer the older syntax, but as already mentioned:
|
Sure. There are even old JS developers, who never learned the prototype way of inheritance, as they learned class inheritance from the beginning. I mean ES6 is ES2015, and that means that class inheritence is 9 years old. Its not like I prefer any old syntax. I prefer classes, but there are cases where you want to use the prototype way. Also i doubt that the official node.js docs is recommending anything. util.inherits is an old utility function, which would not be implemented nowadays if requested, as you can do it yourself with that three liner. Back in those days alot of stuff was added to nodejs, which is considered wrong nowadays. E.g.
node:querystring
Fact is that the easiest way to replace the inherits plugin with the three lines I posted in my original post. And that should be documented. |
i'd be open to moving that would then allow you to create a doc for it, which would explain both the @justinfagnani @Uzlopak what do you think? the linter will still pick it up, as i think this is a documentation issue rather than |
@43081j what about both? The originator the library recommends using classes and |
It says right in the docs that they recommend using class syntax. |
do you mean both manifests? the current manifests are not meant to overlap since the linter will apply them as if they were "levels" of strictness if we move it to the preferred manifest, it just means we can add a doc. it'll still be enabled in the linter and the CLI |
Actually we need to read further in the docs:
And semantically incompatible refers to: So it is a little bit more complicated but probably |
The
inherits
package was added with #103 to solve #99 by @justinfagnaniI politely disagree with the whole remark, that you should just use "class syntax". Nobody with the right mind would imho rewrite everything to shave off 4 kb. Also just to claim that inherits is considered legacy, does not mean that it is deprecated. It just means that it will stay but will not be actively developed.
It would be closer to reality to recommend what inherits actually does by directly modifying the prototype of the Target with the Base
So instead of:
you just do:
So you dont need to rewrite the functions to classes, just to remove inherits.
The text was updated successfully, but these errors were encountered: