-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add JSDoc comment to Popover's focus() method #8312
Conversation
The public focus() method has documentation in the Popover component's README file, but it would be useful to have it in a JSDoc comment as well.
* position. This is useful when a DOM change causes the anchor node to change | ||
* position. | ||
* | ||
* @return {void} |
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.
There's a bit of a convention to not explicitly document the undefined return value. I seem to recall some discussion on it, but it should be formalized if we want to follow one way or the other.
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.
Can we add a lint rule one way or the other?
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.
Looking at this page, it might be possible by "requireReturn": false
:
https://eslint.org/docs/rules/valid-jsdoc#options
false if and only if the function or method has a return statement or returns a value e.g. async function (this option value does apply to constructors)
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.
It looks like that's what we're doing:
Line 155 in 25f364b
requireReturn: false, |
I guess there's no way to require no @return {void}
which is a shame.
Which is the lesser of two evils? Having to type @return {void}
all the time, or allowing inconsistency? 😛
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.
Or creating our own JSDoc rule!
Thanks for adding this! |
The public focus() method has documentation in the Popover component's README file, but it would be useful to have it in a JSDoc comment as well.
Fixes #7219 (comment).