Closed eric-burel closed 1 year ago
sorry its taken me so long to get to this.
i think it could be a useful rule, though would probably make more sense that it applies to all lit's required lifecycle methods (connectedCallback, update, updated, etc).
I saw that lifecycle-super
has been added! This is great :) Are there any plans to release that rule anytime soon?
thanks for the reminder! i thought i'd already published it, my mistake
ill sort a release out soon :+1:
Published in v1.9.0
LitElement
defines aconnectedCallback
that is necessary to call the render method.Therefore, contrary to raw
HTMLElement
, a call tosuper.connectedCallback()
is necessary if you don't want to break render.Example:
If we want to be very precise, the rule is that for every class that is a descendant of "ReactivElement", so "LitElement" and user-defined class that inherits "LitElement" such as my "EvenBetterLitElement", a call to lifecycle methods should start with a call to super.
It seems that eslint webc plugin ask you to list explicitely which classes are concerned, so I might have to manually add my "EvenBetterLitElement" to the list of classes that inherits LitElement.
In eslint-plugin-wc:
What's your opinion on this rule?