Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tslint error: Asterik in jsdoc must be aligned

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.

like image 575
bschmitty Avatar asked Oct 11 '16 22:10

bschmitty


3 Answers

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.

like image 134
Ben Racicot Avatar answered Sep 30 '22 05:09

Ben Racicot


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.

like image 32
mixel Avatar answered Sep 30 '22 07:09

mixel


I had the same issue:

error:

/**
*
*
* 
*/

fix:

/**
 *
 *
 * 
 */
like image 30
Saad Saif Avatar answered Sep 30 '22 06:09

Saad Saif