[Pkg-javascript-commits] [less.js] 08/14: enforce spaces between operators for consistency

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:29:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.3.1
in repository less.js.

commit d206167c840fe4b20ab22164989714ee07778798
Author: Luke Page <luke.a.page at gmail.com>
Date:   Tue Jan 27 22:24:12 2015 +0000

    enforce spaces between operators for consistency
---
 .jscsrc                                       | 40 ++++++++++++---------------
 bin/lessc                                     |  2 +-
 lib/less-browser/utils.js                     | 10 +++----
 lib/less-node/file-manager.js                 |  2 +-
 lib/less-node/url-file-manager.js             |  4 +--
 lib/less-rhino/index.js                       |  4 +--
 lib/less/data/unit-conversions.js             |  6 ++--
 lib/less/environment/abstract-file-manager.js |  8 +++---
 lib/less/functions/color.js                   |  8 +++---
 lib/less/functions/data-uri.js                |  2 +-
 lib/less/functions/svg.js                     |  2 +-
 lib/less/parser/parser.js                     |  4 +--
 lib/less/source-map-output.js                 |  6 ++--
 lib/less/transform-tree.js                    |  2 +-
 lib/less/tree/debug-info.js                   |  2 +-
 lib/less/tree/dimension.js                    |  2 +-
 lib/less/tree/import.js                       |  2 +-
 lib/less/tree/mixin-call.js                   |  4 +--
 lib/less/tree/quoted.js                       |  2 +-
 lib/less/tree/ruleset.js                      | 14 +++++-----
 lib/less/tree/url.js                          |  2 +-
 lib/less/tree/value.js                        |  2 +-
 lib/less/tree/variable.js                     |  2 +-
 lib/less/visitors/extend-visitor.js           | 20 +++++++-------
 lib/less/visitors/to-css-visitor.js           |  6 ++--
 test/browser/common.js                        |  6 ++--
 test/browser/jasmine-jsreporter.js            |  4 +--
 test/index.js                                 |  2 +-
 test/less-test.js                             |  4 +--
 29 files changed, 85 insertions(+), 89 deletions(-)

diff --git a/.jscsrc b/.jscsrc
index 8c22ade..6ed2b67 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -8,35 +8,31 @@
     "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
     "disallowSpacesInCallExpression": true,
     "disallowSpacesInNamedFunctionExpression": {
-        "beforeOpeningRoundBrace": true
-    },
+        "beforeOpeningRoundBrace": true},
     "disallowTrailingComma": true,
     "disallowTrailingWhitespace": true,
     "maximumLineLength": 160,
     "requireCommaBeforeLineBreak": true,
-    "requireCurlyBraces": [
-                              "if",
+    "requireCurlyBraces": [   "if",
                               "else",
                               "for",
                               "while",
                               "do",
                               "try",
-                              "catch"
-                          ],
-    "requireOperatorBeforeLineBreak": [
-        "?",
-        "=",
-        "+",
-        "-",
-        "/",
-        "*",
-        "==",
-        "===",
-        "!=",
-        "!==",
-        ">",
-        ">=",
-        "<",
-        "<="
-    ]
+                              "catch"],
+    "requireOperatorBeforeLineBreak": [ "?",
+                                        "=",
+                                        "+",
+                                        "-",
+                                        "/",
+                                        "*",
+                                        "==",
+                                        "===",
+                                        "!=",
+                                        "!==",
+                                        ">",
+                                        ">=",
+                                        "<",
+                                        "<="],
+    "requireSpaceAfterBinaryOperators": true
 }
\ No newline at end of file
diff --git a/bin/lessc b/bin/lessc
index b507b30..f1440cf 100755
--- a/bin/lessc
+++ b/bin/lessc
@@ -59,7 +59,7 @@ var checkArgFunc = function(arg, option) {
 var checkBooleanArg = function(arg) {
     var onOff = /^((on|t|true|y|yes)|(off|f|false|n|no))$/i.exec(arg);
     if (!onOff) {
-        console.log(" unable to parse "+arg+" as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
+        console.log(" unable to parse " + arg + " as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
         continueProcessing = false;
         return false;
     }
diff --git a/lib/less-browser/utils.js b/lib/less-browser/utils.js
index 7a645b1..61b0129 100644
--- a/lib/less-browser/utils.js
+++ b/lib/less-browser/utils.js
@@ -1,11 +1,11 @@
 module.exports = {
     extractId: function(href) {
         return href.replace(/^[a-z-]+:\/+?[^\/]+/, '' )  // Remove protocol & domain
-            .replace(/[\?\&]livereload=\w+/,'' )  // Remove LiveReload cachebuster
-            .replace(/^\//,                 '' )  // Remove root /
-            .replace(/\.[a-zA-Z]+$/,        '' )  // Remove simple extension
-            .replace(/[^\.\w-]+/g,          '-')  // Replace illegal characters
-            .replace(/\./g,                 ':'); // Replace dots with colons(for valid id)
+            .replace(/[\?\&]livereload=\w+/, '' )  // Remove LiveReload cachebuster
+            .replace(/^\//,                  '' )  // Remove root /
+            .replace(/\.[a-zA-Z]+$/,         '' )  // Remove simple extension
+            .replace(/[^\.\w-]+/g,           '-')  // Replace illegal characters
+            .replace(/\./g,                  ':'); // Replace dots with colons(for valid id)
     },
     addDataAttr: function(options, tag) {
         for (var opt in tag.dataset) {
diff --git a/lib/less-node/file-manager.js b/lib/less-node/file-manager.js
index 242632b..b98628d 100644
--- a/lib/less-node/file-manager.js
+++ b/lib/less-node/file-manager.js
@@ -63,7 +63,7 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e
 };
 
 FileManager.prototype.loadFileSync = function(filename, currentDirectory, options, environment, encoding) {
-    var fullFilename, paths, filenamesTried=[], isAbsoluteFilename = this.isPathAbsolute(filename),data;
+    var fullFilename, paths, filenamesTried = [], isAbsoluteFilename = this.isPathAbsolute(filename) , data;
     options = options || {};
 
     paths = isAbsoluteFilename ? [""] : [currentDirectory];
diff --git a/lib/less-node/url-file-manager.js b/lib/less-node/url-file-manager.js
index 5413615..3e6303a 100644
--- a/lib/less-node/url-file-manager.js
+++ b/lib/less-node/url-file-manager.js
@@ -35,7 +35,7 @@ UrlFileManager.prototype.loadFile = function(filename, currentDirectory, options
 
         request.get({uri: urlStr, strictSSL: !options.insecure }, function (error, res, body) {
             if (error) {
-                reject({ type: 'File', message: "resource '" + urlStr + "' gave this Error:\n  "+ error +"\n" });
+                reject({ type: 'File', message: "resource '" + urlStr + "' gave this Error:\n  " + error + "\n" });
                 return;
             }
             if (res && res.statusCode === 404) {
@@ -43,7 +43,7 @@ UrlFileManager.prototype.loadFile = function(filename, currentDirectory, options
                 return;
             }
             if (!body) {
-                logger.warn('Warning: Empty body (HTTP '+ res.statusCode + ') returned by "' + urlStr +'"');
+                logger.warn('Warning: Empty body (HTTP '+ res.statusCode + ') returned by "' + urlStr + '"');
             }
             fulfill({ contents: body, filename: urlStr });
         });
diff --git a/lib/less-rhino/index.js b/lib/less-rhino/index.js
index adf2de8..6efa0d6 100644
--- a/lib/less-rhino/index.js
+++ b/lib/less-rhino/index.js
@@ -114,7 +114,7 @@ less.Parser.fileLoader = function (file, currentFileInfo, callback, env) {
 
     var j = file.lastIndexOf('/');
     if(newFileInfo.relativeUrls && !/^(?:[a-z-]+:|\/)/.test(file) && j != -1) {
-        var relativeSubDirectory = file.slice(0, j+1);
+        var relativeSubDirectory = file.slice(0, j + 1);
         newFileInfo.rootpath = newFileInfo.rootpath + relativeSubDirectory; // append (sub|sup) directory path of imported file
     }
     newFileInfo.currentDirectory = path;
@@ -177,7 +177,7 @@ function writeFile(filename, content) {
     var checkBooleanArg = function(arg) {
         var onOff = /^((on|t|true|y|yes)|(off|f|false|n|no))$/i.exec(arg);
         if (!onOff) {
-            print(" unable to parse "+arg+" as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
+            print(" unable to parse " + arg + " as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
             continueProcessing = false;
             return false;
         }
diff --git a/lib/less/data/unit-conversions.js b/lib/less/data/unit-conversions.js
index 628f13d..da292ab 100644
--- a/lib/less/data/unit-conversions.js
+++ b/lib/less/data/unit-conversions.js
@@ -13,9 +13,9 @@ module.exports = {
         'ms': 0.001
     },
     angle: {
-        'rad': 1/(2*Math.PI),
-        'deg': 1/360,
-        'grad': 1/400,
+        'rad': 1 / (2 * Math.PI),
+        'deg': 1 / 360,
+        'grad': 1 / 400,
         'turn': 1
     }
 };
\ No newline at end of file
diff --git a/lib/less/environment/abstract-file-manager.js b/lib/less/environment/abstract-file-manager.js
index 11d6f20..1efddbf 100644
--- a/lib/less/environment/abstract-file-manager.js
+++ b/lib/less/environment/abstract-file-manager.js
@@ -53,10 +53,10 @@ abstractFileManager.prototype.pathDiff = function pathDiff(url, baseUrl) {
     }
     baseUrlDirectories = baseUrlParts.directories.slice(i);
     urlDirectories = urlParts.directories.slice(i);
-    for(i = 0; i < baseUrlDirectories.length-1; i++) {
+    for(i = 0; i < baseUrlDirectories.length - 1; i++) {
         diff += "../";
     }
-    for(i = 0; i < urlDirectories.length-1; i++) {
+    for(i = 0; i < urlDirectories.length - 1; i++) {
         diff += urlDirectories[i] + "/";
     }
     return diff;
@@ -81,7 +81,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba
     if (baseUrl && (!urlParts[1] || urlParts[2])) {
         baseUrlParts = baseUrl.match(urlPartsRegex);
         if (!baseUrlParts) {
-            throw new Error("Could not parse page url - '"+baseUrl+"'");
+            throw new Error("Could not parse page url - '" + baseUrl + "'");
         }
         urlParts[1] = urlParts[1] || baseUrlParts[1] || "";
         if (!urlParts[2]) {
@@ -102,7 +102,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba
 
         for(i = 0; i < directories.length; i++) {
             if (directories[i] === ".." && i > 0) {
-                directories.splice(i-1, 2);
+                directories.splice(i - 1, 2);
                 i -= 2;
             }
         }
diff --git a/lib/less/functions/color.js b/lib/less/functions/color.js
index 85d0386..0d29b42 100644
--- a/lib/less/functions/color.js
+++ b/lib/less/functions/color.js
@@ -47,7 +47,7 @@ colorFunctions = {
             h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
             if      (h * 6 < 1) { return m1 + (m2 - m1) * h * 6; }
             else if (h * 2 < 1) { return m2; }
-            else if (h * 3 < 2) { return m1 + (m2 - m1) * (2/3 - h) * 6; }
+            else if (h * 3 < 2) { return m1 + (m2 - m1) * (2 / 3 - h) * 6; }
             else                { return m1; }
         }
 
@@ -57,9 +57,9 @@ colorFunctions = {
         var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
         var m1 = l * 2 - m2;
 
-        return colorFunctions.rgba(hue(h + 1/3) * 255,
+        return colorFunctions.rgba(hue(h + 1 / 3) * 255,
             hue(h)       * 255,
-            hue(h - 1/3) * 255,
+            hue(h - 1 / 3) * 255,
             a);
     },
 
@@ -268,7 +268,7 @@ colorFunctions = {
         };
     },
     tint: function(color, amount) {
-        return colorFunctions.mix(colorFunctions.rgb(255,255,255), color, amount);
+        return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount);
     },
     shade: function(color, amount) {
         return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount);
diff --git a/lib/less/functions/data-uri.js b/lib/less/functions/data-uri.js
index c4f0f4a..2bd3738 100644
--- a/lib/less/functions/data-uri.js
+++ b/lib/less/functions/data-uri.js
@@ -22,7 +22,7 @@ module.exports = function(environment) {
 
         var fragmentStart = filePath.indexOf('#');
         var fragment = '';
-        if (fragmentStart!==-1) {
+        if (fragmentStart !== -1) {
             fragment = filePath.slice(fragmentStart);
             filePath = filePath.slice(0, fragmentStart);
         }
diff --git a/lib/less/functions/svg.js b/lib/less/functions/svg.js
index 92336d1..a3a080c 100644
--- a/lib/less/functions/svg.js
+++ b/lib/less/functions/svg.js
@@ -62,7 +62,7 @@ module.exports = function(environment) {
                 position = undefined;
             }
 
-            if (!(color instanceof Color) || (!((i === 0 || i+1 === stops.length) && position === undefined) && !(position instanceof Dimension))) {
+            if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) {
                 throwArgumentDescriptor();
             }
             positionValue = position ? position.toCSS(renderEnv) : i === 0 ? "0%" : "100%";
diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js
index 4364916..daa3b71 100644
--- a/lib/less/parser/parser.js
+++ b/lib/less/parser/parser.js
@@ -204,7 +204,7 @@ var Parser = function Parser(context, imports, fileInfo) {
         //     Ruleset (Selector '.class', [
         //         Rule ("color",  Value ([Expression [Color #fff]]))
         //         Rule ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]]))
-        //         Rule ("width",  Value ([Expression [Operation "+" [Variable "@w"][Dimension 4px]]]))
+        //         Rule ("width",  Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]]))
         //         Ruleset (Selector [Element '>', '.child'], [...])
         //     ])
         //
@@ -1610,7 +1610,7 @@ Parser.serializeVars = function(vars) {
     for (var name in vars) {
         if (Object.hasOwnProperty.call(vars, name)) {
             var value = vars[name];
-            s += ((name[0] === '@') ? '' : '@') + name +': '+ value +
+            s += ((name[0] === '@') ? '' : '@') + name + ': ' + value +
                 ((String(value).slice(-1) === ';') ? '' : ';');
         }
     }
diff --git a/lib/less/source-map-output.js b/lib/less/source-map-output.js
index c206f9f..e5af818 100644
--- a/lib/less/source-map-output.js
+++ b/lib/less/source-map-output.js
@@ -15,7 +15,7 @@ module.exports = function (environment) {
         }
         if (options.sourceMapRootpath) {
             this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\/g, '/');
-            if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1) !== '/') {
+            if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') {
                 this._sourceMapRootpath += '/';
             }
         } else {
@@ -66,11 +66,11 @@ module.exports = function (environment) {
             }
             inputSource = inputSource.substring(0, index);
             sourceLines = inputSource.split("\n");
-            sourceColumns = sourceLines[sourceLines.length-1];
+            sourceColumns = sourceLines[sourceLines.length - 1];
         }
 
         lines = chunk.split("\n");
-        columns = lines[lines.length-1];
+        columns = lines[lines.length - 1];
 
         if (fileInfo) {
             if (!mapLines) {
diff --git a/lib/less/transform-tree.js b/lib/less/transform-tree.js
index 5b2f1db..51baef6 100644
--- a/lib/less/transform-tree.js
+++ b/lib/less/transform-tree.js
@@ -45,7 +45,7 @@ module.exports = function(root, options) {
 
     if (options.pluginManager) {
         var pluginVisitors = options.pluginManager.getVisitors();
-        for(i =0; i < pluginVisitors.length; i++) {
+        for(i = 0; i < pluginVisitors.length; i++) {
             var pluginVisitor = pluginVisitors[i];
             if (pluginVisitor.isPreEvalVisitor) {
                 preEvalVisitors.push(pluginVisitor);
diff --git a/lib/less/tree/debug-info.js b/lib/less/tree/debug-info.js
index 1e79f3d..f169c22 100644
--- a/lib/less/tree/debug-info.js
+++ b/lib/less/tree/debug-info.js
@@ -1,5 +1,5 @@
 var debugInfo = function(context, ctx, lineSeparator) {
-    var result="";
+    var result = "";
     if (context.dumpLineNumbers && !context.compress) {
         switch(context.dumpLineNumbers) {
             case 'comments':
diff --git a/lib/less/tree/dimension.js b/lib/less/tree/dimension.js
index 1f8de7b..8afc9b4 100644
--- a/lib/less/tree/dimension.js
+++ b/lib/less/tree/dimension.js
@@ -25,7 +25,7 @@ Dimension.prototype.toColor = function () {
 };
 Dimension.prototype.genCSS = function (context, output) {
     if ((context && context.strictUnits) && !this.unit.isSingular()) {
-        throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());
+        throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: " + this.unit.toString());
     }
 
     var value = this.fround(context, this.value),
diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js
index 62c3325..e88e6dc 100644
--- a/lib/less/tree/import.js
+++ b/lib/less/tree/import.js
@@ -100,7 +100,7 @@ Import.prototype.evalPath = function (context) {
             var pathValue = path.value;
             // Add the base path if the import is relative
             if (pathValue && context.isPathRelative(pathValue)) {
-                path.value = rootpath +pathValue;
+                path.value = rootpath + pathValue;
             }
         }
         path.value = context.normalizePath(path.value);
diff --git a/lib/less/tree/mixin-call.js b/lib/less/tree/mixin-call.js
index 5eecf71..56c7a07 100644
--- a/lib/less/tree/mixin-call.js
+++ b/lib/less/tree/mixin-call.js
@@ -22,7 +22,7 @@ MixinCall.prototype.accept = function (visitor) {
 };
 MixinCall.prototype.eval = function (context) {
     var mixins, mixin, mixinPath, args, rules = [], match = false, i, m, f, isRecursive, isOneFound, rule,
-        candidates = [], candidate, conditionResult = [], defaultResult, defFalseEitherCase=-1,
+        candidates = [], candidate, conditionResult = [], defaultResult, defFalseEitherCase = -1,
         defNone = 0, defTrue = 1, defFalse = 2, count, originalRuleset, noArgumentsFilter;
 
     function calcDefGroup(mixin, mixinPath) {
@@ -84,7 +84,7 @@ MixinCall.prototype.eval = function (context) {
                 if (mixin.matchArgs(args, context)) {
                     candidate = {mixin: mixin, group: calcDefGroup(mixin, mixinPath)};
 
-                    if (candidate.group!==defFalseEitherCase) {
+                    if (candidate.group !== defFalseEitherCase) {
                         candidates.push(candidate);
                     }
 
diff --git a/lib/less/tree/quoted.js b/lib/less/tree/quoted.js
index 55aafa0..7ad697d 100644
--- a/lib/less/tree/quoted.js
+++ b/lib/less/tree/quoted.js
@@ -37,7 +37,7 @@ Quoted.prototype.eval = function (context) {
         do {
           value = evaluatedValue;
           evaluatedValue = value.replace(regexp, replacementFnc);
-        } while  (value!==evaluatedValue);
+        } while  (value !== evaluatedValue);
         return evaluatedValue;
     }
     value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement);
diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js
index 09239f3..2c1bb8a 100644
--- a/lib/less/tree/ruleset.js
+++ b/lib/less/tree/ruleset.js
@@ -107,7 +107,7 @@ Ruleset.prototype.eval = function (context) {
             });
             rsRules.splice.apply(rsRules, [i, 1].concat(rules));
             rsRuleCnt += rules.length - 1;
-            i += rules.length-1;
+            i += rules.length - 1;
             ruleset.resetCache();
         } else if (rsRules[i].type === "RulesetCall") {
             /*jshint loopfunc:true */
@@ -120,7 +120,7 @@ Ruleset.prototype.eval = function (context) {
             });
             rsRules.splice.apply(rsRules, [i, 1].concat(rules));
             rsRuleCnt += rules.length - 1;
-            i += rules.length-1;
+            i += rules.length - 1;
             ruleset.resetCache();
         }
     }
@@ -173,7 +173,7 @@ Ruleset.prototype.evalImports = function(context) {
             importRules = rules[i].eval(context);
             if (importRules && importRules.length) {
                 rules.splice.apply(rules, [i, 1].concat(importRules));
-                i+= importRules.length-1;
+                i+= importRules.length - 1;
             } else {
                 rules.splice(i, 1, importRules);
             }
@@ -195,7 +195,7 @@ Ruleset.prototype.makeImportant = function() {
 };
 // lets you call a css selector with a guard
 Ruleset.prototype.matchCondition = function (args, context) {
-    var lastSelector = this.selectors[this.selectors.length-1];
+    var lastSelector = this.selectors[this.selectors.length - 1];
     if (!lastSelector.evaldCondition) {
         return false;
     }
@@ -433,9 +433,9 @@ Ruleset.prototype.getIsReferenced = function() {
     var i, j, path, selector;
 
     if (this.paths) {
-        for (i=0; i<this.paths.length; i++) {
+        for (i = 0; i < this.paths.length; i++) {
             path = this.paths[i];
-            for (j=0; j<path.length; j++) {
+            for (j = 0; j < path.length; j++) {
                 if (path[j].getIsReferenced && path[j].getIsReferenced()) {
                     return true;
                 }
@@ -444,7 +444,7 @@ Ruleset.prototype.getIsReferenced = function() {
     }
 
     if (this.selectors) {
-        for (i=0;i<this.selectors.length;i++) {
+        for (i = 0; i < this.selectors.length; i++) {
             selector = this.selectors[i];
             if (selector.getIsReferenced && selector.getIsReferenced()) {
                 return true;
diff --git a/lib/less/tree/url.js b/lib/less/tree/url.js
index c61cffb..65347af 100644
--- a/lib/less/tree/url.js
+++ b/lib/less/tree/url.js
@@ -28,7 +28,7 @@ URL.prototype.eval = function (context) {
             context.isPathRelative(val.value)) {
 
             if (!val.quote) {
-                rootpath = rootpath.replace(/[\(\)'"\s]/g, function(match) { return "\\"+match; });
+                rootpath = rootpath.replace(/[\(\)'"\s]/g, function(match) { return "\\" + match; });
             }
             val.value = rootpath + val.value;
         }
diff --git a/lib/less/tree/value.js b/lib/less/tree/value.js
index 38f2a23..ba9a178 100644
--- a/lib/less/tree/value.js
+++ b/lib/less/tree/value.js
@@ -26,7 +26,7 @@ Value.prototype.genCSS = function (context, output) {
     var i;
     for(i = 0; i < this.value.length; i++) {
         this.value[i].genCSS(context, output);
-        if (i+1 < this.value.length) {
+        if (i + 1 < this.value.length) {
             output.add((context && context.compress) ? ',' : ', ');
         }
     }
diff --git a/lib/less/tree/variable.js b/lib/less/tree/variable.js
index d6b7919..9d10919 100644
--- a/lib/less/tree/variable.js
+++ b/lib/less/tree/variable.js
@@ -27,7 +27,7 @@ Variable.prototype.eval = function (context) {
         var v = frame.variable(name);
         if (v) {
             if (v.important) {
-                var importantScope = context.importantScope[context.importantScope.length-1];
+                var importantScope = context.importantScope[context.importantScope.length - 1];
                 importantScope.important = v.important;
             }
             return v.value.eval(context);
diff --git a/lib/less/visitors/extend-visitor.js b/lib/less/visitors/extend-visitor.js
index df16436..472c9fe 100644
--- a/lib/less/visitors/extend-visitor.js
+++ b/lib/less/visitors/extend-visitor.js
@@ -61,7 +61,7 @@ ExtendFinderVisitor.prototype = {
                 extend.findSelfSelectors(selectorPath);
                 extend.ruleset = rulesetNode;
                 if (j === 0) { extend.firstExtendOnThisSelectorPath = true; }
-                this.allExtendsStack[this.allExtendsStack.length-1].push(extend);
+                this.allExtendsStack[this.allExtendsStack.length - 1].push(extend);
             }
         }
 
@@ -116,7 +116,7 @@ ProcessExtendsVisitor.prototype = {
 
                 if(!indicies[extend.index + ' ' + selector]) {
                     indicies[extend.index + ' ' + selector] = true;
-                    logger.warn("extend '"+selector+"' has no matches");
+                    logger.warn("extend '" + selector + "' has no matches");
                 }
             });
     },
@@ -169,7 +169,7 @@ ProcessExtendsVisitor.prototype = {
                         newExtend.selfSelectors = newSelector;
 
                         // add the extend onto the list of extends for that selector
-                        newSelector[newSelector.length-1].extendList = [newExtend];
+                        newSelector[newSelector.length - 1].extendList = [newExtend];
 
                         // record that we need to add it.
                         extendsToAdd.push(newExtend);
@@ -209,7 +209,7 @@ ProcessExtendsVisitor.prototype = {
 
             // now process the new extends on the existing rules so that we can handle a extending b extending c extending
             // d extending e...
-            return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount+1));
+            return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1));
         } else {
             return extendsToAdd;
         }
@@ -227,7 +227,7 @@ ProcessExtendsVisitor.prototype = {
         if (rulesetNode.root) {
             return;
         }
-        var matches, pathIndex, extendIndex, allExtends = this.allExtendsStack[this.allExtendsStack.length-1],
+        var matches, pathIndex, extendIndex, allExtends = this.allExtendsStack[this.allExtendsStack.length - 1],
             selectorsToAdd = [], extendVisitor = this, selectorPath;
 
         // look at each selector path in the ruleset, find any extend matches and then copy, find and replace
@@ -238,7 +238,7 @@ ProcessExtendsVisitor.prototype = {
 
                 // extending extends happens initially, before the main pass
                 if (rulesetNode.extendOnEveryPath) { continue; }
-                var extendList = selectorPath[selectorPath.length-1].extendList;
+                var extendList = selectorPath[selectorPath.length - 1].extendList;
                 if (extendList && extendList.length) { continue; }
 
                 matches = this.findMatch(allExtends[extendIndex], selectorPath);
@@ -303,7 +303,7 @@ ProcessExtendsVisitor.prototype = {
                         potentialMatch.finished = potentialMatch.matched === needleElements.length;
                         if (potentialMatch.finished &&
                             (!extend.allowAfter &&
-                                (hackstackElementIndex+1 < hackstackSelector.elements.length || haystackSelectorIndex+1 < haystackSelectorPath.length))) {
+                                (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) {
                             potentialMatch = null;
                         }
                     }
@@ -349,7 +349,7 @@ ProcessExtendsVisitor.prototype = {
             if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) {
                 return false;
             }
-            for(var i = 0; i <elementValue1.elements.length; i++) {
+            for(var i = 0; i  < elementValue1.elements.length; i++) {
                 if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) {
                     if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) {
                         return false;
@@ -429,7 +429,7 @@ ProcessExtendsVisitor.prototype = {
     visitRulesetOut: function (rulesetNode) {
     },
     visitMedia: function (mediaNode, visitArgs) {
-        var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);
+        var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);
         newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends));
         this.allExtendsStack.push(newAllExtends);
     },
@@ -439,7 +439,7 @@ ProcessExtendsVisitor.prototype = {
         this.allExtendsStack.length = lastIndex;
     },
     visitDirective: function (directiveNode, visitArgs) {
-        var newAllExtends = directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);
+        var newAllExtends = directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);
         newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, directiveNode.allExtends));
         this.allExtendsStack.push(newAllExtends);
     },
diff --git a/lib/less/visitors/to-css-visitor.js b/lib/less/visitors/to-css-visitor.js
index 3b51ff9..1624164 100644
--- a/lib/less/visitors/to-css-visitor.js
+++ b/lib/less/visitors/to-css-visitor.js
@@ -55,7 +55,7 @@ ToCSSVisitor.prototype = {
             // be considered illegal css as it has to be on the first line
             if (this.charset) {
                 if (directiveNode.debugInfo) {
-                    var comment = new tree.Comment("/* " + directiveNode.toCSS(this._context).replace(/\n/g, "")+" */\n");
+                    var comment = new tree.Comment("/* " + directiveNode.toCSS(this._context).replace(/\n/g, "") + " */\n");
                     comment.debugInfo = directiveNode.debugInfo;
                     return this._visitor.visit(comment);
                 }
@@ -79,7 +79,7 @@ ToCSSVisitor.prototype = {
             }
 
             //the directive was not directly referenced
-            for (var r = 0; r<directiveNode.rules.rules.length; r++) {
+            for (var r = 0; r < directiveNode.rules.rules.length; r++) {
                 var rule = directiveNode.rules.rules[r];
                 if (rule.getIsReferenced && rule.getIsReferenced()) {
                     //the directive contains something that was referenced (likely by extend)
@@ -257,7 +257,7 @@ ToCSSVisitor.prototype = {
                 var spacedGroups = [];
                 var lastSpacedGroup = [];
                 parts.map(function (p) {
-                if (p.merge==="+") {
+                if (p.merge === "+") {
                     if (lastSpacedGroup.length > 0) {
                             spacedGroups.push(toExpression(lastSpacedGroup));
                         }
diff --git a/test/browser/common.js b/test/browser/common.js
index 9e89a76..6ab2da6 100644
--- a/test/browser/common.js
+++ b/test/browser/common.js
@@ -130,10 +130,10 @@ var testErrorSheet = function (sheet) {
                         .replace(/<h3>|<\/?p>|<a href="[^"]*">|<\/a>|<ul>|<\/?pre( class="?[^">]*"?)?>|<\/li>|<\/?label>/ig, "")
                         .replace(/<\/h3>/ig, " ")
                         .replace(/<li>|<\/ul>|<br>/ig, "\n"))
-                        .replace(/&/ig,"&")
+                        .replace(/&/ig, "&")
                         // for IE8
-                        .replace(/\r\n/g,"\n")
-                        .replace(/\. \nin/,". in");
+                        .replace(/\r\n/g, "\n")
+                        .replace(/\. \nin/, ". in");
                 actualErrorMsg = innerText
                     .replace(/\n\d+/g, function (lineNo) {
                         return lineNo + " ";
diff --git a/test/browser/jasmine-jsreporter.js b/test/browser/jasmine-jsreporter.js
index 4fd5569..0d55629 100644
--- a/test/browser/jasmine-jsreporter.js
+++ b/test/browser/jasmine-jsreporter.js
@@ -239,7 +239,7 @@
         suite.specs = [];
         suite.suites = [];
         suite.passed = true;
-        suite.parentId = this.suiteStack.slice(this.suiteStack.length -1)[0];
+        suite.parentId = this.suiteStack.slice(this.suiteStack.length - 1)[0];
         if (suite.parentId) {
             this.suites[suite.parentId].suites.push(suite);
         } else {
@@ -272,7 +272,7 @@
         spec = this._cacheSpec(spec);
         spec.timer = new Timer().start();
         // build up suites->spec tree as we go
-        spec.suiteId = this.suiteStack.slice(this.suiteStack.length -1)[0];
+        spec.suiteId = this.suiteStack.slice(this.suiteStack.length - 1)[0];
         this.suites[spec.suiteId].specs.push(spec);
     };
 
diff --git a/test/index.js b/test/index.js
index 7ae1560..c58e1e1 100644
--- a/test/index.js
+++ b/test/index.js
@@ -45,7 +45,7 @@ lessTester.runTestSet({globalVars: true, banner: "/**\n  * Test\n  */\n"}, "glob
 lessTester.runTestSet({modifyVars: true}, "modifyVars/",
     null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; });
 lessTester.runTestSet({urlArgs: '424242'}, "url-args/");
-lessTester.runTestSet({paths: ['test/data/','test/less/import/']}, "include-path/");
+lessTester.runTestSet({paths: ['test/data/', 'test/less/import/']}, "include-path/");
 lessTester.testSyncronous({syncImport: true}, "import");
 lessTester.testSyncronous({syncImport: true}, "css");
 lessTester.testNoOptions();
diff --git a/test/less-test.js b/test/less-test.js
index 1da1813..a69dfb2 100644
--- a/test/less-test.js
+++ b/test/less-test.js
@@ -112,8 +112,8 @@ module.exports = function() {
     function globalReplacements(input, directory) {
         var p = path.join(process.cwd(), directory),
             pathimport = path.join(process.cwd(), directory + "import/"),
-            pathesc = p.replace(/[.:/\\]/g, function(a) { return '\\' + (a=='\\' ? '\/' : a); }),
-            pathimportesc = pathimport.replace(/[.:/\\]/g, function(a) { return '\\' + (a=='\\' ? '\/' : a); });
+            pathesc = p.replace(/[.:/\\]/g, function(a) { return '\\' + (a == '\\' ? '\/' : a); }),
+            pathimportesc = pathimport.replace(/[.:/\\]/g, function(a) { return '\\' + (a == '\\' ? '\/' : a); });
 
         return input.replace(/\{path\}/g, p)
                 .replace(/\{pathesc\}/g, pathesc)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list