Skip to content

Commit 2d88738

Browse files
committed
testing(check-param-names, require-param): add failing examples for typescript properties
1 parent 2cf9cfa commit 2d88738

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

test/rules/assertions/checkParamNames.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,25 @@ export default {
172172
message: 'Duplicate @param "foo"'
173173
}
174174
]
175+
},
176+
{
177+
code: `
178+
export class SomeClass {
179+
/**
180+
* @param prop
181+
*/
182+
constructor(private property: string) {}
183+
}
184+
`,
185+
errors: [
186+
{
187+
message: 'Expected @param names to be "property". Got "prop".'
188+
}
189+
],
190+
parser: join(__dirname, '../../../node_modules', '@typescript-eslint/parser'),
191+
parserOptions: {
192+
sourceType: 'module'
193+
}
175194
}
176195
],
177196
valid: [

test/rules/assertions/requireParam.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,25 @@ export default {
218218
message: 'Missing JSDoc @param "foo" declaration.'
219219
}
220220
]
221+
},
222+
{
223+
code: `
224+
export class SomeClass {
225+
/**
226+
* @param property
227+
*/
228+
constructor(private property: string, private foo: number) {}
229+
}
230+
`,
231+
errors: [
232+
{
233+
message: 'Missing JSDoc @param "foo" declaration.'
234+
}
235+
],
236+
parser: join(__dirname, '../../../node_modules', '@typescript-eslint/parser'),
237+
parserOptions: {
238+
sourceType: 'module'
239+
}
221240
}
222241
],
223242
valid: [

0 commit comments

Comments
 (0)