tsdoc icon indicating copy to clipboard operation
tsdoc copied to clipboard

tsdoc-param-tag-missing-hyphen asks for hyphen but tests for hyphen-minus

Open oliverlietz opened this issue 4 years ago • 2 comments

Example (line 10: hyphen-minus, line 11: hyphen):

/**
 * Locale representing language and region.
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale
 * @see https://github.com/microsoft/TypeScript/issues/37326
 */
export class Locale {
  /**
   *
   * @param _language - the language of the `Locale`
   * @param _region – the region of the `Locale` or `null`
   */
  constructor(private _language: string, private _region: string | null) {}
[…]
> eslint . --ext .ts


/[…]/src/locale.ts
  11:6  warning  tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen  tsdoc/syntax

✖ 1 problem (0 errors, 1 warning)

oliverlietz avatar Sep 20 '21 20:09 oliverlietz

In fact it tests for TokenKind.Hyphen which is a hyphen-minus.

oliverlietz avatar Sep 20 '21 21:09 oliverlietz

Strictly speaking the character "–" on line 11 is an en dash, not a hyphen, Unicode 2013. There is a distinct Unicode hyphen character, 2010 or "‐", which I assume would also not pass this lint rule, but hyphen-minus is definitely in far wider use, and I think most people would default to using it, if only because it's on most keyboards and in ASCII.

cpmsmith avatar Feb 07 '23 17:02 cpmsmith