xojs/xo

Prefer real private fields over public/private

jimmywarting opened this issue · 1 comments

Javascript has private class fields now... and compilers are able to downgrade it to using WeakMap if necessary.

I think public/private should be discouraged over the native approach. typescripts private keyword is only soft private and don't really protect anything. another thing is that compilers can mangle those hard private # names into 1-2 letter words when minifying

another thing could be to discourage class fields that starts with _ and warn/suggest to use # instead (for both js and ts)

...anything that have the keyword public is just bloated annotation, it's really just more simpler than that, everything that isn't private is public, why be so explicit?