Skip to content

check-line-alignment with option postHyphen adds white space at end of line #983

@thernstig

Description

@thernstig

Expected behavior

I would expect the rule check-line-alignment with option postHyphens to not add white space at end of line, if there only is an end of line character at the end of the string after the hyphen.

Actual behavior

ESLint sample below shows it best.

ESLint Config

{
  "root": true,
  "reportUnusedDisableDirectives": true,
  "parserOptions": {
    "ecmaVersion": 2023,
    "sourceType": "module"
  },
  "env": {
    "node": true,
    "es2022": true
  },
  "extends": ["plugin:jsdoc/recommended"],
  "plugins": ["unicorn"],
  "rules": {
    "jsdoc/require-jsdoc": "off",
    "jsdoc/require-description": "warn",
    "jsdoc/check-syntax": "warn",
    "jsdoc/check-line-alignment": ["warn", "never"],
    "jsdoc/require-hyphen-before-param-description": [
      "warn",
      "always",
      { "tags": { "property": "always" } }
    ],
    "jsdoc/require-asterisk-prefix": "warn",
    "jsdoc/tag-lines": "off", // TODO: Temporary, will be fixed soon
    "jsdoc/no-bad-blocks": ["warn", { "preventAllMultiAsteriskBlocks": true }]
  },
  "settings": {
    "jsdoc": {
      "mode": "typescript"
    }
  }
}

ESLint sample

Before linting

   * @param {string|string[]|TemplateResult|TemplateResult[]} event.detail.description -
   *    Notification description

After linting with --fix

Notice the white space directly after the -.

   * @param {string|string[]|TemplateResult|TemplateResult[]} event.detail.description - 
   *    Notification description

Environment

  • Node version: v18.12.1
  • ESLint version v8.31.0
  • eslint-plugin-jsdoc version: 39.8.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions