Skip to content

Commit

Permalink
test: demo checking for empty name
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jun 25, 2023
1 parent 467441b commit 4afc8e6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/rules/match-name.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ function quux () {}
*/
// "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^opt_/i","replacement":""}]}]
// Message: Only allowing names not matching `/^opt_/i` but found "opt_a".

/**
* @template
*/
// "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^$/","tags":["template"]}]}]
// Message: Only allowing names not matching `/^$/u` but found "".
````


Expand Down
25 changes: 25 additions & 0 deletions test/rules/assertions/matchName.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,31 @@ export default {
*/
`,
},
{
code: `
/**
* @template
*/
`,
errors: [
{
line: 3,
message: 'Only allowing names not matching `/^$/u` but found "".',
},
],
options: [
{
match: [
{
disallowName: '/^$/',
tags: [
'template',
],
},
],
},
],
},
],
valid: [
{
Expand Down

0 comments on commit 4afc8e6

Please sign in to comment.