Skip to content
Matt Schuchard edited this page Jul 12, 2016 · 5 revisions

This is a guide to migrating old code to the newer APIs

APIv1 -> APIv2

  • execFilePath replaced by execNode:

    • static execNode(filePath: String, args: Array<string> = [], options: Object = {stream: 'stdout'})
  • findFile() guaranteed available (added in v1.0.2)

APIv2 -> APIv3

  • exec() now throws an error when data is encountered on stdout, unless either options.throwOnStdErr (added in v2.0.5) is set to false, or stream is not set to stdout.

Notable changes

  • stream: 'both' added to exec(), allowing data to be gathered from stdout and stderr (added in v3.1.2)
  • An optional third parameter colStart was added to rangeFromLineNumber() in v3.2.0, allowing a starting column for the range to be specified.
  • The parse() method gained an optional fourth parameter flags, allowing modification of the RegEx flags used

API v3 -> API v4

  • rangeFromLineNumber() guaranteed available (added in v3.1.0)
  • tempFile() guaranteed available (added in v3.1.3)
  • findFileAsync() guaranteed available (added in v3.4.0)
  • findFile() renamed to find()

Notable changes

  • FindCache exported, allowing FindCache.clear() to be called if necessary (v4.1.1)
  • A 10 second execution timeout was added in v4.6.0

API v4 -> API v5

  • findCached() and findCachedAsync() guaranteed available (added in v4.1.0)
  • tempFiles() guaranteed available (added in v4.3.0)
  • Handling of return codes implemented, potentially breaking providers of linters that don't follow common best practices.
  • If the linter normally outputs on stderr, setting the allowEmptyStderr option to true in *exec methods will allow it to have no output on a run (eg. one with no issues to report)
  • If the linter exits with a non-zero exit code when issues are reported, setting the ignoreExitCode option to true in *exec methods will allow it to report issues without throwing a fatal error to sb-exec.

API v5 -> API v6

  • rangeFromLineNumber updated to return a range that wraps a word not an entire line. (API breaking change)

Notes

  • createElement was added in v3.3.5 and removed in v4.3.1, apparently due to a complete lack of use.