Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/CSSLint/csslint

  • Loading branch information...
commit bba721e10488f0318d940c8d11b05587d67ec785 2 parents 5b2f1e1 + c59f2e5
@fracmak authored
View
1  .travis.yml
@@ -4,4 +4,5 @@ node_js:
- "0.10"
- "0.11"
before_install:
+ - npm update npm -g # For "^" dependency compatiblibty in NodeJS 0.8
- npm install -g grunt-cli
View
3  Gruntfile.js
@@ -168,6 +168,9 @@ module.exports = function(grunt) {
gruntfile: {
src: "Gruntfile.js"
},
+ demo: {
+ src: "demos/*.js"
+ },
all: {
src: ["src/**/*.js"]
},
View
57 README.md
@@ -5,21 +5,56 @@
# CSSLint
-CSSLint is a tool to help point out problems with your CSS code.
-It does basic syntax checking as well as applying a set of rules
-to the code that look for problematic patterns or signs of inefficiency.
-The rules are all pluggable, so you can easily write your own or omit ones
-you don't want. You can find information about both using CSS Lint and
-contributing to the project in the wiki: https://github.com/CSSLint/csslint/wiki
+CSSLint is an open source CSS code quality tool originally written by
+[Nicholas C. Zakas](http://www.nczonline.net/) and
+[Nicole Sullivan](http://www.stubbornella.org/). It was released in June 2011 at
+the Velocity conference.
-## Contributors
+A [lint](http://en.wikipedia.org/wiki/Lint_programming_tool) tool performs
+[static analysis](http://en.wikipedia.org/wiki/Static_code_analysis) of source
+code and flags patterns that might be errors or otherwise cause problems for the
+developer.
+
+CSSLint is a tool to help point out problems with your CSS code. It does basic
+syntax checking as well as applying a set of rules to the code that look for
+problematic patterns or signs of inefficiency. The rules are all pluggable, so
+you can easily write your own or omit ones you don't want.
+
+## Integration
+
+### Command Line Interface
+
+All about the command line interface for CSSLint. If you'd rather use a CLI
+program to verify your CSS instead of using the web site, then this guide is
+your best friend.
+https://github.com/CSSLint/csslint/wiki/Command-line-interface
+
+### Build System
-### Creators
+Once you're familiar with the CSSLint command line interface, the next step is
+to integrate it into your build system. This guide walks through using CSSLint
+as part of your build.
+https://github.com/CSSLint/csslint/wiki/Build-System-Integration
-1. Nicole Sullivan, http://www.stubbornella.org
-1. Nicholas C. Zakas, http://www.nczonline.net
+### IDE
-### Contributors
+You can integrate CSSLint into your favorite IDE to make checking your CSS code
+quality easy. In fact, some IDEs already have CSSLint built in.
+https://github.com/CSSLint/csslint/wiki/IDE-integration
+
+## Rules
+
+Not sure why a rule is important? This guide talks about each of the CSSLint
+rules and explains how the rule is designed to improve your CSS.
+https://github.com/CSSLint/csslint/wiki/Rules
+
+## Developer Guide
+
+If you want to contribute to the project, or even just tinker on your own,
+this guide explains how to get the source and work with it.
+https://github.com/CSSLint/csslint/wiki/Developer-Guide
+
+## Contributors
1. Samori Gorse, https://twitter.com/shinuza (Rules, Non-zero Exit Code for CLI)
1. Eitan Konigsburg, https://twitter.com/eitanmk (Rhino CLI)
View
37 demos/CSSLintDemo.htm
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<meta charset="utf-8">
<title>CSSLint Demo</title>
@@ -8,11 +8,12 @@
.error { color: #D9534F; font-weight: bold; }
.warning { color: #F0AD4E; }
</style>
- <script src="../release/csslint.js"></script>
+ <script src="../build/csslint.js"></script>
+ <script src="demo.js"></script>
</head>
<body>
<h1>CSSLint Demo</h1>
- <textarea rows="50" cols="100" id="input">
+ <textarea rows="30" cols="100" id="input">
@charset "UTF-8";
@import url("booya.css") print, screen;
@@ -73,35 +74,9 @@
}
}
</textarea>
- <input type="button" id="lint-btn" value="Run CSSLint">
+ <br>
+ <button id="lint-btn">Run CSSLint</button>
<p>(You may want to keep the CSS kinda small, this could take a while.)</p>
<div id="output"></div>
- <script>
- (function() {
- "use strict";
-
- document.body.onclick = function(event) {
- event = event || window.event;
- var target = event.target || event.srcElement,
- results, messages, i, len;
-
-
- if (target.id === "lint-btn") {
- document.getElementById("output").innerHTML = "";
- results = CSSLint.verify(document.getElementById("input").value);
- messages = results.messages;
- for (i=0, len=messages.length; i < len; i++) {
- log(messages[i].message + " (line " + messages[i].line + ", col " + messages[i].col + ")", messages[i].type);
- }
-
- }
- };
-
- function log(value, level) {
- var output = document.getElementById("output");
- output.innerHTML += "<span class=\"" + level + "\">" + value.replace(/ /g, "&nbsp;") + "</span><br>";
- }
- })();
- </script>
</body>
</html>
View
31 demos/demo.js
@@ -0,0 +1,31 @@
+/* jshint browser:true */
+(function() {
+ "use strict";
+
+ window.onload = function() {
+ document.body.onclick = function(event) {
+ event = event || window.event;
+ var target = event.target || event.srcElement,
+ results,
+ messages,
+ i,
+ len;
+
+ function log(value, level) {
+ var output = document.getElementById("output");
+ output.innerHTML += "<span class=\"" + level + "\">" + value.replace(/ /g, "&nbsp;") + "</span><br>";
+ }
+
+ if (target.id === "lint-btn") {
+ document.getElementById("output").innerHTML = "";
+ results = CSSLint.verify(document.getElementById("input").value);
+ messages = results.messages;
+ for (i=0, len=messages.length; i < len; i++) {
+ log(messages[i].message + " (line " + messages[i].line + ", col " + messages[i].col + ")", messages[i].type);
+ }
+
+ }
+
+ };
+ };
+})();
View
2  src/rules/box-model.js
@@ -72,6 +72,7 @@ CSSLint.addRule({
parser.addListener("startpage", startRule);
parser.addListener("startpagemargin", startRule);
parser.addListener("startkeyframerule", startRule);
+ parser.addListener("startviewport", startRule);
parser.addListener("property", function(event){
var name = event.property.text.toLowerCase();
@@ -95,6 +96,7 @@ CSSLint.addRule({
parser.addListener("endpage", endRule);
parser.addListener("endpagemargin", endRule);
parser.addListener("endkeyframerule", endRule);
+ parser.addListener("endviewport", endRule);
}
});
View
2  src/rules/display-property-grouping.js
@@ -98,6 +98,7 @@ CSSLint.addRule({
parser.addListener("startkeyframerule", startRule);
parser.addListener("startpagemargin", startRule);
parser.addListener("startpage", startRule);
+ parser.addListener("startviewport", startRule);
parser.addListener("property", function(event){
var name = event.property.text.toLowerCase();
@@ -112,6 +113,7 @@ CSSLint.addRule({
parser.addListener("endkeyframerule", endRule);
parser.addListener("endpagemargin", endRule);
parser.addListener("endpage", endRule);
+ parser.addListener("endviewport", endRule);
}
View
1  src/rules/duplicate-properties.js
@@ -27,6 +27,7 @@ CSSLint.addRule({
parser.addListener("startpage", startRule);
parser.addListener("startpagemargin", startRule);
parser.addListener("startkeyframerule", startRule);
+ parser.addListener("startviewport", startRule);
parser.addListener("property", function(event){
var property = event.property,
View
1  src/rules/fallback-colors.js
@@ -38,6 +38,7 @@ CSSLint.addRule({
parser.addListener("startpage", startRule);
parser.addListener("startpagemargin", startRule);
parser.addListener("startkeyframerule", startRule);
+ parser.addListener("startviewport", startRule);
parser.addListener("property", function(event){
var property = event.property,
View
2  src/rules/outline-none.js
@@ -49,6 +49,7 @@ CSSLint.addRule({
parser.addListener("startpage", startRule);
parser.addListener("startpagemargin", startRule);
parser.addListener("startkeyframerule", startRule);
+ parser.addListener("startviewport", startRule);
parser.addListener("property", function(event){
var name = event.property.text.toLowerCase(),
@@ -68,6 +69,7 @@ CSSLint.addRule({
parser.addListener("endpage", endRule);
parser.addListener("endpagemargin", endRule);
parser.addListener("endkeyframerule", endRule);
+ parser.addListener("endviewport", endRule);
}
View
2  src/rules/vendor-prefix.js
@@ -119,6 +119,7 @@ CSSLint.addRule({
parser.addListener("startpage", startRule);
parser.addListener("startpagemargin", startRule);
parser.addListener("startkeyframerule", startRule);
+ parser.addListener("startviewport", startRule);
parser.addListener("property", function(event){
var name = event.property.text.toLowerCase();
@@ -135,6 +136,7 @@ CSSLint.addRule({
parser.addListener("endpage", endRule);
parser.addListener("endpagemargin", endRule);
parser.addListener("endkeyframerule", endRule);
+ parser.addListener("endviewport", endRule);
}
});
View
5 tests/all-rules.js
@@ -31,6 +31,11 @@
this.options[rules[i].id] = 1;
},
+ "Using @viewport should not result in an error": function(){
+ var result = CSSLint.verify("@viewport { width: auto; }", this.options);
+ Assert.areEqual(0, result.messages.length);
+ },
+
"Using @keyframes should not result in an error": function(){
var result = CSSLint.verify("@keyframes resize { 0% {padding: 0;} 50% {padding: 0;} 100% {padding: 0;}}", this.options);
Assert.areEqual(0, result.messages.length);
View
2  tests/testrunner.htm
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<meta charset="utf-8">
<title>YUI Test</title>
Please sign in to comment.
Something went wrong with that request. Please try again.