咖啡壶
CoffeeLint 是帮助保留 CoffeeScript 代码的样式检查器 干净而一致.
关于安装、使用和配置 CoffeeLint 的指南,头部 这里。 。 。 .
建议一个功能,报告错误,或一般性讨论, 头朝前 这里。 。 。 .
团队
当前 :
过去 :
捐款
-
新的规则应订为
warn级别。 开发者会期望新的修改不会打破他们现有的工作流程, 因此除非您的修改非常有用, 默认为warn。如果选择使用,则期待讨论error。 。 。 . -
在决定如何命名你的规则时,看看现有的规则和测试结构.
no_foo.coffee用于许多旨在捕捉特定错误的测试,而foo.coffee用于执行格式化和语法的测试.
步骤
- 以地为叉取还.
- 运行
npm install获取依赖. - 在单个文件中创建规则为
src/rules/your_rule_here.coffee,使用现有的 规则作为指南。 您可以使用 https://asaayers.github.io/clfiddle/ 页面存档备份,存于互联网档案馆。 。 。 . - 添加您的测试文件
my_test.coffee页:1test目录. - 登记您的规则
src/coffeelint.coffee。 。 。 . - 使用
npm run testrule test/your_test_here.coffee。 。 。 . - 使用
npm test。 。 。 . - 提交拉动请求 .
新增规则时更新文件
添加新规则时,其文档通过设置
description 其内部财产 rule 属性 :
module.exports = class NoComment
rule:
name: 'no_comment'
level: 'ignore'
message: 'No comment'
description: '''
Disallows any comment in the code
'''
tokens: ['#', '###']
lintToken : (token, tokenApi) ->
return {context: "Found '#{token[0]}'"}
描述属性是一个可以嵌入 HTML 代码的字符串 :
description: '''
Disallows any comment in the code. This code would not pass:
<pre>
<code>### Some code with comments
foo = ->
# some other comments
bar()
</code>
</pre>
'''
咖啡林网站 生成每个
规则的文档基于此 description 属性.