forked from phcode-dev/staging.phcode.dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcoffeescript-lint.js
More file actions
1 lines (1 loc) · 882 Bytes
/
Copy pathcoffeescript-lint.js
File metadata and controls
1 lines (1 loc) · 882 Bytes
1
!function(mod){"object"==typeof exports&&"object"==typeof module?mod(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],mod):mod(CodeMirror)}(function(CodeMirror){"use strict";CodeMirror.registerHelper("lint","coffeescript",function(text){var found=[];if(!window.coffeelint)return window.console&&window.console.error("Error: window.coffeelint not defined, CodeMirror CoffeeScript linting cannot run."),found;var parseError=function(err){var loc=err.lineNumber;found.push({from:CodeMirror.Pos(loc-1,0),to:CodeMirror.Pos(loc,0),severity:err.level,message:err.message})};try{for(var res=coffeelint.lint(text),i=0;i<res.length;i++)parseError(res[i])}catch(e){found.push({from:CodeMirror.Pos(e.location.first_line,0),to:CodeMirror.Pos(e.location.last_line,e.location.last_column),severity:"error",message:e.message})}return found})});