sasslint 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +15 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +29 -0
  4. data/bin/sasslint +6 -0
  5. data/lib/sasslint.rb +10 -0
  6. data/lib/sasslint/cli.rb +28 -0
  7. data/lib/sasslint/helpers/path_helper.rb +10 -0
  8. data/lib/sasslint/helpers/rule_importer.rb +25 -0
  9. data/lib/sasslint/rules/css/adjoining-classes.rb +52 -0
  10. data/lib/sasslint/rules/css/box-model.rb +108 -0
  11. data/lib/sasslint/rules/css/box-sizing.rb +35 -0
  12. data/lib/sasslint/rules/css/bulletproof-font-face.rb +73 -0
  13. data/lib/sasslint/rules/css/compatible-vendor-prefixes.rb +193 -0
  14. data/lib/sasslint/rules/css/display-property-grouping.rb +124 -0
  15. data/lib/sasslint/rules/css/duplicate-background-images.rb +44 -0
  16. data/lib/sasslint/rules/css/duplicate-properties.rb +53 -0
  17. data/lib/sasslint/rules/css/empty-rules.rb +41 -0
  18. data/lib/sasslint/rules/css/errors.rb +30 -0
  19. data/lib/sasslint/rules/css/fallback-colors.rb +84 -0
  20. data/lib/sasslint/rules/css/floats.rb +43 -0
  21. data/lib/sasslint/rules/css/font-faces.rb +37 -0
  22. data/lib/sasslint/rules/css/font-sizes.rb +42 -0
  23. data/lib/sasslint/rules/css/gradients.rb +71 -0
  24. data/lib/sasslint/rules/css/ids.rb +57 -0
  25. data/lib/sasslint/rules/css/import.rb +30 -0
  26. data/lib/sasslint/rules/css/important.rb +44 -0
  27. data/lib/sasslint/rules/css/known-properties.rb +36 -0
  28. data/lib/sasslint/rules/css/outline-none.rb +80 -0
  29. data/lib/sasslint/rules/css/overqualified-elements.rb +70 -0
  30. data/lib/sasslint/rules/css/qualified-headings.rb +45 -0
  31. data/lib/sasslint/rules/css/regex-selectors.rb +51 -0
  32. data/lib/sasslint/rules/css/rules-count.rb +35 -0
  33. data/lib/sasslint/rules/css/selector-max-approaching.rb +35 -0
  34. data/lib/sasslint/rules/css/selector-max.rb +35 -0
  35. data/lib/sasslint/rules/css/shorthand.rb +94 -0
  36. data/lib/sasslint/rules/css/star-property-hack.rb +34 -0
  37. data/lib/sasslint/rules/css/text-indent.rb +60 -0
  38. data/lib/sasslint/rules/css/underscore-property-hack.rb +34 -0
  39. data/lib/sasslint/rules/css/unique-headings.rb +81 -0
  40. data/lib/sasslint/rules/css/universal-selector.rb +42 -0
  41. data/lib/sasslint/rules/css/unqualified-attributes.rb +49 -0
  42. data/lib/sasslint/rules/css/vendor-prefix.rb +150 -0
  43. data/lib/sasslint/rules/css/zero-units.rb +41 -0
  44. data/lib/sasslint/version.rb +3 -0
  45. data/sasslint.gemspec +29 -0
  46. metadata +146 -0
