Permalink
Browse files

Minor style tweaks.

  • Loading branch information...
1 parent 6334170 commit a9de08628fa1bb967b8cfe194aae7860a6ac8487 @XhmikosR XhmikosR committed Apr 4, 2016
Showing with 363 additions and 344 deletions.
  1. +9 −9 Gruntfile.js
  2. +2 −1 demos/demo.js
  3. +3 −3 src/cli/common.js
  4. +4 −4 src/cli/wsh.js
  5. +10 −10 src/core/CSSLint.js
  6. +6 −6 src/core/Reporter.js
  7. +2 −2 src/formatters/checkstyle-xml.js
  8. +1 −1 src/formatters/compact.js
  9. +1 −1 src/formatters/csslint-xml.js
  10. +1 −1 src/formatters/json.js
  11. +3 −3 src/formatters/junit-xml.js
  12. +1 −1 src/formatters/lint-xml.js
  13. +2 −2 src/formatters/text.js
  14. +2 −2 src/rules/adjoining-classes.js
  15. +3 −3 src/rules/box-model.js
  16. +2 −2 src/rules/box-sizing.js
  17. +6 −6 src/rules/bulletproof-font-face.js
  18. +2 −2 src/rules/compatible-vendor-prefixes.js
  19. +7 −7 src/rules/display-property-grouping.js
  20. +2 −2 src/rules/duplicate-background-images.js
  21. +2 −2 src/rules/duplicate-properties.js
  22. +2 −2 src/rules/empty-rules.js
  23. +2 −2 src/rules/errors.js
  24. +2 −2 src/rules/fallback-colors.js
  25. +4 −4 src/rules/floats.js
  26. +2 −2 src/rules/font-faces.js
  27. +4 −4 src/rules/font-sizes.js
  28. +2 −2 src/rules/gradients.js
  29. +2 −2 src/rules/ids.js
  30. +6 −6 src/rules/import-ie-limit.js
  31. +2 −2 src/rules/import.js
  32. +4 −4 src/rules/important.js
  33. +2 −2 src/rules/known-properties.js
  34. +5 −5 src/rules/order-alphabetical.js
  35. +2 −2 src/rules/outline-none.js
  36. +3 −3 src/rules/overqualified-elements.js
  37. +2 −2 src/rules/qualified-headings.js
  38. +2 −2 src/rules/regex-selectors.js
  39. +3 −3 src/rules/rules-count.js
  40. +3 −3 src/rules/selector-max-approaching.js
  41. +3 −3 src/rules/selector-max.js
  42. +2 −2 src/rules/selector-newline.js
  43. +6 −6 src/rules/shorthand.js
  44. +3 −3 src/rules/star-property-hack.js
  45. +4 −4 src/rules/text-indent.js
  46. +3 −3 src/rules/underscore-property-hack.js
  47. +9 −9 src/rules/unique-headings.js
  48. +2 −2 src/rules/universal-selector.js
  49. +4 −4 src/rules/unqualified-attributes.js
  50. +9 −6 src/rules/vendor-prefix.js
  51. +3 −3 src/rules/zero-units.js
  52. +2 −2 src/worker/Worker.js
  53. +5 −5 tasks/changelog.js
  54. +2 −2 tasks/test_rhino.js
  55. +9 −9 tasks/yuitest.js
  56. +2 −2 tests/cli/cli-common.js
  57. +7 −7 tests/core/CSSLint.js
  58. +11 −11 tests/core/Reporter.js
  59. +8 −8 tests/formatters/json.js
  60. +23 −8 tests/formatters/text.js
  61. +2 −2 tests/rules/duplicate-background-images.js
  62. +3 −3 tests/rules/font-sizes.js
  63. +4 −4 tests/rules/gradients.js
  64. +4 −4 tests/rules/import-ie-limit.js
  65. +1 −1 tests/rules/selector-max-approaching.js
  66. +1 −1 tests/rules/selector-max.js
  67. +4 −4 tests/rules/shorthand.js
  68. +2 −2 tests/rules/star-property-hack.js
  69. +7 −7 tests/rules/text-indent.js
  70. +2 −2 tests/rules/underscore-property-hack.js
  71. +3 −3 tests/rules/universal-selector.js
  72. +8 −8 tests/rules/unqualified-attributes.js
  73. +80 −80 tests/testrunner.js
