TSLint: comment must start with a space (comment-format)
来源:互联网 发布:u盘win7装mac双系统 编辑:程序博客网 时间:2024/05/16 06:42
使用AngularCli创建项目后。
TypeScript报错:
TSLint: comment must start with a space (comment-format)
注释必须从一个空格开始(comment-format)
也就是说//之后必须跟随一个空格。
TSLint是一个JavaScript验证工具,用于检测代码。
在项目下的tslint.json中定义。AngularCli自动生成的规则很严格。
如何取消这个错误?
除了按照规范在//之后加一个空格即可。
另一个方法是,tslint.json中配置,放宽检测条件。
根据错误提示最后的(comment-format),知道这个错误在tslint.json是由comment-format属性控制的。so,打开tslint.json:
"comment-format": [ true, "check-space" ],
改为false即可。
tslint所有规则:https://palantir.github.io/tslint/rules/
-----------------------------------------------------------------------------
comment-format规则:
规则:注释格式
执行单行注释的格式化规则。
合理
帮助您在代码库中保持一致,可读的风格。
配置
可以提供三个参数:
"check-space"
要求所有单行注释必须以空格开头// comment
- 请注意,对于以多个斜线开头的注释,例如
///
,忽略前导斜杠 - TypeScript 引用注释被完全忽略
- 请注意,对于以多个斜线开头的注释,例如
"check-lowercase"
要求注释的第一个非空白字符必须为小写(如果适用)。"check-uppercase"
要求注释的第一个非空白字符必须是大写(如果适用)。
可以作为最后一个参数传递的对象的异常"check-lowercase"
或"check-uppercase"
可以管理。
这个对象可以提供两个选项之一:
* `"ignore-words"` - array of strings - words that will be ignored at the beginning of the comment.* `"ignore-pattern"` - string - RegExp pattern that will be ignored at the beginning of the comment.
例子
“comment-format”:[true,“check-space”,“check-bigcase”]
“comment-format”:[true,“check-smallcase”,{“ignore-words”:[“TODO”,“HACK”]}]
“comment-format”:[true,“check-smallcase”,{“ignore-pattern”:“STD \\ w {2,3} \\ b”}]
样板
{ "type": "array", "items": { "anyOf": [ { "type": "string", "enum": [ "check-space", "check-lowercase", "check-uppercase" ] }, { "type": "object", "properties": { "ignore-words": { "type": "array", "items": { "type": "string" } }, "ignore-pattern": { "type": "string" } }, "minProperties": 1, "maxProperties": 1 } ] }, "minLength": 1, "maxLength": 4}
阅读全文
0 0
- TSLint: comment must start with a space (comment-format)
- svn 提示comment must start in the first column
- Comment
- comment
- comment
- A Comment on Comments
- Confluence 评论(Comment)
- httpclient domain must start with a dot
- urls must start with a leading slash
- The content of element type "configuration" must match "EMPTY". Children of type "comment" are not a
- #pragma comment(lib,"*.lib")
- PL/SQL 注释(Comment)
- C# 注释(Comment)规范
- ValueError: urls must start with a leading slash
- 报错:The resource name must start with a letter
- json 解析 A JSONArray text must start with '['
- The resource name must start with a letter
- comment.c
- 纯css实现div中未知尺寸图片的垂直居中
- Redis 复制、Sentinel的搭建和原理说明
- 安装完jdk7后,再安装jdk8出现的问题 has value '1.8', but '1.7' is required.
- P1281 书的复制 dp
- HeadFirstPython---------(四)第六章(定制数据对象__打包代码与数据)
- TSLint: comment must start with a space (comment-format)
- ffmpeg对mp4文件进行ts切片并生成m3u8文件
- 的、得、的用法(汉字混淆解析)
- Android调用JNI出错 java.lang.UnsatisfiedLinkError: No implementation found for的解决方法
- 浏览器内核对比
- LeetCode: Combination Sum
- 怎么用短链接做压力测试
- 主动跳入同一个坑中
- 18 linux字符设备驱动之设备号