microsoft / tsdoc

A doc comment standard for TypeScript
https://tsdoc.org/
MIT License
4.7k stars 130 forks source link

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

Open oliverlietz opened 2 years ago

oliverlietz commented 2 years ago

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 commented 2 years ago

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

cpmsmith commented 1 year ago

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.