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

ESLint Rule: Enforce sorting of members #4

Open
paul-go opened this issue Apr 9, 2019 · 0 comments
Open

ESLint Rule: Enforce sorting of members #4

paul-go opened this issue Apr 9, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@paul-go
Copy link
Collaborator

paul-go commented Apr 9, 2019

The following project doesn't have enough options to enforce our property ordering rules, however, it can likely be forked and modified slightly:
https://www.npmjs.com/package/eslint-plugin-sort-class-members

The official rules are:

  • Static members should precede all instance members.
  • The constructor, if it exists, should be placed directly after any static members.
  • Instance members should be placed directly after the constructor, if it exists.
  • Getters must be placed immediately before the corresponding setter
  • Backing fields must be placed immediately after the getter in the case when there's no setter, or after the setter in the case when it's present.

Otherwise, members should generally be located close to where they're being used. This is difficult to enforce via linting, and so we deal with this in code review.

@paul-go paul-go added the enhancement New feature or request label Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant