Skip to content

Commit 3f76c7c

Browse files
committed
fix(check-param-names, require-param): ignore TSIndexSignature; fixes #529
1 parent 3140735 commit 3f76c7c

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,16 @@ const bboxToObj = function ({x, y, width, height}) {
20662066
return {x, y, width, height};
20672067
};
20682068
// Options: [{"checkTypesPattern":"SVGRect"}]
2069+
2070+
class CSS {
2071+
/**
2072+
* Set one or more CSS properties for the set of matched elements.
2073+
*
2074+
* @param {Object} propertyObject - An object of property-value pairs to set.
2075+
*/
2076+
setCssObject(propertyObject: {[key: string]: string | number}): void {
2077+
}
2078+
}
20692079
````
20702080

20712081

src/jsdocUtils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const flattenRoots = (params, root = '') => {
5151
hasRestElement = true;
5252
}
5353
acc.push(root ? `${root}.${cur.name}` : cur.name);
54-
} else {
54+
} else if (typeof cur !== 'undefined') {
5555
rests.push(false);
5656
acc.push(root ? `${root}.${cur}` : cur);
5757
}
@@ -74,6 +74,9 @@ const getPropertiesFromPropertySignature = (propSignature): T => {
7474
return getPropertiesFromPropertySignature(member);
7575
})];
7676
}
77+
if (propSignature.type === 'TSIndexSignature') {
78+
return undefined;
79+
}
7780

7881
return propSignature.key.name;
7982
};

test/rules/assertions/checkParamNames.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,5 +948,19 @@ export default {
948948
},
949949
],
950950
},
951+
{
952+
code: `
953+
class CSS {
954+
/**
955+
* Set one or more CSS properties for the set of matched elements.
956+
*
957+
* @param {Object} propertyObject - An object of property-value pairs to set.
958+
*/
959+
setCssObject(propertyObject: {[key: string]: string | number}): void {
960+
}
961+
}
962+
`,
963+
parser: require.resolve('@typescript-eslint/parser'),
964+
},
951965
],
952966
};

0 commit comments

Comments
 (0)