coffeescript-lint.js
11 years ago
coffeescript-lint.min.js
6 years ago
css-lint.js
9 years ago
css-lint.min.js
6 years ago
html-lint.js
10 years ago
html-lint.min.js
6 years ago
javascript-lint.js
11 years ago
javascript-lint.min.js
6 years ago
json-lint.js
11 years ago
json-lint.min.js
6 years ago
lint.css
9 years ago
lint.js
9 years ago
lint.min.js
6 years ago
yaml-lint.js
9 years ago
yaml-lint.min.js
6 years ago
css-lint.js
43 lines
| 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others |
| 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE |
| 3 | |
| 4 | // Depends on csslint.js from https://github.com/stubbornella/csslint |
| 5 | |
| 6 | // declare global: CSSLint |
| 7 | |
| 8 | (function(mod) { |
| 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 |
| 14 | mod(CodeMirror); |
| 15 | })(function(CodeMirror) { |
| 16 | "use strict"; |
| 17 | |
| 18 | CodeMirror.registerHelper("lint", "css", function(text) { |
| 19 | var found = []; |
| 20 | if (!window.CSSLint) return found; |
| 21 | // This has been modified to only display certain errors |
| 22 | var results = CSSLint.verify(text, { |
| 23 | "box-model": 1, |
| 24 | "display-property-grouping": 1, |
| 25 | "duplicate-properties": 1, |
| 26 | "empty-rules": 1, |
| 27 | "known-properties": 1 |
| 28 | }), messages = results.messages, message = null; |
| 29 | for ( var i = 0; i < messages.length; i++) { |
| 30 | message = messages[i]; |
| 31 | var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col; |
| 32 | found.push({ |
| 33 | from: CodeMirror.Pos(startLine, startCol), |
| 34 | to: CodeMirror.Pos(endLine, endCol), |
| 35 | message: message.message, |
| 36 | severity : message.type |
| 37 | }); |
| 38 | } |
| 39 | return found; |
| 40 | }); |
| 41 | |
| 42 | }); |
| 43 |