@@ -0,0 +1,51 @@
1
+ # This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules
2
+ #
3
+ #
4
+ # Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
5
+ # TODO: Paste the CSSLint LICENSE here.
6
+ #
7
+ #
8
+ # /*
9
+ # * Rule: Selectors that look like regular expressions are slow and should be avoided.
10
+ # */
11
+ # /*global CSSLint*/
12
+ # CSSLint.addRule({
13
+ #
14
+ # //rule information
15
+ # id: "regex-selectors",
16
+ # name: "Disallow selectors that look like regexs",
17
+ # desc: "Selectors that look like regular expressions are slow and should be avoided.",
18
+ # browsers: "All",
19
+ #
20
+ # //initialization
21
+ # init: function(parser, reporter){
22
+ # var rule = this;
23
+ #
24
+ # parser.addListener("startrule", function(event){
25
+ # var selectors = event.selectors,
26
+ # selector,
27
+ # part,
28
+ # modifier,
29
+ # i, j, k;
30
+ #
31
+ # for (i=0; i < selectors.length; i++){
32
+ # selector = selectors[i];
33
+ # for (j=0; j < selector.parts.length; j++){
34
+ # part = selector.parts[j];
35
+ # if (part.type == parser.SELECTOR_PART_TYPE){
36
+ # for (k=0; k < part.modifiers.length; k++){
37
+ # modifier = part.modifiers[k];
38
+ # if (modifier.type == "attribute"){
39
+ # if (/([\~\|\^\$\*]=)/.test(modifier)){
40
+ # reporter.report("Attribute selectors with " + RegExp.$1 + " are slow!", modifier.line, modifier.col, rule);
41
+ # }
42
+ # }
43
+ #
44
+ # }
45
+ # }
46
+ # }
47
+ # }
48
+ # });
49
+ # }
50
+ #
51
+ # });
@@ -0,0 +1,35 @@
1
+ # This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules
2
+ #
3
+ #
4
+ # Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
5
+ # TODO: Paste the CSSLint LICENSE here.
6
+ #
7
+ #
8
+ # /*
9
+ # * Rule: Total number of rules should not exceed x.
10
+ # */
11
+ # /*global CSSLint*/
12
+ # CSSLint.addRule({
13
+ #
14
+ # //rule information
15
+ # id: "rules-count",
16
+ # name: "Rules Count",
17
+ # desc: "Track how many rules there are.",
18
+ # browsers: "All",
19
+ #
20
+ # //initialization
21
+ # init: function(parser, reporter){
22
+ # var rule = this,
23
+ # count = 0;
24
+ #
25
+ # //count each rule
26
+ # parser.addListener("startrule", function(){
27
+ # count++;
28
+ # });
29
+ #
30
+ # parser.addListener("endstylesheet", function(){
31
+ # reporter.stat("rule-count", count);
32
+ # });
33
+ # }
34
+ #
35
+ # });
@@ -0,0 +1,35 @@
1
+ # This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules
2
+ #
3
+ #
4
+ # Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
5
+ # TODO: Paste the CSSLint LICENSE here.
6
+ #
7
+ #
8
+ # /*
9
+ # * Rule: Warn people with approaching the IE 4095 limit
10
+ # */
11
+ # /*global CSSLint*/
12
+ # CSSLint.addRule({
13
+ #
14
+ # //rule information
15
+ # id: "selector-max-approaching",
16
+ # name: "Warn when approaching the 4095 selector limit for IE",
17
+ # desc: "Will warn when selector count is >= 3800 selectors.",
18
+ # browsers: "IE",
19
+ #
20
+ # //initialization
21
+ # init: function(parser, reporter) {
22
+ # var rule = this, count = 0;
23
+ #
24
+ # parser.addListener('startrule', function(event) {
25
+ # count += event.selectors.length;
26
+ # });
27
+ #
28
+ # parser.addListener("endstylesheet", function() {
29
+ # if (count >= 3800) {
30
+ # reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);
31
+ # }
32
+ # });
33
+ # }
34
+ #
35
+ # });
@@ -0,0 +1,35 @@
1
+ # This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules
2
+ #
3
+ #
4
+ # Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
5
+ # TODO: Paste the CSSLint LICENSE here.
6
+ #
7
+ #
8
+ # /*
9
+ # * Rule: Warn people past the IE 4095 limit
10
+ # */
11
+ # /*global CSSLint*/
12
+ # CSSLint.addRule({
13
+ #
14
+ # //rule information
15
+ # id: "selector-max",
16
+ # name: "Error when past the 4095 selector limit for IE",
17
+ # desc: "Will error when selector count is > 4095.",
18
+ # browsers: "IE",
19
+ #
20
+ # //initialization
21
+ # init: function(parser, reporter){
22
+ # var rule = this, count = 0;
23
+ #
24
+ # parser.addListener('startrule',function(event) {
25
+ # count += event.selectors.length;
26
+ # });
27
+ #
28
+ # parser.addListener("endstylesheet", function() {
29
+ # if (count > 4095) {
30
+ # reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);
31
+ # }
32
+ # });
33
+ # }
34
+ #
35
+ # });
@@ -0,0 +1,94 @@
1
+ # This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules
2
+ #
3
+ #
4
+ # Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
5
+ # TODO: Paste the CSSLint LICENSE here.
6
+ #
7
+ #
8
+ # /*
9
+ # * Rule: Use shorthand properties where possible.
10
+ # *
11
+ # */
12
+ # /*global CSSLint*/
13
+ # CSSLint.addRule({
14
+ #
15
+ # //rule information
16
+ # id: "shorthand",
17
+ # name: "Require shorthand properties",
18
+ # desc: "Use shorthand properties where possible.",
19
+ # browsers: "All",
20
+ #
21
+ # //initialization
22
+ # init: function(parser, reporter){
23
+ # var rule = this,
24
+ # prop, i, len,
25
+ # propertiesToCheck = {},
26
+ # properties,
27
+ # mapping = {
28
+ # "margin": [
29
+ # "margin-top",
30
+ # "margin-bottom",
31
+ # "margin-left",
32
+ # "margin-right"
33
+ # ],
34
+ # "padding": [
35
+ # "padding-top",
36
+ # "padding-bottom",
37
+ # "padding-left",
38
+ # "padding-right"
39
+ # ]
40
+ # };
41
+ #
42
+ # //initialize propertiesToCheck
43
+ # for (prop in mapping){
44
+ # if (mapping.hasOwnProperty(prop)){
45
+ # for (i=0, len=mapping[prop].length; i < len; i++){
46
+ # propertiesToCheck[mapping[prop][i]] = prop;
47
+ # }
48
+ # }
49
+ # }
50
+ #
51
+ # function startRule(event){
52
+ # properties = {};
53
+ # }
54
+ #
55
+ # //event handler for end of rules
56
+ # function endRule(event){
57
+ #
58
+ # var prop, i, len, total;
59
+ #
60
+ # //check which properties this rule has
61
+ # for (prop in mapping){
62
+ # if (mapping.hasOwnProperty(prop)){
63
+ # total=0;
64
+ #
65
+ # for (i=0, len=mapping[prop].length; i < len; i++){
66
+ # total += properties[mapping[prop][i]] ? 1 : 0;
67
+ # }
68
+ #
69
+ # if (total == mapping[prop].length){
70
+ # reporter.report("The properties " + mapping[prop].join(", ") + " can be replaced by " + prop + ".", event.line, event.col, rule);
71
+ # }
72
+ # }
73
+ # }
74
+ # }
75
+ #
76
+ # parser.addListener("startrule", startRule);
77
+ # parser.addListener("startfontface", startRule);
78
+ #
79
+ # //check for use of "font-size"
80
+ # parser.addListener("property", function(event){
81
+ # var name = event.property.toString().toLowerCase(),
82
+ # value = event.value.parts[0].value;
83
+ #
84
+ # if (propertiesToCheck[name]){
85
+ # properties[name] = 1;
86
+ # }
87
+ # });
88
+ #
89
+ # parser.addListener("endrule", endRule);
90
+ # parser.addListener("endfontface", endRule);
91
+ #
92
+ # }
93
+ #
94
+ # });
@@ -0,0 +1,34 @@
1
+ # This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules
2
+ #
3
+ #
4
+ # Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
5
+ # TODO: Paste the CSSLint LICENSE here.
6
+ #
7
+ #
8
+ # /*
9
+ # * Rule: Don't use properties with a star prefix.
10
+ # *
11
+ # */
12
+ # /*global CSSLint*/
13
+ # CSSLint.addRule({
14
+ #
15
+ # //rule information
16
+ # id: "star-property-hack",
17
+ # name: "Disallow properties with a star prefix",
18
+ # desc: "Checks for the star property hack (targets IE6/7)",
19
+ # browsers: "All",
20
+ #
21
+ # //initialization
22
+ # init: function(parser, reporter){
23
+ # var rule = this;
24
+ #
25
+ # //check if property name starts with "*"
26
+ # parser.addListener("property", function(event){
27
+ # var property = event.property;
28
+ #
29
+ # if (property.hack == "*") {
30
+ # reporter.report("Property with star prefix found.", event.property.line, event.property.col, rule);
31
+ # }
32
+ # });
33
+ # }
34
+ # });
@@ -0,0 +1,60 @@
1
+ # This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules
2
+ #
3
+ #
4
+ # Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
5
+ # TODO: Paste the CSSLint LICENSE here.
6
+ #
7
+ #
8
+ # /*
9
+ # * Rule: Don't use text-indent for image replacement if you need to support rtl.
10
+ # *
11
+ # */
12
+ # /*global CSSLint*/
13
+ # CSSLint.addRule({
14
+ #
15
+ # //rule information
16
+ # id: "text-indent",
17
+ # name: "Disallow negative text-indent",
18
+ # desc: "Checks for text indent less than -99px",
19
+ # browsers: "All",
20
+ #
21
+ # //initialization
22
+ # init: function(parser, reporter){
23
+ # var rule = this,
24
+ # textIndent,
25
+ # direction;
26
+ #
27
+ #
28
+ # function startRule(event){
29
+ # textIndent = false;
30
+ # direction = "inherit";
31
+ # }
32
+ #
33
+ # //event handler for end of rules
34
+ # function endRule(event){
35
+ # if (textIndent && direction != "ltr"){
36
+ # reporter.report("Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.", textIndent.line, textIndent.col, rule);
37
+ # }
38
+ # }
39
+ #
40
+ # parser.addListener("startrule", startRule);
41
+ # parser.addListener("startfontface", startRule);
42
+ #
43
+ # //check for use of "font-size"
44
+ # parser.addListener("property", function(event){
45
+ # var name = event.property.toString().toLowerCase(),
46
+ # value = event.value;
47
+ #
48
+ # if (name == "text-indent" && value.parts[0].value < -99){
49
+ # textIndent = event.property;
50
+ # } else if (name == "direction" && value == "ltr"){
51
+ # direction = "ltr";
52
+ # }
53
+ # });
54
+ #
55
+ # parser.addListener("endrule", endRule);
56
+ # parser.addListener("endfontface", endRule);
57
+ #
58
+ # }
59
+ #
60
+ # });
@@ -0,0 +1,34 @@
1
+ # This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules
2
+ #
3
+ #
4
+ # Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
5
+ # TODO: Paste the CSSLint LICENSE here.
6
+ #
7
+ #
8
+ # /*
9
+ # * Rule: Don't use properties with a underscore prefix.
10
+ # *
11
+ # */
12
+ # /*global CSSLint*/
13
+ # CSSLint.addRule({
14
+ #
15
+ # //rule information
16
+ # id: "underscore-property-hack",
17
+ # name: "Disallow properties with an underscore prefix",
18
+ # desc: "Checks for the underscore property hack (targets IE6)",
19
+ # browsers: "All",
20
+ #
21
+ # //initialization
22
+ # init: function(parser, reporter){
23
+ # var rule = this;
24
+ #
25
+ # //check if property name starts with "_"
26
+ # parser.addListener("property", function(event){
27
+ # var property = event.property;
28
+ #
29
+ # if (property.hack == "_") {
30
+ # reporter.report("Property with underscore prefix found.", event.property.line, event.property.col, rule);
31
+ # }
32
+ # });
33
+ # }
34
+ # });
@@ -0,0 +1,81 @@
1
+ # This rule is taken from https://github.com/stubbornella/csslint/tree/master/src/rules
2
+ #
3
+ #
4
+ # Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
5
+ # TODO: Paste the CSSLint LICENSE here.
6
+ #
7
+ #
8
+ # /*
9
+ # * Rule: Headings (h1-h6) should be defined only once.
10
+ # */
11
+ # /*global CSSLint*/
12
+ # CSSLint.addRule({
13
+ #
14
+ # //rule information
15
+ # id: "unique-headings",
16
+ # name: "Headings should only be defined once",
17
+ # desc: "Headings should be defined only once.",
18
+ # browsers: "All",
19
+ #
20
+ # //initialization
21
+ # init: function(parser, reporter){
22
+ # var rule = this;
23
+ #
24
+ # var headings = {
25
+ # h1: 0,
26
+ # h2: 0,
27
+ # h3: 0,
28
+ # h4: 0,
29
+ # h5: 0,
30
+ # h6: 0
31
+ # };
32
+ #
33
+ # parser.addListener("startrule", function(event){
34
+ # var selectors = event.selectors,
35
+ # selector,
36
+ # part,
37
+ # pseudo,
38
+ # i, j;
39
+ #
40
+ # for (i=0; i < selectors.length; i++){
41
+ # selector = selectors[i];
42
+ # part = selector.parts[selector.parts.length-1];
43
+ #
44
+ # if (part.elementName && /(h[1-6])/i.test(part.elementName.toString())){
45
+ #
46
+ # for (j=0; j < part.modifiers.length; j++){
47
+ # if (part.modifiers[j].type == "pseudo"){
48
+ # pseudo = true;
49
+ # break;
50
+ # }
51
+ # }
52
+ #
53
+ # if (!pseudo){
54
+ # headings[RegExp.$1]++;
55
+ # if (headings[RegExp.$1] > 1) {
56
+ # reporter.report("Heading (" + part.elementName + ") has already been defined.", part.line, part.col, rule);
57
+ # }
58
+ # }
59
+ # }
60
+ # }
61
+ # });
62
+ #
63
+ # parser.addListener("endstylesheet", function(event){
64
+ # var prop,
65
+ # messages = [];
66
+ #
67
+ # for (prop in headings){
68
+ # if (headings.hasOwnProperty(prop)){
69
+ # if (headings[prop] > 1){
70
+ # messages.push(headings[prop] + " " + prop + "s");
71
+ # }
72
+ # }
73
+ # }
74
+ #
75
+ # if (messages.length){
76
+ # reporter.rollupWarn("You have " + messages.join(", ") + " defined in this stylesheet.", rule);
77
+ # }
78
+ # });
79
+ # }
80
+ #
81
+ # });