Closed rictic closed 4 years ago
Great idea, I love this rule! This would be possible to implement after the performance branch has been finished which includes the new version of web-component-analyzer
. The new version of WCA emits all definitions of the same element and not just the last one found.
Edit: Ignore this comment
~Alternative, what's wrong with adding types to @fires
?~
// my-element.ts
/**
* @fires my-event {MyEventDetail}
*/
export class MyEvent extends LitElement { ... }
// main.ts
html`
<!-- type checking happens here -->
<my-element @my-event=${this.onMyEvent}></my-element>
...
`;
onMyEvent(e: MyEventDetail) { ... }
+1 to checking events (I believe there's an event map as well, though it's not element-specific), but that should be a different issue IMO
will file
I'm currently working on this branch: https://github.com/runem/lit-analyzer/tree/1.2.0 which should be able to support building this rule :-) Lately I have been caught up in web-component-analyzer
-specific work, but next I'll take a look at implementing this rule.
oh wow I'm dumb; I totally read this as Custom Events not Custom Elements haha >.< issue filed on #85
I just implemented the rule on 1.2.0 :-)
The rule is called no-missing-element-type-definition
and is disabled by default both when running strict and non-strict. Please let me know if you have any comments or any additions that you want me to add to this feature.
That quickfix is awesome!!
Awesome!
I've not been able to get this working - is it broken with lit@2
. See the attached screenshot. No error reported
Sorry I take it back, it is working now. Not sure what happened there!
A pass that would diagnose when a custom element is recognized in source code but it hasn't be declared on the HTMLElementTagNameMap, or if it is declared with the wrong tag name. For example:
Warns:
Warns:
Does not warn: