gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.1k stars 160 forks source link

:bug: require-hyphen-before-param-description places hyphen in the wrong place on multiline types #1324

Closed scagood closed 1 month ago

scagood commented 1 month ago

Code sample -- Before '--fix'

/**
 * @param {(
 *  | string
 *  | number
 * )} input The input value
 */
function test(input) {}

Expected behavior -- After '--fix'

/**
 * @param {(
 *  | string
 *  | number
 * )} input - The input value
 */
function test(input) {}

Actual behavior -- After '--fix'

/**
 * @param {(- - - - - - - - - - 
 *  | string
 *  | number
 * )} input The input value
 */
function test(input) {}

ESLint Config

import jsdoc from 'eslint-plugin-jsdoc';

export default [
  {
    plugins: { jsdoc },
    rules: {
      'jsdoc/require-hyphen-before-param-description': 'warn'
    }
  }
];

Reproduction

To reproduce, click 'Apply Fix' on the src/example.js file.

https://eslint-online-playground.netlify.app/#eNpVULtygzAQ/JUbNdiMgR43KfIJ6aIUsjhAjjgpejjOEP49SODMuDlpb1fa25uZd7LBu5isxvrqWcuasuQEJbxY4cQE8yEj+AUfnKLhgShOF3QZHRdQZGOAtxH3203oiIlsOPWRZFCGIKAPh8wfYV7YiaHXikItDfVqqKdsryZrXICr74yE3pkJik1WWR0HRVVmijMnTnjP2g57EXWA99UQ5lQANrFvYd6/Wk4b4aLG1N4QQJHpxuFXVA6r8ceOSNUFe7OivIKqQy+dsilD0ULxLRwV2/MlHWv5OK9prJCfYkhbNLQGyQ6cdXh7RYvUIUmFnrN/b77nTy3OtEjr4Wwf80E+pX5W7t4LW/4AYsCY3A==

brettz9 commented 1 month ago

Fixed by #1325 . Released in v50.3.2. Thanks for the report!

scagood commented 1 month ago

Thanks @brettz9!