@fellow/coffeelint2

中文文档
2.2.6发布于 2018/02/23MITCommonJS近 30 天下载 5035

Lint your CoffeeScript v2 code

原始使用文档
文档目录4 节
  1. Team
  2. Contributing
  3. Steps
  4. Updating documentation when adding a new rule

This is the the same as the older CoffeeLint, with some changes to enable better support new CoffeeScript 2 features.

  • CJSX files (JSX-style) are fully compatible
  • All rules output column numbers as well.

CoffeeLint2

CoffeeLint is a style checker that helps keep CoffeeScript code clean and consistent.

For guides on installing, using and configuring CoffeeLint, head over here.

To suggest a feature, report a bug, or general discussion, head over here.

Team

Current:

Past:

Contributing

  • New rules should be set to a warn level. Developers will expect new changes to NOT break their existing workflow, so unless your change is extremely usefull, default to warn. Expect discussion if you choose to use error.

  • Look at existing rules and test structures when deciding how to name your rule. no_foo.coffee is used for many tests designed to catch specific errors, whereas foo.coffee is used for tests that are designed to enforce formatting and syntax.

Steps

  1. Fork the repo locally.
  2. Run npm install to get dependencies.
  3. Create your rule in a single file as src/rules/your_rule_here.coffee, using the existing rules as a guide. You may examine the AST and tokens using http://asaayers.github.io/clfiddle/.
  4. Add your test file my_test.coffee to the test directory.
  5. Register your rule in src/coffeelint.coffee.
  6. Run your test using npm run testrule test/your_test_here.coffee.
  7. Run the whole tests suite using npm test.
  8. Check that your rule's documentation is generated properly (see Updating documentation when adding a new rule below).
  9. Squash all commits into a single commit when done.
  10. Submit a pull request.

Build Status

Updating documentation when adding a new rule

When adding a new rule, its documentation is specified by setting a description property within its rule property:

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]}'"}

The description property is a string that can embed HTML code:

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>
    '''

Coffeelint's website generates each rule's documentation based on this description property.

When adding a new rule, it is suggested that you check that the documentation for your new rule is generated correctly. In order to do that, you should follow these steps:

  • Checkout the branch that contains the changes adding the new rule.
  • Run npm run compile.
  • Checkout the gh-pages branch: git checkout origin/gh-pages.
  • Run cp lib/coffeelint.js js/coffeelint.js.
  • Regenerate the HTML documentation: rake updatehtml. Note that you will probably need to install rake.
  • Open the index.html file with your favorite browser and make sure that your rule's documentation is generated properly.

版本与发布记录

@fellow/coffeelint2 共发布 7 个版本,首次发布于 2018/02/13;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.2.6latest2018/02/238 年前
2.2.52018/02/238 年前
2.2.42018/02/238 年前
2.2.32018/02/238 年前
2.2.22018/02/138 年前
2.2.12018/02/138 年前

关于 @fellow/coffeelint2 的常见问题

@fellow/coffeelint2 是什么?

Lint your CoffeeScript v2 code

如何安装 @fellow/coffeelint2?

在项目目录运行 npm install @fellow/coffeelint2,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 coffeelint,可以用 npx coffeelint 直接运行。

@fellow/coffeelint2 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fellow__coffeelint2 是否存在。

@fellow/coffeelint2 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fellow/coffeelint2 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=6.9.1。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fellow/coffeelint2 可以商用吗?

@fellow/coffeelint2 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fellow/coffeelint2 的下载量有多少?

根据 npm 官方下载统计,@fellow/coffeelint2 在 2026/10/15 – 2026/11/13 这 30 天内被下载 5,035 次,日均约 168 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fellow/coffeelint2 还在维护吗?

最新版本 2.2.6 发布于 2018/02/23(8 年前);至今共发布 7 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/02/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。