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

Rule: Enforce order of items within an class #13

Open
3 tasks
benjamincharity opened this issue May 13, 2019 · 0 comments
Open
3 tasks

Rule: Enforce order of items within an class #13

benjamincharity opened this issue May 13, 2019 · 0 comments
Labels
Focus: rule An item concerning existing or new rules Type: feature

Comments

@benjamincharity
Copy link
Contributor

This rule is similar to https://palantir.github.io/tslint/rules/member-ordering/ but that rule doesn't offer the exact implementation our libraries desire.

Currently our library follows the standard:

  1. properties
  2. getters
  3. inputs
  4. outputs
  5. constructor
  6. lifecycle methods (these should be ordered in they are called)
    a. OnChanges
    b. OnInit
    c. DoCheck
    d. AfterContentInit
    e. AfterContentChecked
    f. AfterViewInit
    g. AfterViewChecked
    h. OnDestroy
  7. public methods
  8. private methods

Rule details:

  • Enforce the order of items within the class according to the above list
  • The rule should allow an options (obj/arr?) to customize the order
    • Note: Lifecycle method order should not be adjustable, but where the lifecycle methods are in relation to other items should be adjustable.
  • Enforce 1 line break between properties, getters, inputs, outputs
  • Enforce 2 line breaks between outputs and constructor and all methods

  • Create rule
  • Make the rule fixable
  • Add rule to our default ruleset
@benjamincharity benjamincharity added Type: feature Focus: rule An item concerning existing or new rules labels May 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Focus: rule An item concerning existing or new rules Type: feature
Projects
None yet
Development

No branches or pull requests

1 participant