-
Notifications
You must be signed in to change notification settings - Fork 176
Add new lint that bans private
modifiers
#714
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
Comments
I'm not a big fan of this. While there are now JavaScript standards for things like this, there is still a "benefit" to having type only modifiers like I can see that some code bases would like to enforce this rule, but I am not even 100% sure we would want to enforce it on |
I agree with @kitsonk. Putting my own feelings aside about the whole |
example? |
Hum, the fact you'll go from Using |
More readable is entirely subjective, so I am not sure an example would help you understand how using |
Ah my bad, i misunderstood something. |
My thought is that if the objection is a matter of readability (here I define "readability" as "people feel more comfortable with a syntax because the keyword is more descriptive and they are used to it"), it's not a big deal as it will be resolved as time goes. I'm sure people will get used to |
In my opinion using a different name to say it is private (so using a |
@kitsonk I don't have a strong opinion on this one, do you want to close it? |
At this point, the rule would not be considered "best practice" and therefore wouldn't be a good idea to implement and enable. |
TypeScript 4.3 supports private class fields with
#
, aligning with the ECMAScript proposal.The hash prefix (
#
) will work in both TypeScript and JavaScript, whileprivate
modifier doesn't once transpiled to JS - theprivate
keyword is finally eliminated while being converted to JS. playgroundSo basically we should prefer
#
toprivate
for more strictness unless there is any particular reason. It would be great if deno_lint has a new lint rule to help migrate fromprivate
to#
.One concern is that this new rule is kind of controversial if it's enabled by default. Perhaps we should implement it without turning on by default at first to see if it works well for the internals of Deno.
The text was updated successfully, but these errors were encountered: