coffeelint-multiple-callback
Coffeelint rule that checks for callbacks being called multiple times
Last updated 4 years ago by srgraham .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install coffeelint-multiple-callback 
SYNC missed versions from official npm registry.

coffeelint-multiple-callback

CoffeeLint rule that finds instances where callbacks might be called more than once or not at all.

This code is in the very early stages of development. If you find cases where it's broken, please add example test fixtures. For lines in tests that should trigger an error, add the comment # HIT to the end of the line. The tests go through line by line and verify that lines with that comment trigger a linting error and all other lines do not.

Examples

These functions have the potential of calling cb() multiple times, and is likely an error:

badFunc = (err, cb)->
  cb err
  cb err # BAD
  return
badIf = (err, cb)->
  if err
    cb err

  cb null # BAD
  return

These functions are okay, since they only call the callback once no matter how the logic runs:

goodIf = (err, cb)->
  if err
    cb err
  else
    cb null
  return
goodIf2 = (err, cb)->
  if err
    cb err
    return

  cb null
  return

Installation

npm install coffeelint-multiple-callback

Usage

Add the following configuration to coffeelint.json:

"multiple_callback": {
  "module": "coffeelint-multiple-callback"
}

Configuration

There are currently no configuration options.

Contributing

I don't know what I'm doing. I just jumped in with an idea and tried to get it to work. Please assist if this is something you understand or have ideas on how to handle this better.

Current Tags

  • 0.0.7                                ...           latest (4 years ago)

7 Versions

  • 0.0.7                                ...           4 years ago
  • 0.0.6                                ...           4 years ago
  • 0.0.5                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 0
Last Month 6
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |