-
Notifications
You must be signed in to change notification settings - Fork 1k
[labs/tsserver-plugin] Type check Lit property bindings #5056
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
Conversation
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultsthis-change
render
update
update-reflect
this-change, tip-of-tree, previous-release
render
update
nop-update
this-change, tip-of-tree, previous-release
render
update
this-change, tip-of-tree, previous-release
render
update
update-reflect
|
|
The size of lit-html.js and lit-core.min.js are as expected. |
🦋 Changeset detectedLatest commit: 8e9cf61 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
justinfagnani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
| * Central definition of diagnostic codes. | ||
| */ | ||
| export const LitDiagnosticCode = { | ||
| BindingLikeAttributeName: 6301, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we comment on why we chose these numbers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
packages/labs/tsserver-plugin/src/lib/rules/no-unassignable-property-bindings.ts
Show resolved
Hide resolved
| } else { | ||
| if (part.expressions.length !== 1) { | ||
| throw new Error( | ||
| 'InternalError: Expected exactly one expression' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be impossible, but want to leave any breadcrumbs for after-the-fact debugging? Like outputting the attribute test from the template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Done.
| element.tagName | ||
| ); | ||
| if (elementType === undefined) { | ||
| // Unknown element. Other rules will warn in this case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the HTMLElementTagNameMap include built-in elements? Should we fall back to HTMLElement for unknown elements? ie, a .id=${} binding is fine actually, but if we don't know the element .foo=${} is bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does include built-ins, but yeah, good point, we should fall back to HTMLUnknownElement here.
| const location = element.sourceCodeLocation?.attrs?.[attr.name]; | ||
| const templateStart = | ||
| (typescript.isNoSubstitutionTemplateLiteral(tsNode.template) | ||
| ? tsNode.template.getStart() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not entirely sure the difference, but I've been trying to use getFullStart() after getting inconsistence results from other methods and properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
packages/labs/tsserver-plugin/src/lib/rules/no-unassignable-property-bindings.ts
Show resolved
Hide resolved
|
I think we should merge this into main when it's prereqs are in, instead of into |
…ndings. Not implemented yet, just a commit hooking things up.
b1fe56e to
dd920c2
Compare
No description provided.