GPQAPP
1// CodeMirror, copyright (c) by Marijn Haverbeke and others
2// Distributed under an MIT license: https://codemirror.net/LICENSE
3
4// Depends on csslint.js from https://github.com/stubbornella/csslint
5
6// declare global: CSSLint
7
8(function(mod) {9if (typeof exports == "object" && typeof module == "object") // CommonJS10mod(require("../../lib/codemirror"));11else if (typeof define == "function" && define.amd) // AMD12define(["../../lib/codemirror"], mod);13else // Plain browser env14mod(CodeMirror);15})(function(CodeMirror) {16"use strict";17
18CodeMirror.registerHelper("lint", "css", function(text, options) {19var found = [];20if (!window.CSSLint) {21if (window.console) {22window.console.error("Error: window.CSSLint not defined, CodeMirror CSS linting cannot run.");23}24return found;25}26var results = CSSLint.verify(text, options), messages = results.messages, message = null;27for ( var i = 0; i < messages.length; i++) {28message = messages[i];29var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col;30found.push({31from: CodeMirror.Pos(startLine, startCol),32to: CodeMirror.Pos(endLine, endCol),33message: message.message,34severity : message.type35});36}37return found;38});39
40});41