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.

Script documentation format for Javascript

See original GitHub issue

I am writing my script files in Javascript as opposed to Coffeescript and I keep getting an error with my documentation:

[Fri Nov 13 2015 15:15:54 GMT-0800 (PST)] INFO /home/sankethkatta/hubot/scripts/example.js is using deprecated documentation syntax

I am trying to follow the convention explained in the docs: https://github.com/github/hubot/blob/master/docs/scripting.md#documenting-scripts

I’ve tried replacing the # with // as well as a block style:

/**
 * <all the docs here>
 */

I still get the same error, no matter how I format it. Is there a preferred way of documenting for Javascript?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
sankethkattacommented, Nov 14, 2015

Looking at the parseHelp method in robot.coffee#L505. I found that the // comment format works:

// Description:
//   <description of the scripts functionality>
// ...

However, it must be the first line of the file or parseHelp stops parsing the file. It is important to note that the doc must come before any other code. My issue was that I was using a 'use strict'; declaration at the top of the file.

So your file should really look like this with any other require statements also written after the doc:

// Description:
//   <description of the scripts functionality>
// ...

'use strict';

var util = require('util');

module.exports = function(robot) { ... }
1reaction
Romanski1commented, Jun 24, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript Documentation Standards
The following is a list of what should be documented in WordPress JavaScript files: Functions and class methods. Objects.
Read more >
What's the best way to document JavaScript?
How to document your code #. There's a standard approach to JS documentation known as JSDoc. It follows a standard format.
Read more >
Code documentation for JavaScript with JSDoc
Writing documentation for the source code can help your future self and your colleagues. Learn how to document JavaScript with JSDoc!
Read more >
Documenting JavaScript Code With JSDocs
JavaScript has various data types like strings, numbers, arrays, and objects. The snippets below show how to document each of them using JSDocs....
Read more >
The Script element - HTML: HyperText Markup Language
In the example below, the first module specifier ("./shapes/square.js") resolves relative to the base URL of the document, while the second ...
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