question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Always move component documentation comment to the top

See original GitHub issue

You can create documentation for a Svelte component like this. I think it makes sense to always have this at the top of the file.

Current result when using scripts-markup-style:

<script>
  export let name = 'world';
</script>

<!--
@component
Here's some documentation for this component.
It will show up on hover.
-->
<h1>Hello, {name}</h1>

<style>
   h1 {
     color: blue;
   }
</style>

Desired result:

<!--
@component
Here's some documentation for this component.
It will show up on hover.
-->

<script>
  export let name = 'world';
</script>

<h1>Hello, {name}</h1>

<style>
   h1 {
     color: blue;
   }
</style>

This would be a breaking change.

Thoughts?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ehrencronacommented, Sep 8, 2020

Oh, right, true. We’d need to extend that to work with arbitrary comments then essentially. Looking at the code, that would also make sense code-wise. Seems like it should be a simple change.

1reaction
benmccanncommented, Sep 8, 2020

I think I like this change though I’ve never used this component documentation, so take that with a grain of salt. We should probably update the faq question you linked to if this change is made to use the same style.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Write Doc Comments for the Javadoc Tool - Oracle
This document describes the style guide, tag and image conventions we use in documentation comments for Java programs written at Java Software, Oracle....
Read more >
Best practices for writing code comments - Stack Overflow Blog
Best practices for writing code comments. While there are many resources to help programmers write better code—such as books and static ...
Read more >
Document Commenting in Managed Projects_AD - Altium
Type your comment, then click the. button beneath. The comment will be committed, appearing in the panel. For point, area and component type ......
Read more >
Scroll to the top of the page after render in react.js
Example code: class MyComponent extends React.Component { componentDidMount() { this._div.scrollTop = 0 } render() { return <div ref={(ref) => this.
Read more >
Positioning - Learn web development | MDN
Positioning allows us to produce interesting results by overriding normal document flow. What if you want to slightly alter the position of some ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found