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 failed on property getter setter without a return #2407

Closed
madcapnmckay opened this issue Apr 28, 2015 · 5 comments · Fixed by DavidKindler/meteor#3 · May be fixed by iamstoick/javascript#11
Closed

valid-jsdoc failed on property getter setter without a return #2407

madcapnmckay opened this issue Apr 28, 2015 · 5 comments · Fixed by DavidKindler/meteor#3 · May be fixed by iamstoick/javascript#11
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@madcapnmckay
Copy link

I'm receiving an error for the below code

/**
 * The current document location
 * @type {string}
 */
get location() {
    return this._location;
},
set location(value) {
    this._location = value;
}

Getters and setters are not particularly well supported or documented by jsdoc but from reading around the most commonly recommended way to document them is with one doclet and a single @type tag.

This failing because of the lack of a @return tag.

@madcapnmckay
Copy link
Author

I should add that I tried to turn off require return with

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

And this option doesn't seem to work either.

@nzakas nzakas added the triage An ESLint team member will look at this issue soon label Apr 28, 2015
@nzakas
Copy link
Member

nzakas commented Apr 28, 2015

This is interesting. Getters and setters look like functions, so the rule is expected them to be documented them that way. Can you point to some documentation about the @type recommendation?

@madcapnmckay
Copy link
Author

These are the most recent examples I can find.

jsdoc/jsdoc#973
https://github.com/jsdoc3/jsdoc/blob/4b8504cac96fee3cf739be6974917827c92bedad/test/fixtures/getset2.js

There was definitely some churn on this before literal get/set was in common use, but this does seem to be the way that it is expected to be tagged.

@gyandeeps
Copy link
Member

@nzakas looks like we need to make n update to the rule to account for getter/setter scenario?

@nzakas
Copy link
Member

nzakas commented Jun 22, 2015

Yup

@nzakas nzakas added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Jun 22, 2015
nzakas added a commit that referenced this issue Jun 23, 2015
Fix: valid-jsdoc to work for object getters (fixes #2407)
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
3 participants