Skip to content
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

Javascript "Proposed Class Member Organization" #41

Open
shanejann opened this issue Apr 24, 2019 · 0 comments
Open

Javascript "Proposed Class Member Organization" #41

shanejann opened this issue Apr 24, 2019 · 0 comments

Comments

@shanejann
Copy link

shanejann commented Apr 24, 2019

(Please excuse any incorrect terminology in the title or this description).

I had a back and forth with @DanielSchaffer on property and function organization on a class. I've noticed occasional inconsistencies in where we place our functions in files (For example, declaring a private function before a public one for no reason). Daniel proposed the following:

  • public static properties
  • public static methods
  • private static properties
  • private static methods
  • public property accessors (grouped with their private local fields, if applicable)
  • private property accessors
  • public fields
  • private fields
  • constructor
  • lifecycle hooks, in lifecycle order (e.g. ngOnInit before ngOnDestroy)
  • public methods
  • protected methods
  • private methods

I think this should be clearly publicized in the style guide. Ensuring our functions are in the correct makes it significantly easier to navigate a file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant