Skip to content

Commit 183d6c1

Browse files
committed
test: demo checking for empty name
1 parent 418f22d commit 183d6c1

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

docs/rules/match-name.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ function quux () {}
178178
*/
179179
// "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^opt_/i","replacement":""}]}]
180180
// Message: Only allowing names not matching `/^opt_/i` but found "opt_a".
181+
182+
/**
183+
* @template
184+
*/
185+
// "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^$/","tags":["template"]}]}]
186+
// Message: Only allowing names not matching `/^$/u` but found "".
181187
````
182188

183189

test/rules/assertions/matchName.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,31 @@ export default {
357357
*/
358358
`,
359359
},
360+
{
361+
code: `
362+
/**
363+
* @template
364+
*/
365+
`,
366+
errors: [
367+
{
368+
line: 3,
369+
message: 'Only allowing names not matching `/^$/u` but found "".',
370+
},
371+
],
372+
options: [
373+
{
374+
match: [
375+
{
376+
disallowName: '/^$/',
377+
tags: [
378+
'template',
379+
],
380+
},
381+
],
382+
},
383+
],
384+
},
360385
],
361386
valid: [
362387
{

0 commit comments

Comments
 (0)