tslint error: Asterik in jsdoc must be aligned
Asked Answered
A

4

9

I keep getting this tslint error and don't see what's wrong with the code. Does anybody see an issues with the jsdoc asteriks below not being aligned correctly:

/**
 * @ngdoc directive
 * @module ers.components.button
 * @scope
 * @transclude
 * @data
 * @binding
 * @name ersButton
 * @restrict E
 * @constructor
 * 
 * @description
 * 
 * A button performs the defined action when the user clicks it.
 * 
 * - Buttons can only consist of text and/or an icon.
 * - Buttons must contain either a click event, an href, an ui-sref, or a type (for form actions).
 * - Buttons labels should be clear. Limit the button text (less is more).
 * 
 * ### Usage
 * 
 * - Use <b>Primary Buttons</b> for primary actions (for example, "Submit", "Login", or "Save"). 
 * Avoid having multiple primary buttons on the same screen.
 * - Use <b>Secondary Buttons</b> for secondary actions that accompany the primary call-to-action (for example, "Reset" or "Cancel").
 * - Use <b>Icon Buttons</b> only for special use cases where standard label buttons are too large to use (for example, Tool Bars).
 *   
 * ### Examples
 * 
 * #### Standard Buttons
 * 
 * Primary and secondary buttons.
 *
 * <code-editor identifier="example1" data-title="Basic Buttons" html-content-url="demos/ersButton/basic/index.html" 
 * js-content-url="demos/ersButton/basic/script.js" css-content-url="demos/ersButton/basic/styles.css" 
 * content-mode="html"></code-editor>
 */

Just about every line below is giving me that same error.

Annapurna answered 11/10, 2016 at 22:56 Comment(2)
Your markdown has a mix of tabs and spaces and the asterisks don't appear be be aligned in the markdown. What's enforced by the jsdoc-format rule is described here,Scrofulous
Yea there must have been some spacing issues that was throwing it off. I ended up just deleting all of it and typing it over again and it passed the linter. ThanksAnnapurna
L
7

In my Angular 9 project I was able to get the lint error

filename.ts:13:1 - asterisks in jsdoc must be aligned

from

/**
 *
 */

fixed

/*
*
*/

Not sure why because the js-doc rule for multiline comments says it requires two asterisks.

Lidstone answered 15/4, 2021 at 18:6 Comment(0)
B
4

From jsdoc-format rule description:

The following rules are enforced for JSDoc comments (comments starting with /**):

  • each line contains an asterisk and asterisks must be aligned
  • each asterisk must be followed by either a space or a newline (except for the first and the last)
  • the only characters before the asterisk on each line must be whitespace characters
  • one line comments must start with /** and end with */

As I see from your comment you had spacing issues.

Byyourleave answered 2/6, 2017 at 21:5 Comment(1)
so what's the problem in question ?Varve
I
2

I had the same issue:

error:

/**
*
*
* 
*/

fix:

/**
 *
 *
 * 
 */
Indigestible answered 27/9, 2021 at 7:17 Comment(0)
O
0

Even though it looks like aligning the stars wasn't your issue, I just made this little script to fix all your typescript files: https://github.com/Marr11317/starAligner.

With the hope that some people will find it helpful...

Osbert answered 11/8, 2020 at 4:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.