简体   繁体   English

tslint 错误:jsdoc 中的 Asterik 必须对齐

[英]tslint error: Asterik in jsdoc must be aligned

I keep getting this tslint error and don't see what's wrong with the code.我不断收到此 tslint 错误,但看不到代码有什么问题。 Does anybody see an issues with the jsdoc asteriks below not being aligned correctly:有没有人看到下面的 jsdoc 星号没有正确对齐的问题:

/**
 * @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.下面几乎每一行都给我同样的错误。

From jsdoc-format rule description:来自jsdoc-format规则描述:

The following rules are enforced for JSDoc comments (comments starting with /**): JSDoc 注释(以 /** 开头的注释)强制执行以下规则:

  • 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.正如我从您的评论中看到的,您有间距问题。

I had the same issue:我遇到过同样的问题:

error:错误:

/**
*
*
* 
*/

fix:使固定:

/**
 *
 *
 * 
 */

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 .尽管看起来对齐星星不是您的问题,但我只是制作了这个小脚本来修复您的所有打字稿文件: https : //github.com/Marr11317/starAligner

With the hope that some people will find it helpful...希望有些人会发现它有帮助......

In my Angular 9 project I was able to get the lint error在我的 Angular 9 项目中,我得到了 lint 错误

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.不知道为什么,因为多行注释的js-doc 规则说它需要两个星号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM