首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tslint错误: jsdoc中的Asterik必须对齐

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

Stack Overflow用户
提问于 2016-10-12 06:56:24
回答 4查看 8.7K关注 0票数 6

我一直收到这个tslint错误,看不出代码有什么问题。有没有人看到下面的jsdoc星号没有正确对齐的问题:

代码语言:javascript
复制
/**
 * @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>
 */

几乎下面的每一行都给了我同样的错误。

EN

回答 4

Stack Overflow用户

发布于 2017-06-03 05:05:56

jsdoc-format规则说明:

对JSDoc注释(以/**开头的注释)强制执行以下规则:

  • 每行都包含一个星号,并且星号必须对齐
  • 每个星号后面必须跟一个空格或换行符(第一行和最后一行除外)
  • 每行星号前的字符只能是空格字符
  • 一行注释必须以/**开头,以*/

结束

就像我从你的comment上看到的,你有间距问题。

票数 4
EN

Stack Overflow用户

发布于 2021-04-16 02:06:39

在我的Angular 9项目中,我能够得到lint错误

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

从…

代码语言:javascript
复制
/**
 *
 */

固定

代码语言:javascript
复制
/*
*
*/

不知道为什么,因为多行注释的js-doc rule说明它需要两个星号。

票数 4
EN

Stack Overflow用户

发布于 2020-08-11 12:18:37

尽管看起来对齐星星不是你的问题,但我只是做了这个小脚本来修复你所有的打字文件:https://github.com/Marr11317/starAligner

希望一些人会发现它是有帮助的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39988028

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档