View
@@ -34,18 +34,18 @@ module.exports = function(grunt) {
"THE SOFTWARE.\n\n" +
"*/\n",
build_dir: "dist",
- //Parser lib copy for versions that can't use requirejs
+ // Parser lib copy for versions that can't use requirejs
parserlib: "node_modules/parserlib/lib/node-parserlib.js",
- //clone copy for versions that can't use requirejs
+ // clone copy for versions that can't use requirejs
clone: "node_modules/clone/clone.js",
- //Core CSSLint files used by most versions
+ // Core CSSLint files used by most versions
csslint_files: [
"src/core/CSSLint.js",
"src/core/*.js",
"src/rules/*.js",
"src/formatters/*.js"
],
- //Core fileset used by most versions
+ // Core fileset used by most versions
core_files: [
"<%= parserlib %>",
"<%= clone %>",
@@ -75,7 +75,7 @@ module.exports = function(grunt) {
"<%= core_files %>"
],
dest: "<%= build_dir %>/csslint.js"
- },//Build environment workers
+ }, // Build environment workers
rhino: {
src: [
"<%= concat.core.dest %>",
@@ -91,8 +91,8 @@ module.exports = function(grunt) {
"var parserlib = require('parserlib');\n",
footer: "\nexports.CSSLint = CSSLint;"
},
- src: "<%= csslint_files %>",
- dest: "<%= build_dir %>/csslint-node.js"
+ src: "<%= csslint_files %>",
+ dest: "<%= build_dir %>/csslint-node.js"
},
node_cli: {
options: {
@@ -114,7 +114,7 @@ module.exports = function(grunt) {
worker: {
options: {
banner: "<%= banner %>" +
- //Hack for using the node version of parserlib
+ // Hack for using the node version of parserlib
"var exports = exports || {};\n"
},
src: [
@@ -207,7 +207,7 @@ module.exports = function(grunt) {
});
// Load any grunt plugins found in package.json.
- require("load-grunt-tasks")(grunt, {scope: "devDependencies"});
+ require("load-grunt-tasks")(grunt, { scope: "devDependencies" });
require("time-grunt")(grunt);
// Load custom tasks
View
@@ -1,4 +1,5 @@
/* jshint browser:true */
+
(function() {
"use strict";
@@ -20,7 +21,7 @@
document.getElementById("output").innerHTML = "";
results = CSSLint.verify(document.getElementById("input").value);
messages = results.messages;
- for (i=0, len=messages.length; i < len; i++) {
+ 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
@@ -273,7 +273,7 @@ function cli(api) {
} else {
- //see if it's a directory or a file
+ // see if it's a directory or a file
if (api.isDirectory(arg)) {
files = files.concat(api.getFiles(arg));
} else {
@@ -326,7 +326,7 @@ function cli(api) {
}
} catch (e) {}
}
- args = data.replace(/\s+/g,"").split(/(?=--)/);
+ args = data.replace(/\s+/g, "").split(/(?=--)/);
options = processArguments(args);
}
@@ -337,7 +337,7 @@ function cli(api) {
// Process command line
//-----------------------------------------------------------------------------
- var args = api.args,
+ var args = api.args,
argCount = args.length,
options,
rcOptions,
View
@@ -2,7 +2,7 @@
* Windows Script Host Command Line Interface
*/
-//TODO: This file needs major cleanup!!!
+// TODO: This file needs major cleanup!!!
/* jshint wsh:true */
/* global cli */
@@ -23,7 +23,7 @@ var wshapi = (function() {
if (typeof Object.create !== "function") {
Object.create = function(proto) {
- var Foo = function(){};
+ var Foo = function() {};
Foo.prototype = proto;
return new Foo();
};
@@ -94,10 +94,10 @@ var wshapi = (function() {
};
}
- //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
if (!Array.prototype.map)
{
- Array.prototype.map = function(fun /*, thisArg */ ) {
+ Array.prototype.map = function(fun /*, thisArg */) {
if (this === void 0 || this === null) {
throw new TypeError();
View
@@ -62,7 +62,7 @@ var CSSLint = (function() {
len = rules.length;
while (i < len) {
- ruleset[rules[i++].id] = 1; //by default, everything is a warning
+ ruleset[rules[i++].id] = 1; // by default, everything is a warning
}
return ruleset;
@@ -193,7 +193,7 @@ var CSSLint = (function() {
allowRuleset = {};
if (allowRules) {
- allowRules.toLowerCase().split(",").forEach(function(allowRule){
+ allowRules.toLowerCase().split(",").forEach(function(allowRule) {
allowRuleset[allowRule.trim()] = true;
});
if (Object.keys(allowRuleset).length > 0) {
@@ -206,22 +206,22 @@ var CSSLint = (function() {
ignoreEnd = null;
CSSLint.Util.forEach(lines, function (line, lineno) {
// Keep oldest, "unclosest" ignore:start
- if(null === ignoreStart && line.match(/\/\*[ \t]*csslint[ \t]+ignore:start[ \t]*\*\//i)) {
+ if (null === ignoreStart && line.match(/\/\*[ \t]*csslint[ \t]+ignore:start[ \t]*\*\//i)) {
ignoreStart = lineno;
}
- if(line.match(/\/\*[ \t]*csslint[ \t]+ignore:end[ \t]*\*\//i)) {
+ if (line.match(/\/\*[ \t]*csslint[ \t]+ignore:end[ \t]*\*\//i)) {
ignoreEnd = lineno;
}
- if(null !== ignoreStart && null !== ignoreEnd) {
+ if (null !== ignoreStart && null !== ignoreEnd) {
ignore.push([ignoreStart, ignoreEnd]);
ignoreStart = ignoreEnd = null;
}
});
// Close remaining ignore block, if any
- if(null !== ignoreStart) {
+ if (null !== ignoreStart) {
ignore.push([ignoreStart, lines.length]);
}
@@ -230,14 +230,14 @@ var CSSLint = (function() {
}
if (embeddedRuleset.test(text)) {
- //defensively copy so that caller's version does not get modified
+ // defensively copy so that caller's version does not get modified
ruleset = clone(ruleset);
ruleset = applyEmbeddedRuleset(text, ruleset);
}
reporter = new Reporter(lines, ruleset, allow, ignore);
- ruleset.errors = 2; //always report parsing errors as errors
+ ruleset.errors = 2; // always report parsing errors as errors
for (i in ruleset) {
if (ruleset.hasOwnProperty(i) && ruleset[i]) {
if (rules[i]) {
@@ -247,7 +247,7 @@ var CSSLint = (function() {
}
- //capture most horrible error type
+ // capture most horrible error type
try {
parser.parse(text);
} catch (ex) {
@@ -262,7 +262,7 @@ var CSSLint = (function() {
ignore : reporter.ignore
};
- //sort by line numbers, rollups at the bottom
+ // sort by line numbers, rollups at the bottom
report.messages.sort(function (a, b) {
if (a.rollup && !b.rollup) {
return 1;
View
@@ -48,7 +48,7 @@ function Reporter(lines, ruleset, allow, ignore) {
* @type Object
*/
this.allow = allow;
- if(!this.allow) {
+ if (!this.allow) {
this.allow = {};
}
@@ -58,14 +58,14 @@ function Reporter(lines, ruleset, allow, ignore) {
* @type [][]
*/
this.ignore = ignore;
- if(!this.ignore) {
+ if (!this.ignore) {
this.ignore = [];
}
}
Reporter.prototype = {
- //restore constructor
+ // restore constructor
constructor: Reporter,
/**
@@ -120,11 +120,11 @@ Reporter.prototype = {
var ignore = false;
CSSLint.Util.forEach(this.ignore, function (range) {
- if(range[0] <= line && line <= range[1]) {
+ if (range[0] <= line && line <= range[1]) {
ignore = true;
}
});
- if(ignore) {
+ if (ignore) {
return;
}
@@ -202,5 +202,5 @@ Reporter.prototype = {
}
};
-//expose for testing purposes
+// expose for testing purposes
CSSLint._Reporter = Reporter;
@@ -33,7 +33,7 @@
};
CSSLint.addFormatter({
- //format information
+ // format information
id: "checkstyle-xml",
name: "Checkstyle XML format",
@@ -93,7 +93,7 @@
if (messages.length > 0) {
output.push("<file name=\""+filename+"\">");
CSSLint.Util.forEach(messages, function (message) {
- //ignore rollups for now
+ // ignore rollups for now
if (!message.rollup) {
output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
" message=\"" + xmlEscape(message.message) + "\" source=\"" + generateSource(message.rule) +"\"/>");
@@ -1,5 +1,5 @@
CSSLint.addFormatter({
- //format information
+ // format information
id: "compact",
name: "Compact, 'porcelain' format",
@@ -1,5 +1,5 @@
CSSLint.addFormatter({
- //format information
+ // format information
id: "csslint-xml",
name: "CSSLint XML format",
@@ -1,7 +1,7 @@
/* globals JSON: true */
CSSLint.addFormatter({
- //format information
+ // format information
id: "json",
name: "JSON",
@@ -1,5 +1,5 @@
CSSLint.addFormatter({
- //format information
+ // format information
id: "junit-xml",
name: "JUNIT XML format",
@@ -81,13 +81,13 @@ CSSLint.addFormatter({
// all issues as errors
var type = message.type === "warning" ? "error" : message.type;
- //ignore rollups for now
+ // ignore rollups for now
if (!message.rollup) {
// build the test case separately, once joined
// we'll add it to a custom array filtered by type
output.push("<testcase time=\"0\" name=\"" + generateSource(message.rule) + "\">");
- output.push("<" + type + " message=\"" + escapeSpecialCharacters(message.message) + "\"><![CDATA[" + message.line + ":" + message.col + ":" + escapeSpecialCharacters(message.evidence) + "]]></" + type + ">");
+ output.push("<" + type + " message=\"" + escapeSpecialCharacters(message.message) + "\"><![CDATA[" + message.line + ":" + message.col + ":" + escapeSpecialCharacters(message.evidence) + "]]></" + type + ">");
output.push("</testcase>");
tests[type] += 1;
@@ -1,5 +1,5 @@
CSSLint.addFormatter({
- //format information
+ // format information
id: "lint-xml",
name: "Lint XML format",
@@ -1,5 +1,5 @@
CSSLint.addFormatter({
- //format information
+ // format information
id: "text",
name: "Plain Text",
@@ -42,7 +42,7 @@ CSSLint.addFormatter({
if (messages.length === 1) {
output += "is 1 problem";
} else {
- output += "are " + messages.length + " problems";
+ output += "are " + messages.length + " problems";
}
output += " in " + filename + ".";
@@ -4,14 +4,14 @@
CSSLint.addRule({
- //rule information
+ // rule information
id: "adjoining-classes",
name: "Disallow adjoining classes",
desc: "Don't use adjoining classes.",
url: "https://github.com/CSSLint/csslint/wiki/Disallow-adjoining-classes",
browsers: "IE6",
- //initialization
+ // initialization
init: function(parser, reporter) {
"use strict";
var rule = this;
@@ -3,14 +3,14 @@
*/
CSSLint.addRule({
- //rule information
+ // rule information
id: "box-model",
name: "Beware of broken box size",
desc: "Don't use width or height when using padding or border.",
url: "https://github.com/CSSLint/csslint/wiki/Beware-of-box-model-size",
browsers: "All",
- //initialization
+ // initialization
init: function(parser, reporter) {
"use strict";
var rule = this,
@@ -46,7 +46,7 @@ CSSLint.addRule({
for (prop in heightProperties) {
if (heightProperties.hasOwnProperty(prop) && properties[prop]) {
value = properties[prop].value;
- //special case for padding
+ // special case for padding
if (!(prop === "padding" && value.parts.length === 2 && value.parts[0].value === 0)) {
reporter.report("Using height with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule);
}
Oops, something went wrong.

0 comments on commit a9de086

Please sign in to comment.