-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Build: Fix JSDoc syntax errors #9813
Conversation
I'm not sure why my commit message is invalid. 😄 |
I think you have to have a colon ( |
JSDoc syntax errors were causing "npm run docs" to fail. - JSDoc doesn't yet support specifying array content, i.e. "[number, number]" is a syntax error, so I'm using "number[]" instead. (source: jsdoc/jsdoc#1073) - JSDoc doesn't support multiline objects, e.g. returning report information was a syntax error, so I extracted it into a typedef, as well as the disable directive.
@j-f1 lol, yeah, I added the colon at the wrong place. Now it works, yay. 🎉 |
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.
LGTM, thanks! Just left a couple of questions.
* @property {(number|undefined)} endColumn | ||
* @property {(string|null)} nodeType | ||
* @property {string} source | ||
* @property {({text: string, range: (number[]|null)}|null)} fix |
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.
Wondering if this should be extracted to a typedef? It's a bit gnarly.
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.
@property {Fix|null} fix
maybe?
@@ -121,7 +137,7 @@ function compareFixesByRange(a, b) { | |||
* Merges the given fixes array into one. | |||
* @param {Fix[]} fixes The fixes to merge. | |||
* @param {SourceCode} sourceCode The source code object to get the text between fixes. | |||
* @returns {{text: string, range: [number, number]}} The merged fixes | |||
* @returns {{text: string, range: number[]}} The merged fixes |
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.
Not familiar with JSDoc. Can we do something like number[2]
or otherwise represent the ranges as a 2-tuple somehow?
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.
Unfortunately it doesn't work, and I haven't found any details about specifying the length of the array on the internet. I don't think JSDoc supports it.
Thanks for contributing! |
What is the purpose of this pull request? (put an "X" next to item)
docs
script which was failing due to JSDoc syntax errors.What changes did you make? (Give an overview)
I fixed the
docs
script that was failing due to JSDoc syntax errors.JSDoc doesn't yet support specifying array content, i.e. "[number,
number]" is a syntax error, so I'm using "number[]" instead. (source:
How to document array elements? jsdoc/jsdoc#1073)
JSDoc doesn't support multiline objects, e.g. returning report information
was a syntax error, so I extracted it into a typedef, as well as the
disable directive.
Is there anything you'd like reviewers to focus on?
@typedef
s, which now show up in the docs. Is that acceptable or should I inline them?[number, number]
syntax isn't a valid way to describe arrays, so I had to turn it intonumber[]
, which is less descriptive. I could perhaps extract it into a separate typedef and add a description, but it sounds like an overkill.