-
Notifications
You must be signed in to change notification settings - Fork 885
Member ordering too strict #226
Comments
👍 We want this for the variables, but oftentimes we want the functions organized by functionality, e.g. a private function that supports a public part of the API, we want to group these functions together. So this rule is unusable until this is fixed. |
👍 |
Curious on the status of this |
+1 I should be able to put
Public functions/methods used as callbacks by Angular often use arrow functions. In OO terms they are methods and should not be lumped in with variable declarations. |
+1 |
This seems like two separate enhancements so far:
Both seem like reasonable requests, but my worry is that the rule's options become overly complex. |
+1 to @rcollette 's arrow function suggestion Would that have to be a separate option or would people be okay with just considering arrow function definitions as methods? |
Member variables initialized as arrow functions are now treated as methods by the |
It'd be nice to opt-out of the classification of arrow functions properties as methods. Sometimes it makes more sense than others. For example, a function like this: interface MemoizeOpts<T> {
comparator: (a: T, b: T) => boolean;
cacheSize?: number;
} tslint now tells me to put the cache size above the comparator, but this doesn't make much sense as it's not as important (or even required). Just a niggle. I can't think of anywhere I'd want to do this other than interfaces - so perhaps a way to apply this to only classes..? |
@jamiewinder hmm, you're right, this part of the rule doesn't seem like it should apply to interfaces. thoughts @jkillian? |
@jamiewinder @adidahiya Agreed, I think we can stop treating arrow function types as methods for interfaces. Users can always use the function syntax ( |
Filed #987 to fix this |
This is causing problems; see #4156. |
After using the member-ordering rule like so
It seems to inherently enact the rule that this applies to functions as well as to member variables. Can we have it so that we can only enforce this on the member variables excluding the functions?
The text was updated successfully, but these errors were encountered: