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

Lint default param/property values and @default/@defaultvalue #473

Closed
brettz9 opened this issue Jan 7, 2020 · 1 comment · Fixed by #650
Closed

Lint default param/property values and @default/@defaultvalue #473

brettz9 opened this issue Jan 7, 2020 · 1 comment · Fixed by #650

Comments

@brettz9
Copy link
Collaborator

brettz9 commented Jan 7, 2020

Although the default values as used on jsdoc.app do not necessarily point to valid JavaScript as a default value, e.g., "somebody=John Doe" at https://jsdoc.app/tags-param.html , I favor using standard JavaScript, e.g.,

/**
* @param [aName="a default string"] The param description starts here
* @param [aName=new Map()] Another param description
*/

Likewise for @property (the docs don't show defaults as possible, but they do show optional properties, and it makes sense to be present, especially when @property accompanies @typedef).

I think one should be able to enforce that valid JavaScript is used for a default value, and can be linted (even if, as with @example, one may use overrides to be able to provide specific rules, e.g., not reporting no-unused-expressions).

This rule could also lint @default/@defaultvalue when a value was present.

@brettz9 brettz9 changed the title Lint default values Lint default param/property values and @default/@defaultvalue Jan 9, 2020
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Oct 15, 2020
brettz9 added a commit that referenced this issue Oct 19, 2020
@gajus
Copy link
Owner

gajus commented Oct 19, 2020

🎉 This issue has been resolved in version 30.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants