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.
New rules should be set to a
warnlevel. 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
Look at existing rules and test structures when deciding how to name your rule.
no_foo.coffeeis used for many tests designed to catch specific errors, whereas
foo.coffeeis used for tests that are designed to enforce formatting and syntax.
- Fork the repo locally.
npm installto get dependencies.
- 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/.
- Add your test file
- Register your rule in
- Run your test using
npm run testrule test/your_test_here.coffee.
- Run the whole tests suite using
- Check that your rule's documentation is generated properly (see Updating documentation when adding a new rule below).
- Squash all commits into a single commit when done.
- Submit a pull request.
Updating documentation when adding a new rule
When adding a new rule, its documentation is specified by setting a
description property within its
module.exports =rule:name: 'no_comment'level: 'ignore'message: 'No comment'description: '''Disallows any comment in the code'''tokens: '#''###':return context: "Found ''"
The description property is a string that can embed HTML code:
description: '''Disallows any comment in the code. This code would not pass:### Some code with commentsfoo = -># some other commentsbar()'''
Coffeelint's website generates each
rule's documentation based on this
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.
npm run compile.
- Checkout the
git checkout origin/gh-pages.
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.htmlfile with your favorite browser and make sure that your rule's documentation is generated properly.