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

"valid-jsdoc" rule doesn't support arrow functions for validating @return tags #2952

Closed
EvHaus opened this issue Jul 8, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@EvHaus
Copy link

commented Jul 8, 2015

The following code incorrectly returns an "Unexpected @returns tag; function has no return statement" error.

/**
 * Description
 * @returns {object}
 */
const test = () => MyMethod();

Arrow function should be considered in the validation of @returns.

@gyandeeps

This comment has been minimized.

Copy link
Member

commented Jul 8, 2015

Can you share what version of eslint are you using and the code and the output?
And also what do you expect to happen?

@gyandeeps gyandeeps added the triage label Jul 8, 2015

@EvHaus

This comment has been minimized.

Copy link
Author

commented Jul 8, 2015

Versions:
babel-eslint: v3.1.23
eslint: 0.23.0

Code:

/**
 * Description
 * @returns {object}
 */
const test = () => MyMethod();

ESLint Rule Enabled:

valid-jsdoc: [2, {"requireReturn": false}]

Output:

Unexpected @returns tag; function has no return statement

Expected output:
No warnings or errors.

@gyandeeps

This comment has been minimized.

Copy link
Member

commented Jul 8, 2015

I think I just fixed a bug related to js-doc and arrow functions.
Could be related: #2938

@nzakas

This comment has been minimized.

Copy link
Member

commented Jul 9, 2015

We've seen this in a few places - we just need to consider non-BlockStatement bodies to be equivalent to return

@nzakas nzakas added bug rule accepted and removed triage labels Jul 9, 2015

@mysticatea

This comment has been minimized.

Copy link
Member

commented Jul 10, 2015

I will try to fix this.

@nzakas nzakas closed this in 5193807 Jul 10, 2015

nzakas added a commit that referenced this issue Jul 10, 2015

Merge pull request #2968 from mysticatea/valid-jsdoc/return-of-arrow-…
…function-expression

Fix: `valid-jsdoc` counts `return` for arrow expressions (fixes #2952)

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.