I expect the rule jsdoc/match-name to ignore the default param passed to @template when testing the name, whether or not the value contains spaces. It works correctly when the same rules are applied on @property.
Actual behavior
Currently jsdoc/match-name fails when the default value passed to a @template contains space.
ESLint Config
"jsdoc/match-name": ["warn", {
match: [
{
allowName: "/^[A-Z]{1}$/",
message: "The name should be a single capital letter.",
tags: ["template"]
}
]
}]
/**
* @template {string} [T=typeof FOO] -> The name should be a single capital letter. eslint(jsdoc/match-name)
* @typedef {object} Test
* @property {T} test
*/
These passes:
/**
* @template {string} [T="foo"]
* @typedef {object} Test
* @property {T} test
*/
/**
* @template {string} T
* @typedef {object} Test
* @property {T} test
*/
Expected behavior
I expect the rule
jsdoc/match-name
to ignore the default param passed to@template
when testing the name, whether or not the value contains spaces. It works correctly when the same rules are applied on@property
.Actual behavior
Currently
jsdoc/match-name
fails when the default value passed to a@template
contains space.ESLint Config
Full config available here.
ESLint sample
This fails:
These passes:
Note that the space also messes up with the rule
jsdoc/require-hyphen-before-param-description
, and auto fix will do:Environment
eslint-plugin-jsdoc
version: 48.2.6