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

Prevent Defaults/Optional param docs #477

Closed
brettz9 opened this issue Jan 9, 2020 · 1 comment · Fixed by #478
Closed

Prevent Defaults/Optional param docs #477

brettz9 opened this issue Jan 9, 2020 · 1 comment · Fixed by #478

Comments

@brettz9
Copy link
Collaborator

brettz9 commented Jan 9, 2020

Since ES6 allows for default params, projects might not wish to track this information redundantly in jsdoc, so this rule would report any default docs like:

/**
 * @param {SomeType} [aParam='theDefault'] 
*/
function quux (aParam = 'theDefault') {
}

With an option it could also disallow optional syntax:

/**
 * @param {SomeType} [aParam] 
*/
function quux (aParam = 'theDefault') {
}

...for projects that wished all optional prams to be given a formal ES6 default.

(This rule might not be for everyone, including for the reason that default prams don't providing defaulting on non-undefined values such as null or other falsey values.)

I don't think a corresponding @property rule would be needed since there is no special ES6 for defaulting on object properties (just the usual ||).

brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Jan 9, 2020
…`@default` and optionally report optional args; fixes gajus#477
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Jan 9, 2020
…`@default` and optionally report optional args; fixes gajus#477
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Jan 9, 2020
…`@default` and optionally report optional args; fixes gajus#477
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Jan 9, 2020
…`@default` and optionally report optional args; fixes gajus#477
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Jan 9, 2020
…`@default` and optionally report optional args; fixes gajus#477
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Jan 11, 2020
…`@default` and optionally report optional args; fixes gajus#477
brettz9 added a commit that referenced this issue Jan 11, 2020
…`@default` and optionally report optional args; fixes #477
@gajus
Copy link
Owner

gajus commented Jan 11, 2020

🎉 This issue has been resolved in version 20.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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