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
Why doesn't jsdoc/check-param-names check for property defaults? #676
Comments
Can you please paste a minimal code example instead of a screenshot? Thanks... |
Here an js code: /**
* Returns a number.
* @param {Object} props Props.
* @param {Object} props.prop Prop.
* @param {string} props.prop.a String.
* @param {string} props.prop.b String.
* @param {string} props.prop.c String.
* @return {number} A number.
*/
export function testFn1 ({ prop = { a: 1, b: 2, c: 3 } }) {
return [prop.a, prop.b, prop.c].map(Number).reduce((i, j) => i + j) + 123;
} There is no destructure of but how can i allow to specify fields which are not specified explicitly during destructuring |
Yeah, we don't currently allow treating a default as something to examine for its properties. For that I would have a typedef, such as: /**
* @typedef {Object} PropObj
* @property {string} a String.
* @property {string} b String.
* @property {string} c String.
*/
/**
* Returns a number.
* @param {Object} props Props.
* @param {PropObj} props.prop Prop.
* @return {number} A number.
*/ Otherwise, you'd have to either set Admittedly, in your particular type of case, it is possible we could add code to look through the default object properties (which is different from destructuring) and allow those, so we can leave this issue as a feature request if you like. |
Thank you @brettz9 |
…ctProperties for expecting documentation or avoiding reporting of documented; addresses gajus#676
…ctProperties` for expecting documentation or avoiding reporting of documented; addresses part of gajus#676
…ctProperties` for expecting documentation or avoiding reporting of documented; addresses part of gajus#676
I think now there actually a couple action items out of this to which we can add as options:
|
…ctProperties` for expecting documentation or avoiding reporting of documented; addresses part of gajus#676
…ctProperties` for expecting documentation or avoiding reporting of documented; addresses part of gajus#676
…ctProperties` for expecting documentation or avoiding reporting of documented; addresses part of gajus#676
…ctProperties` for expecting documentation or avoiding reporting of documented; addresses part of #676
🎉 This issue has been resolved in version 31.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi, rule
jsdoc/check-param-names
throws an error with destruture prop andHere an example of code:
it causes errors iin terminal:
how can i allow to specify fields which are not specified explicitly during destructuring?
The text was updated successfully, but these errors were encountered: