* Lints a string. * * @param {String} text * @param {{context: String, filename: String, syntax: String}} options * @returns {Promise} Resolves with list of found errors.
(text, options)
| 118 | * @returns {Promise} Resolves with <Array> list of found errors. |
| 119 | */ |
| 120 | lintString(text, options) { |
| 121 | return this._parseString(text, options) |
| 122 | .then(this._lintTree.bind(this)) |
| 123 | .then(errors => { |
| 124 | errors.forEach(error => { |
| 125 | error.context = this._getContext(text, error.line); |
| 126 | }); |
| 127 | |
| 128 | return errors; |
| 129 | }); |
| 130 | } |
| 131 | |
| 132 | _getContext(text, currentLineNumber) { |
| 133 | var LINES_AROUND = 2; |
no test coverage detected