JSPM

coffeelint-callback-handle-error

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q36040F
  • License MIT

Coffeelint rule finds instances of error objects passed through a callback not being handled

Package Exports

  • coffeelint-callback-handle-error

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (coffeelint-callback-handle-error) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

coffeelint-callback-handle-error

CoffeeLint rule that finds instances of error objects passed through a callback not being handled. Error variables are determined with regex and must match this heregex:

///
  (^err(or)?$)
  | (_err(or)?$)
  | (^err(or)?_)
///i

Ex: Any of these code blocks do not handle their error variable:

fs.stat '/invalid/path/to/file', (err, stats)->
  console.log stats
  return
fs.stat '/invalid/path/to/file', (err, stats)->
  # this err is not handled and is instead overwritten by the next stat

  fs.stat '/some/other/invalid/file', (err, stats2)->
    if err
      console.log err
    return
  return

These examples will pass, since their error variables are handled:

fs.stat '/invalid/path/to/file', (err, stats)->
  if err
    console.log err
  return
doStuff 123, (callback)->
  fs.stat '/invalid/path/to/file', (err, stats)->
    callback err
    return
  return

Installation

npm install coffeelint-callback-handle-error

Usage

Add the following configuration to coffeelint.json:

"callback_handle_error": {
  "module": "coffeelint-callback-handle-error"
}

Configuration

There are currently no configuration options.