Skip to content
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

Merged
merged 1 commit into from
Jul 31, 2018

Conversation

noisysocks
Copy link
Member

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).

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.
@noisysocks noisysocks added the [Type] Code Quality Issues or PRs that relate to code quality label Jul 30, 2018
@noisysocks noisysocks requested a review from aduth July 30, 2018 23:17
@noisysocks noisysocks merged commit d77b92b into master Jul 31, 2018
@noisysocks noisysocks deleted the add/doc-comment-to-popover-focus branch July 31, 2018 06:55
* position. This is useful when a DOM change causes the anchor node to change
* position.
*
* @return {void}
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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)

Copy link
Member Author

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:

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? 😛

Copy link
Member

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!

@aduth
Copy link
Member

aduth commented Jul 31, 2018

Thanks for adding this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants