1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 // Distributed under an MIT license: http://codemirror.net/LICENSE
4 // Depends on csslint.js from https://github.com/stubbornella/csslint
6 // declare global: CSSLint
9 if (typeof exports == "object" && typeof module == "object") // CommonJS
10 mod(require("../../lib/codemirror"));
11 else if (typeof define == "function" && define.amd) // AMD
12 define(["../../lib/codemirror"], mod);
13 else // Plain browser env
15 })(function(CodeMirror) {
18 CodeMirror.registerHelper("lint", "css", function(text) {
20 if (!window.CSSLint) return found;
21 var results = CSSLint.verify(text), messages = results.messages, message = null;
22 for ( var i = 0; i < messages.length; i++) {
23 message = messages[i];
24 var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col;
26 from: CodeMirror.Pos(startLine, startCol),
27 to: CodeMirror.Pos(endLine, endCol),
28 message: message.message,
29 severity : message.type