Permalink
Browse files

Changed too many \!important error to a warning (fixes #105)

  • Loading branch information...
1 parent 0ae63a5 commit 656d8ae8b2f5e7bdb0bfa7ef00e00232639db181 Nicholas C. Zakas committed Jul 12, 2011
View
@@ -1,5 +1,6 @@
Next (not yet released)
+* Changed too many !important error to warning (fixes #105)
* Updated parser (fixes #49)
* Added rule for compatible vendor prefixes (pull #78)
* Added rule for duplicate properties (fixes #51)
View
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Build time: 5-July-2011 03:16:53 */
+/* Build time: 12-July-2011 03:09:36 */
/*!
Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@@ -10423,8 +10423,8 @@ CSSLint.addRule({
//initialization
init: function(parser, reporter){
- var rule = this;
- var count = 0;
+ var rule = this,
+ count = 0;
//warn that important is used and increment the declaration counter
parser.addListener("property", function(event){
@@ -10439,7 +10439,7 @@ CSSLint.addRule({
parser.addListener("endstylesheet", function(){
reporter.stat("important", count);
if (count >= 10){
- reporter.rollupError("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
+ reporter.rollupWarn("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
}
});
}
View
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Build time: 5-July-2011 03:16:53 */
+/* Build time: 12-July-2011 03:09:36 */
var CSSLint = (function(){
/*!
Parser-Lib
@@ -10424,8 +10424,8 @@ CSSLint.addRule({
//initialization
init: function(parser, reporter){
- var rule = this;
- var count = 0;
+ var rule = this,
+ count = 0;
//warn that important is used and increment the declaration counter
parser.addListener("property", function(event){
@@ -10440,7 +10440,7 @@ CSSLint.addRule({
parser.addListener("endstylesheet", function(){
reporter.stat("important", count);
if (count >= 10){
- reporter.rollupError("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
+ reporter.rollupWarn("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
}
});
}
View
@@ -868,7 +868,7 @@ background: -ms-linear-gradient(top, #1e5799 ,#2989d8 ,#207cca ,#7db9e8 );
var css = "h1 { color:#fff !important; } h2 { color:#fff !important; } h3 { color:#fff !important; } h4 { color:#fff !important; } h5 { color:#fff !important; } h6 { color:#fff !important; } p { color:#fff !important; } ul { color:#fff !important; } ol { color:#fff !important; } li { color:#fff !important; }";
var result = CSSLint.verify(css, { "important": 1 });
Assert.areEqual(11, result.messages.length);
- Assert.areEqual("error", result.messages[10].type);
+ Assert.areEqual("warning", result.messages[10].type);
Assert.areEqual("Too many !important declarations (10), be careful with rule specificity", result.messages[10].message);
}
View
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Build time: 5-July-2011 03:16:53 */
+/* Build time: 12-July-2011 03:09:36 */
/*!
Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@@ -10423,8 +10423,8 @@ CSSLint.addRule({
//initialization
init: function(parser, reporter){
- var rule = this;
- var count = 0;
+ var rule = this,
+ count = 0;
//warn that important is used and increment the declaration counter
parser.addListener("property", function(event){
@@ -10439,7 +10439,7 @@ CSSLint.addRule({
parser.addListener("endstylesheet", function(){
reporter.stat("important", count);
if (count >= 10){
- reporter.rollupError("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
+ reporter.rollupWarn("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
}
});
}
View
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Build time: 5-July-2011 03:16:53 */
+/* Build time: 12-July-2011 03:09:36 */
var CSSLint = (function(){
/*!
Parser-Lib
@@ -10424,8 +10424,8 @@ CSSLint.addRule({
//initialization
init: function(parser, reporter){
- var rule = this;
- var count = 0;
+ var rule = this,
+ count = 0;
//warn that important is used and increment the declaration counter
parser.addListener("property", function(event){
@@ -10440,7 +10440,7 @@ CSSLint.addRule({
parser.addListener("endstylesheet", function(){
reporter.stat("important", count);
if (count >= 10){
- reporter.rollupError("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
+ reporter.rollupWarn("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
}
});
}
View
@@ -1,5 +1,5 @@
#!/usr/bin/env node
-/* Build time: 5-July-2011 03:16:53 */
+/* Build time: 12-July-2011 03:09:36 */
//print for rhino and nodejs
if(typeof print == "undefined") {
var print = console.log;
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* Build time: 5-July-2011 03:16:53 */
+/* Build time: 12-July-2011 03:09:36 */
/*!
Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@@ -10423,8 +10423,8 @@ CSSLint.addRule({
//initialization
init: function(parser, reporter){
- var rule = this;
- var count = 0;
+ var rule = this,
+ count = 0;
//warn that important is used and increment the declaration counter
parser.addListener("property", function(event){
@@ -10439,7 +10439,7 @@ CSSLint.addRule({
parser.addListener("endstylesheet", function(){
reporter.stat("important", count);
if (count >= 10){
- reporter.rollupError("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
+ reporter.rollupWarn("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
}
});
}
View
@@ -13,8 +13,8 @@ CSSLint.addRule({
//initialization
init: function(parser, reporter){
- var rule = this;
- var count = 0;
+ var rule = this,
+ count = 0;
//warn that important is used and increment the declaration counter
parser.addListener("property", function(event){
@@ -29,7 +29,7 @@ CSSLint.addRule({
parser.addListener("endstylesheet", function(){
reporter.stat("important", count);
if (count >= 10){
- reporter.rollupError("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
+ reporter.rollupWarn("Too many !important declarations (" + count + "), be careful with rule specificity", rule);
}
});
}
View
@@ -18,7 +18,7 @@
var css = "h1 { color:#fff !important; } h2 { color:#fff !important; } h3 { color:#fff !important; } h4 { color:#fff !important; } h5 { color:#fff !important; } h6 { color:#fff !important; } p { color:#fff !important; } ul { color:#fff !important; } ol { color:#fff !important; } li { color:#fff !important; }";
var result = CSSLint.verify(css, { "important": 1 });
Assert.areEqual(11, result.messages.length);
- Assert.areEqual("error", result.messages[10].type);
+ Assert.areEqual("warning", result.messages[10].type);
Assert.areEqual("Too many !important declarations (10), be careful with rule specificity", result.messages[10].message);
}

0 comments on commit 656d8ae

Please sign in to comment.