Skip to content

Commit 3c0e3c6

Browse files
matchaigajus
authored andcommitted
fix: allow for array value props to be defined (#136)
1 parent c12b14c commit 3c0e3c6

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/rules/checkParamNames.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ const validateParameterNamesDeep = (targetTagName : string, jsdocParameterNames
3838
return true;
3939
}
4040

41-
const pathRootNodeName = jsdocParameterName.slice(0, jsdocParameterName.indexOf('.'));
41+
let pathRootNodeName = jsdocParameterName.slice(0, jsdocParameterName.indexOf('.'));
42+
43+
if (pathRootNodeName.endsWith('[]')) {
44+
pathRootNodeName = pathRootNodeName.slice(0, -2);
45+
}
4246

4347
if (pathRootNodeName !== lastRealParameter) {
4448
report('@' + targetTagName + ' path declaration ("' + jsdocParameterName + '") root node name ("' +

test/rules/assertions/checkParamNames.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,19 @@ export default {
211211
212212
}
213213
`
214+
},
215+
{
216+
code: `
217+
/**
218+
* Assign the project to a list of employees.
219+
* @param {Object[]} employees - The employees who are responsible for the project.
220+
* @param {string} employees[].name - The name of an employee.
221+
* @param {string} employees[].department - The employee's department.
222+
*/
223+
function assign (employees) {
224+
225+
};
226+
`
214227
}
215228
]
216229
};

0 commit comments

Comments
 (0)