Skip to content

Commit 7019d28

Browse files
committedOct 14, 2024·
feat(require-hyphen-before-param-description): ensure template will be properly stringified; fixes #1326
Note that `match-name` will now have to take into account any optional brackets and default in `allowName`
1 parent 8b5b7f7 commit 7019d28

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed
 

‎docs/rules/match-name.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,6 @@ class A {
251251
* @typedef {object} Test
252252
* @property {T} test
253253
*/
254-
// "jsdoc/match-name": ["error"|"warn", {"match":[{"allowName":"/^[A-Z]{1}$/","message":"The name should be a single capital letter.","tags":["template"]}]}]
254+
// "jsdoc/match-name": ["error"|"warn", {"match":[{"allowName":"/^\\[?[A-Z]{1}(=.*\\])$/","message":"The name should be a single capital letter.","tags":["template"]}]}]
255255
````
256256

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"url": "http://gajus.com"
66
},
77
"dependencies": {
8-
"@es-joy/jsdoccomment": "~0.48.0",
8+
"@es-joy/jsdoccomment": "~0.49.0",
99
"are-docs-informative": "^0.0.2",
1010
"comment-parser": "1.4.1",
1111
"debug": "^4.3.6",

‎pnpm-lock.yaml

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/rules/assertions/matchName.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ export default {
553553
`,
554554
options: [{
555555
match: [{
556-
allowName: "/^[A-Z]{1}$/",
556+
allowName: "/^\\[?[A-Z]{1}(=.*\\])$/",
557557
message: "The name should be a single capital letter.",
558558
tags: ["template"],
559559
}],

‎test/rules/assertions/requireHyphenBeforeParamDescription.js

+23
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,29 @@ export default {
473473
function test(input) {}
474474
`,
475475
},
476+
{
477+
code: `
478+
/**
479+
* @template [O=unknown]
480+
* @param {string} name The name of the thing.
481+
*/
482+
function test(name) {}
483+
`,
484+
errors: [
485+
{
486+
line: 4,
487+
message: 'There must be a hyphen before @param description.',
488+
},
489+
],
490+
ignoreReadme: true,
491+
output: `
492+
/**
493+
* @template [O=unknown]
494+
* @param {string} name - The name of the thing.
495+
*/
496+
function test(name) {}
497+
`,
498+
},
476499
],
477500
valid: [
478501
{

0 commit comments

Comments
 (0)
Please sign in to comment.