Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@bennypowers
Copy link
Collaborator

@bennypowers bennypowers commented Aug 23, 2023

  • adds tests
  • support @cssproperty, @cssprop, @csspart (all lowercase)
  • support @fires {Type} event-name - description
  • support @cssProp {<syntax>} [--name=default] - description
/**

 * @fires event-name
 * @fires event-name description
 * @fires event-name - description
 * @fires event-name: description
 * @fires event-name {Type}
 * @fires event-name {Type} description
 * @fires event-name {Type} - description
 * @fires event-name {Type}: description
 * @fires {Type} event-name
 * @fires {Type} event-name description
 * @fires {Type} event-name - description
 * @fires {Type} event-name: description
 * @slot name
 * @slot name description
 * @slot name - description
 * @slot name: description
 * @cssProp [--name=default]
 * @cssProp [--name=default] description
 * @cssProp [--name=default] - description
 * @cssProp [--name=default]: description
 * @cssprop {<color>} [--name=default]
 * @cssprop {<color>} [--name=default] description
 * @cssprop {<color>} [--name=default] - description
 * @cssprop {<color>} [--name=default]: description
 */

@changeset-bot
Copy link

changeset-bot bot commented Aug 23, 2023

🦋 Changeset detected

Latest commit: fc277af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lit-labs/analyzer Patch

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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 23, 2023

📊 Tachometer Benchmark Results

Summary

nop-update

  • this-change, tip-of-tree, previous-release: unsure 🔍 -4% - +9% (-0.84ms - +1.84ms)
    this-change vs tip-of-tree

