Skip to content

eslint-plugin-tsdoc: allow policies to be ignored in tsdoc/syntax rule #220

Open
@bitjson

Description

@bitjson

Now that less-strict parsing for @param tags is merged (#128), I'd love to be able to loosen the requirements of the tsdoc/syntax rule to allow for certain deviations from the expected syntax.

Primarily, VSCode's built-in JSDoc support automatically adds a doc comment where each @param tag is followed immediately by a description, without the expected hyphen. With the following .eslintrc configuration:

{
  rules: {
    'tsdoc/syntax': 'warn'
  }
}

This snippet is valid:

/**
 * Description
 * @param a - first number
 * @param b - second number
 */
const add = (a: number, b: number) => a + b;

While this snippet:

/**
 * Description
 * @param a first number
 * @param b second number
 */
const add = (a: number, b: number) => a + b;

Warns with the following:

tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen eslint(tsdoc/syntax)

I'd love to be able to ignore this particular syntax deviation with something like:

{
  rules: {
    'tsdoc/syntax': ['warn', ignore: ['tsdoc-param-tag-missing-hyphen'] ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: mediumNeeds a somewhat experienced developerenhancementThe issue is asking for a new feature or design change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions