[英]tslint error: Asterik in jsdoc must be aligned
我不斷收到此 tslint 錯誤,但看不到代碼有什么問題。 有沒有人看到下面的 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>
*/
下面幾乎每一行都給我同樣的錯誤。
來自jsdoc-format規則描述:
JSDoc 注釋(以 /** 開頭的注釋)強制執行以下規則:
- 每行包含一個星號,星號必須對齊
- 每個星號后必須跟一個空格或換行符(第一個和最后一個除外)
- 每行星號前的唯一字符必須是空白字符
- 一行注釋必須以 /** 開頭並以 */ 結尾
正如我從您的評論中看到的,您有間距問題。
我遇到過同樣的問題:
錯誤:
/**
*
*
*
*/
使固定:
/**
*
*
*
*/
盡管看起來對齊星星不是您的問題,但我只是制作了這個小腳本來修復您的所有打字稿文件: https : //github.com/Marr11317/starAligner 。
希望有些人會發現它有幫助......
在我的 Angular 9 項目中,我得到了 lint 錯誤
filename.ts:13:1 - asterisks in jsdoc must be aligned
來自
/**
*
*/
固定
/*
*
*/
不知道為什么,因為多行注釋的js-doc 規則說它需要兩個星號。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.