Skip to content

Commit

Permalink
fix: allow for array value props to be defined (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
matchai authored and gajus committed Dec 19, 2018
1 parent c12b14c commit 3c0e3c6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rules/checkParamNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ const validateParameterNamesDeep = (targetTagName : string, jsdocParameterNames
return true;
}

const pathRootNodeName = jsdocParameterName.slice(0, jsdocParameterName.indexOf('.'));
let pathRootNodeName = jsdocParameterName.slice(0, jsdocParameterName.indexOf('.'));

if (pathRootNodeName.endsWith('[]')) {
pathRootNodeName = pathRootNodeName.slice(0, -2);
}

if (pathRootNodeName !== lastRealParameter) {
report('@' + targetTagName + ' path declaration ("' + jsdocParameterName + '") root node name ("' +
Expand Down
13 changes: 13 additions & 0 deletions test/rules/assertions/checkParamNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,19 @@ export default {
}
`
},
{
code: `
/**
* Assign the project to a list of employees.
* @param {Object[]} employees - The employees who are responsible for the project.
* @param {string} employees[].name - The name of an employee.
* @param {string} employees[].department - The employee's department.
*/
function assign (employees) {
};
`
}
]
};

0 comments on commit 3c0e3c6

Please sign in to comment.