diff --git a/docs/rules/reject-any-type.md b/docs/rules/reject-any-type.md index 35805f8b8..f0c29cc6b 100644 --- a/docs/rules/reject-any-type.md +++ b/docs/rules/reject-any-type.md @@ -27,11 +27,23 @@ The following patterns are considered problems: function quux () {} // Message: Prefer a more specific type to `any` +/** + * @param {*} abc + */ +function quux () {} +// Message: Prefer a more specific type to `*` + /** * @param {string|Promise} abc */ function quux () {} // Message: Prefer a more specific type to `any` + +/** + * @param {Array<*>|number} abc + */ +function quux () {} +// Message: Prefer a more specific type to `*` ```` diff --git a/test/rules/assertions/rejectAnyType.js b/test/rules/assertions/rejectAnyType.js index 6dc033a4c..29dc8de2b 100644 --- a/test/rules/assertions/rejectAnyType.js +++ b/test/rules/assertions/rejectAnyType.js @@ -14,6 +14,20 @@ export default { }, ], }, + { + code: ` + /** + * @param {*} abc + */ + function quux () {} + `, + errors: [ + { + line: 3, + message: 'Prefer a more specific type to `*`', + }, + ], + }, { code: ` /** @@ -28,6 +42,20 @@ export default { }, ], }, + { + code: ` + /** + * @param {Array<*>|number} abc + */ + function quux () {} + `, + errors: [ + { + line: 3, + message: 'Prefer a more specific type to `*`', + }, + ], + }, ], valid: [ {