Skip to content

Commit 8c270b3

Browse files
authored
test(reject-any-type): cover asterisk (#1523)
1 parent 3951bca commit 8c270b3

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

docs/rules/reject-any-type.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,23 @@ The following patterns are considered problems:
2727
function quux () {}
2828
// Message: Prefer a more specific type to `any`
2929

30+
/**
31+
* @param {*} abc
32+
*/
33+
function quux () {}
34+
// Message: Prefer a more specific type to `*`
35+
3036
/**
3137
* @param {string|Promise<any>} abc
3238
*/
3339
function quux () {}
3440
// Message: Prefer a more specific type to `any`
41+
42+
/**
43+
* @param {Array<*>|number} abc
44+
*/
45+
function quux () {}
46+
// Message: Prefer a more specific type to `*`
3547
````
3648

3749

test/rules/assertions/rejectAnyType.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ export default {
1414
},
1515
],
1616
},
17+
{
18+
code: `
19+
/**
20+
* @param {*} abc
21+
*/
22+
function quux () {}
23+
`,
24+
errors: [
25+
{
26+
line: 3,
27+
message: 'Prefer a more specific type to `*`',
28+
},
29+
],
30+
},
1731
{
1832
code: `
1933
/**
@@ -28,6 +42,20 @@ export default {
2842
},
2943
],
3044
},
45+
{
46+
code: `
47+
/**
48+
* @param {Array<*>|number} abc
49+
*/
50+
function quux () {}
51+
`,
52+
errors: [
53+
{
54+
line: 3,
55+
message: 'Prefer a more specific type to `*`',
56+
},
57+
],
58+
},
3159
],
3260
valid: [
3361
{

0 commit comments

Comments
 (0)