File tree 4 files changed +76
-7
lines changed
4 files changed +76
-7
lines changed Original file line number Diff line number Diff line change @@ -665,6 +665,22 @@ export interface B {
665
665
methodB (paramB : string ): void
666
666
};
667
667
// Message: Expected @param names to be "paramB". Got "paramA".
668
+
669
+ interface A {
670
+ /**
671
+ * @param params Values for the placeholders
672
+ */
673
+ getText (key: string, ... params: string[]): string
674
+ }
675
+ // Message: Expected @param names to be "key, ...params". Got "params".
676
+
677
+ /**
678
+ * @param arg Arg
679
+ */
680
+ export function fn (... [type , arg ]: FnArgs ): void {
681
+ // ...
682
+ }
683
+ // Message: Expected @param name to be "type". Got "arg".
668
684
````
669
685
670
686
@@ -1095,5 +1111,13 @@ function quux (foo, bar) {
1095
1111
function quux (foo , bar ) {
1096
1112
}
1097
1113
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
1114
+
1115
+ /**
1116
+ * @param type Type
1117
+ * @param arg Arg
1118
+ */
1119
+ export function fn (... [type , arg ]: FnArgs ): void {
1120
+ // ...
1121
+ }
1098
1122
` ` ` `
1099
1123
Original file line number Diff line number Diff line change @@ -1151,6 +1151,17 @@ class A {
1151
1151
}
1152
1152
// "jsdoc/require-param": ["error"|"warn", {"contexts":["MethodDefinition"]}]
1153
1153
// Message: Missing JSDoc @param "btnState" declaration.
1154
+
1155
+ class A {
1156
+ /**
1157
+ * @param root0
1158
+ * @param root0.foo
1159
+ */
1160
+ quux ({ foo }, { bar }) {
1161
+ console .log (foo, bar);
1162
+ }
1163
+ }
1164
+ // Message: Missing JSDoc @param "root1" declaration.
1154
1165
````
1155
1166
1156
1167
Original file line number Diff line number Diff line change @@ -220,10 +220,10 @@ export default iterateJsdoc(({
220
220
functionParameterIdx ,
221
221
functionParameterName ,
222
222
] of functionParameterNames . entries ( ) ) {
223
+
223
224
let inc ;
224
225
if ( Array . isArray ( functionParameterName ) ) {
225
- const matchedJsdoc = shallowJsdocParameterNames [ functionParameterIdx - thisOffset ] ||
226
- jsdocParameterNames [ functionParameterIdx - thisOffset ] ;
226
+ const matchedJsdoc = shallowJsdocParameterNames [ functionParameterIdx - thisOffset ] ;
227
227
228
228
/** @type {string } */
229
229
let rootName ;
@@ -237,12 +237,12 @@ export default iterateJsdoc(({
237
237
} else {
238
238
rootName = nextRootName ;
239
239
inc = incremented ;
240
- [
241
- nextRootName ,
242
- incremented ,
243
- namer ,
244
- ] = namer ( ) ;
245
240
}
241
+ [
242
+ nextRootName ,
243
+ incremented ,
244
+ namer ,
245
+ ] = namer ( ) ;
246
246
247
247
const {
248
248
hasRestElement,
Original file line number Diff line number Diff line change @@ -2493,6 +2493,40 @@ export default {
2493
2493
parser : typescriptEslintParser
2494
2494
} ,
2495
2495
} ,
2496
+ {
2497
+ code : `
2498
+ class A {
2499
+ /**
2500
+ * @param root0
2501
+ * @param root0.foo
2502
+ */
2503
+ quux({ foo }, { bar }) {
2504
+ console.log(foo, bar);
2505
+ }
2506
+ }
2507
+ ` ,
2508
+ errors : [
2509
+ {
2510
+ message : 'Missing JSDoc @param "root1" declaration.' ,
2511
+ } ,
2512
+ {
2513
+ message : 'Missing JSDoc @param "root1.bar" declaration.' ,
2514
+ }
2515
+ ] ,
2516
+ output : `
2517
+ class A {
2518
+ /**
2519
+ * @param root0
2520
+ * @param root0.foo
2521
+ * @param root1
2522
+ * @param root1.bar
2523
+ */
2524
+ quux({ foo }, { bar }) {
2525
+ console.log(foo, bar);
2526
+ }
2527
+ }
2528
+ ` ,
2529
+ } ,
2496
2530
] ,
2497
2531
valid : [
2498
2532
{
You can’t perform that action at this time.
0 commit comments