diff --git a/addon/lint/lint.js b/addon/lint/lint.js index c7e093960e5f5d3181ae37e11c125019b55c480e..a7e74f28008effb8e08c977a02fd7a25b4e5d4a5 100644 --- a/addon/lint/lint.js +++ b/addon/lint/lint.js @@ -66,8 +66,6 @@ function parseOptions(cm, options) { if (options instanceof Function) return {getAnnotations: options}; if (!options || options === true) options = {}; - if (!options.getAnnotations) options.getAnnotations = cm.getHelper(CodeMirror.Pos(0, 0), "lint"); - if (!options.getAnnotations) throw new Error("Required option 'getAnnotations' missing (lint addon)"); return options; } @@ -120,10 +118,12 @@ function startLinting(cm) { var state = cm.state.lint, options = state.options; var passOptions = options.options || options; // Support deprecated passing of `options` property in options - if (options.async || options.getAnnotations.async) - options.getAnnotations(cm.getValue(), updateLinting, passOptions, cm); + var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint"); + if (!getAnnotations) return; + if (options.async || getAnnotations.async) + getAnnotations(cm.getValue(), updateLinting, passOptions, cm); else - updateLinting(cm, options.getAnnotations(cm.getValue(), passOptions, cm)); + updateLinting(cm, getAnnotations(cm.getValue(), passOptions, cm)); } function updateLinting(cm, annotationsNotSorted) {