render

  • this-change: 69.17ms - 72.40ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -7% - +2% (-1.99ms - +0.55ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +2% (-0.37ms - +1.20ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +2% (-0.76ms - +1.09ms)
    this-change vs tip-of-tree

update

  • this-change: 741.88ms - 755.97ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +7% (-1.50ms - +4.71ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +2% (-0.77ms - +2.13ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +1% (-9.63ms - +5.41ms)
    this-change vs tip-of-tree

update-reflect

  • this-change: 715.50ms - 727.39ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +1% (-5.13ms - +7.58ms)
    this-change vs tip-of-tree

Results

this-change

render

VersionAvg timevs
69.17ms - 72.40ms-

update

VersionAvg timevs
741.88ms - 755.97ms-

update-reflect

VersionAvg timevs
715.50ms - 727.39ms-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
26.53ms - 28.37ms-unsure 🔍
-7% - +2%
-1.99ms - +0.55ms
unsure 🔍
-8% - +1%
-2.38ms - +0.38ms
tip-of-tree
tip-of-tree
27.29ms - 29.05msunsure 🔍
-2% - +7%
-0.55ms - +1.99ms
-unsure 🔍
-6% - +4%
-1.64ms - +1.08ms
previous-release
previous-release
27.42ms - 29.48msunsure 🔍
-1% - +9%
-0.38ms - +2.38ms
unsure 🔍
-4% - +6%
-1.08ms - +1.64ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
70.23ms - 74.26ms-unsure 🔍
-2% - +7%
-1.50ms - +4.71ms
unsure 🔍
-7% - +4%
-5.31ms - +3.24ms
tip-of-tree
tip-of-tree
68.28ms - 73.00msunsure 🔍
-6% - +2%
-4.71ms - +1.50ms
-unsure 🔍
-10% - +2%
-7.09ms - +1.81ms
previous-release
previous-release
69.50ms - 77.05msunsure 🔍
-5% - +7%
-3.24ms - +5.31ms
unsure 🔍
-3% - +10%
-1.81ms - +7.09ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
19.30ms - 21.26ms-unsure 🔍
-4% - +9%
-0.84ms - +1.84ms
unsure 🔍
-6% - +9%
-1.13ms - +1.74ms
tip-of-tree
tip-of-tree
18.87ms - 20.69msunsure 🔍
-9% - +4%
-1.84ms - +0.84ms
-unsure 🔍
-8% - +6%
-1.59ms - +1.19ms
previous-release
previous-release
18.94ms - 21.02msunsure 🔍
-9% - +6%
-1.74ms - +1.13ms
unsure 🔍
-6% - +8%
-1.19ms - +1.59ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
49.45ms - 50.55ms-unsure 🔍
-1% - +2%
-0.37ms - +1.20ms
unsure 🔍
-1% - +2%
-0.29ms - +1.12ms
tip-of-tree
tip-of-tree
49.03ms - 50.14msunsure 🔍
-2% - +1%
-1.20ms - +0.37ms
-unsure 🔍
-1% - +1%
-0.70ms - +0.70ms
previous-release
previous-release
49.15ms - 50.02msunsure 🔍
-2% - +1%
-1.12ms - +0.29ms
unsure 🔍
-1% - +1%
-0.70ms - +0.70ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
104.18ms - 106.37ms-unsure 🔍
-1% - +2%
-0.77ms - +2.13ms
unsure 🔍
-1% - +2%
-0.72ms - +2.42ms
tip-of-tree
tip-of-tree
103.65ms - 105.53msunsure 🔍
-2% - +1%
-2.13ms - +0.77ms
-unsure 🔍
-1% - +2%
-1.29ms - +1.63ms
previous-release
previous-release
103.31ms - 105.54msunsure 🔍
-2% - +1%
-2.42ms - +0.72ms
unsure 🔍
-2% - +1%
-1.63ms - +1.29ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
44.35ms - 45.67ms-unsure 🔍
-2% - +2%
-0.76ms - +1.09ms
unsure 🔍
-2% - +2%
-0.71ms - +1.05ms
tip-of-tree
tip-of-tree
44.19ms - 45.49msunsure 🔍
-2% - +2%
-1.09ms - +0.76ms
-unsure 🔍
-2% - +2%
-0.87ms - +0.88ms
previous-release
previous-release
44.25ms - 45.43msunsure 🔍
-2% - +2%
-1.05ms - +0.71ms
unsure 🔍
-2% - +2%
-0.88ms - +0.87ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
738.69ms - 749.19ms-unsure 🔍
-1% - +1%
-9.63ms - +5.41ms
unsure 🔍
-1% - +1%
-6.43ms - +6.75ms
tip-of-tree
tip-of-tree
740.67ms - 751.43msunsure 🔍
-1% - +1%
-5.41ms - +9.63ms
-unsure 🔍
-1% - +1%
-4.42ms - +8.96ms
previous-release
previous-release
739.80ms - 747.76msunsure 🔍
-1% - +1%
-6.75ms - +6.43ms
unsure 🔍
-1% - +1%
-8.96ms - +4.42ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
743.52ms - 752.18ms-unsure 🔍
-1% - +1%
-5.13ms - +7.58ms
unsure 🔍
-0% - +1%
-2.89ms - +10.97ms
tip-of-tree
tip-of-tree
741.97ms - 751.28msunsure 🔍
-1% - +1%
-7.58ms - +5.13ms
-unsure 🔍
-1% - +1%
-4.32ms - +9.95ms
previous-release
previous-release
738.40ms - 749.22msunsure 🔍
-1% - +0%
-10.97ms - +2.89ms
unsure 🔍
-1% - +1%
-9.95ms - +4.32ms
-

tachometer-reporter-action v2 for Benchmarks

@bennypowers bennypowers marked this pull request as ready for review August 23, 2023 08:42
@bennypowers
Copy link
Collaborator Author

for this initial review, I took the approach of checking the first char of the event comment for a { and switching the regexp used depending. This was after about an hour of regex jenga to try and alternate the capture groups - eventually it felt like a silly way to spend the time, but I'm happy for my regex-betters to show me the way here.

@bennypowers bennypowers changed the title fix(analyzer): jsdoc type order, lowercase tags fix(analyzer): jsdoc type order, lowercase tags, css syntax Aug 23, 2023
@justinfagnani justinfagnani self-requested a review August 23, 2023 14:50
Copy link
Collaborator

@justinfagnani justinfagnani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Amazing tests!

My only question is about the return type of the jsdoc parsing and why we can't use parseNamedTypedJSDocInfo for parsing CSS properties.

default?: string;
}

export interface NamedDescribedSyntax extends NamedDescribed {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a generic interface for anything with a syntax, or is a specific interface now for a CSS property? I think it might be nicer to read if this were just CSSPropertyInfo or something.

case 'cssProp':
addNamedJSDocInfoToMap(cssProperties, tag, analyzer);
break;
case 'cssprop':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really care about the cases like this, or can we lowercase the tag before hitting the switch statement to get a case-insensitive comparison?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i initially lowercased the tag, but like ... @cSsPRop...

return undefined;
}
const nameTypeDesc = comment.match(parseNameTypeDescRE);
const regex = comment.startsWith('{')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems fine to me!

This still requires a lookaround for the case of event with inline detail
Copy link
Collaborator

@justinfagnani justinfagnani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loogs great!

@justinfagnani
Copy link
Collaborator

Thanks a lot @bennypowers! I'll merge as soon as the tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants