Open mattrunyon opened 2 years ago
Adding this rule affects many memoized getters we have b/c they are set using instance variable notation and not instance methods. E.g. getCachedItems = memoize(...);
. I don't think there's really a way around this b/c the memoized function needs to be initialized w/ the class. So the alternative would be initializing all the memoized functions in the constructor which is not a good choice
We could instead use type-annotations
here with the main downside there that any instance variable initialization would be put after lifecycle methods. E.g. myItems: Item[]
would be expected before the constructor, but myItems: Item[] = []
would be expected after lifecycle methods.
Currently, our eslint config requires instance variables to be defined after the constructor and lifecycle handlers like below.
If we add
instance-variables
to the order beforelifecycle
, then this should require instance variables be defined before the constructor and after static members like below. This only applies to jsx/tsx files.It will require some manual fixing as the rule doesn't have auto-fix.