diff --git a/README.md b/README.md index 8382ebb88..376d36d96 100644 --- a/README.md +++ b/README.md @@ -2338,6 +2338,17 @@ const fn = ( lorem, sit ) => {} const fn = ( lorem, sit ) => {} // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"customSpacings":{"postName":3}}] // Message: Expected JSDoc block lines to not be aligned. + + + /** + * Function description. + * + * @param {string} lorem Description. + * @param {int} sit Description multi words. + */ + const fn = ( lorem, sit ) => {} +// "jsdoc/check-line-alignment": ["error"|"warn", "always"] +// Message: Expected JSDoc block lines to be aligned. ```` The following patterns are not considered problems: @@ -2593,6 +2604,16 @@ const fn = ( lorem, sit ) => {} */ const fn = ({ids}) => {} // "jsdoc/check-line-alignment": ["error"|"warn", "always"] + + + /** + * Function description. + * + * @param {string} lorem Description. + * @param {int} sit Description multi words. + */ + const fn = ( lorem, sit ) => {} +// "jsdoc/check-line-alignment": ["error"|"warn", "always"] ```` diff --git a/package.json b/package.json index ee5f1ebc2..432497cc7 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "url": "http://gajus.com" }, "dependencies": { - "@es-joy/jsdoccomment": "^0.8.0", - "comment-parser": "1.1.5", + "@es-joy/jsdoccomment": "^0.9.0-alpha.1", + "comment-parser": "1.1.6-beta.0", "debug": "^4.3.2", "esquery": "^1.4.0", "jsdoc-type-pratt-parser": "^1.0.4", diff --git a/src/alignTransform.js b/src/alignTransform.js index 99f84c65a..f981f4a53 100644 --- a/src/alignTransform.js +++ b/src/alignTransform.js @@ -169,7 +169,7 @@ const alignTransform = ({ if (!intoTags) { if (tokens.description === '') { - tokens.postDelimiter = ''; + tokens.postDelimiter = tokens.postDelimiter === '\r' ? '\r' : ''; } else if (!preserveMainDescriptionPostDelimiter) { tokens.postDelimiter = ' '; } diff --git a/test/rules/assertions/checkLineAlignment.js b/test/rules/assertions/checkLineAlignment.js index 619911ea3..51e81d849 100644 --- a/test/rules/assertions/checkLineAlignment.js +++ b/test/rules/assertions/checkLineAlignment.js @@ -1057,6 +1057,36 @@ export default { const fn = ( lorem, sit ) => {} `, }, + { + code: `\r + /**\r + * Function description.\r + *\r + * @param {string} lorem Description.\r + * @param {int} sit Description multi words.\r + */\r + const fn = ( lorem, sit ) => {}\r + `, + errors: [ + { + line: 2, + message: 'Expected JSDoc block lines to be aligned.', + type: 'Block', + }, + ], + options: [ + 'always', + ], + output: `\r + /**\r + * Function description.\r + *\r + * @param {string} lorem Description.\r + * @param {int} sit Description multi words.\r + */\r + const fn = ( lorem, sit ) => {}\r + `, + }, ], valid: [ { @@ -1446,5 +1476,17 @@ export default { `, options: ['always'], }, + { + code: `\r + /**\r + * Function description.\r + *\r + * @param {string} lorem Description.\r + * @param {int} sit Description multi words.\r + */\r + const fn = ( lorem, sit ) => {}\r + `, + options: ['always'], + }, ], };