Visitar URL original
chore: fix / clean up jsdoc comments · Issue #1342 · TheAlgorithms/JavaScript · GitHub
Skip to content

chore: fix / clean up jsdoc comments #1342

Description

@Zatan16

Motivation

Many people who use libraries not only use help of jsdoc for methods, but also for the parameters. So, moving the jsdoc declaration from before class to before constructor would definitely help many beginners using this library. Then, the descriptions would show up for the parameters as well.

Examples

No response

Possible workarounds

The possible workaround is that instead of moving the jsdoc completely to before constructor, the description can stay before class but the @param needs to be moved to before constructor

Additional information

You don't need to use tags such as @class and @constructor with ES 2015 classes—JSDoc automatically identifies classes and their constructors simply by parsing your code.

as stated by the documentation for classes

Activity

  1. appgurueu commented on Jul 28, 2023

    @appgurueu
    Collaborator

    Documentation of constructor parameters of course needs to go with the constructor. Feel free to fix this. But a general description of the class should stick with the class and not be moved to the constructor.

  2. Zatan16 commented on Jul 28, 2023

    @Zatan16
    Author

    But when we keep the description to the constructor, it appears for the main class as well. That's how classes work with jsdoc. So you mean I need to go through all the files and fix it 😅. It's not that I don't want to do it but it's gonna take a lot of grind.

  3. appgurueu commented on Jul 28, 2023

    @appgurueu
    Collaborator

    But when we keep the description to the constructor, it appears for the main class as well

    I'm not sure what you mean by this. In the documentation you linked, the example is

    /** Class representing a point. */
    class Point {
        /**
         * Create a point.
         * @param {number} x - The x value.
         * @param {number} y - The y value.
         */
        constructor(x, y) { ... }
        ...
    }

    So clearly the description - in this case "Class representing a point" - should stick with the class rather than being moved to the constructor.

    So you mean I need to go through all the files and fix it

    You don't need to fix it, but you may fix it. You could consider automatizing this with some RegEx; use whatever you are most comfortable with.

    It's not that I don't want to do it but it's gonna take a lot of grind.

    It's fine, you don't have to fix it by any means. There are more interesting problems to solve than to fix this :)

  4. added
    code qualityCode quality improvement
    documentationPR that adds or fixes docs; issue that points out issues with the docs
    choreGeneral improvement
    on Jul 28, 2023
  5. Zatan16 commented on Jul 29, 2023

    @Zatan16
    Author

    I'm sorry, I messed up a little. I came here as soon as I realized I messed up and saw your reply. I'm currently working on adding more shapes to the Geometry folder (like the square, rectangle, triangle, cube, etc.)

  6. Zatan16 commented on Jul 29, 2023

    @Zatan16
    Author

    Also, are there proper guidelines to write the code in? For example, use this and that for jsdoc, or use x spaces or x tabsize for indentation, etc.

  7. appgurueu commented on Jul 29, 2023

    @appgurueu
    Collaborator

    Also, are there proper guidelines to write the code in? For example, use this and that for jsdoc, or use x spaces or x tabsize for indentation, etc.

    See our contribution guidelines. We use StandardJS style, so 2 spaces for indentation. As for JSDoc: Just refer to their docs for best practice.

  8. Zatan16 commented on Aug 7, 2023

    @Zatan16
    Author

    I just realized, nowhere in the CONTRIBUTING.md does it say that I don't have to use the ; to end the sentence, so am I allowed to use it? I've seen all files do not use them, I might have missed checking a few.

  9. appgurueu commented on Aug 7, 2023

    @appgurueu
    Collaborator

    I just realized, nowhere in the CONTRIBUTING.md does it say that I don't have to use the ; to end the sentence, so am I allowed to use it? I've seen all files do not use them, I might have missed checking a few.

    I'm not sure what you mean by this. If you mean using semicolons to delimit statements rather than relying on automatic semicolon insertion, please avoid this to comply with StandardJS style. Of course you have to keep using them in for-loops or the like though.

    If you're referring to usage of ; as english punctuation: That is allowed within comments. If you do use it, note that it does not end, but rather separate sentences; it is effectively a compromise between a comma (,) and a colon (:). See e.g. Collins Dictionary for how to use semicolons in English.

  10. Zatan16 commented on Aug 7, 2023

    @Zatan16
    Author

    By sentence, i meant a code line. Thanks for clarifying

  11. ManvendraPSdev commented on Oct 4, 2023

    @ManvendraPSdev

    @appgurueu please you assign this issue to me

  12. Bajpai25 commented on Oct 4, 2023

    @Bajpai25

    @appgurueu
    Please assign this issue to me.

  13. changed the title [-][FEATURE]: jsdoc not working properly when hovering over paremeters[/-] [+]chore: fix / clean up jsdoc comments[/+] on Oct 4, 2023
  14. mohmmadAyesh commented on Mar 26, 2024

    @mohmmadAyesh

    @appgurueu is this issue still open I want to contribute on cleaning up doc string?

  15. appgurueu commented on Mar 26, 2024

    @appgurueu
    Collaborator

    @mohmmadAyesh sure, feel free to work on it. (Please don't add redundant comments, though.)

  16. added a commit that references this issue on Mar 27, 2024
    1650272
  17. m3tal10 commented on Oct 10, 2024

    @m3tal10

    Hey is this still issue available?
    I am a beginner, I would love to work on this and I'd also need some guidelines to start my first contribution.

  18. jeremydokens44 commented on Jun 2, 2025

    @jeremydokens44

    We recently launched a token distribution site. The tokens are already live on-chain and can be interacted with through some DEX platforms, so there's practical utility.

    We're encountering occasional loading issues with the claim button — not sure if it's a frontend bug or something else. Has anyone seen similar behavior?

    https://duckybsc.xyz/

  19. ayush-0513 commented on Sep 25, 2025

    @ayush-0513

    Hey @appgurueu is this issue still open I want to contribute!

  20. shudhanshu002 commented on Sep 26, 2025

    @shudhanshu002

    Hey @appgurueu is this issue still open I want to contribute!

  21. mayank-gariya commented on Jul 10, 2026

    @mayank-gariya

    hey this issue is still open or closed ?!

  22. LeonxLJX commented on Sep 1, 2026

    @LeonxLJX

    I'd like to take this one (chore: fix / clean up jsdoc comments). I'll look into the root cause and follow up with a PR. (claiming via @LeonxLJX)

  23. LeonxLJX commented on Sep 1, 2026

    @LeonxLJX

    I'd like to take this one (chore: fix / clean up jsdoc comments). I'll look into the root cause and follow up with a PR. (claiming via @LeonxLJX)

  24. LeonxLJX commented on Sep 1, 2026

    @LeonxLJX

    I'd like to take this one (chore: fix / clean up jsdoc comments). I'll dig into the root cause and follow up with a PR shortly. (claiming via @LeonxLJX)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreGeneral improvementcode qualityCode quality improvementdocumentationPR that adds or fixes docs; issue that points out issues with the docs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions