mirror of
https://github.com/less/less.js.git
synced 2026-01-21 05:08:10 -05:00
unused variable cleanup
This commit is contained in:
@@ -3,5 +3,7 @@
|
||||
"boss": true,
|
||||
"expr": true,
|
||||
"laxbreak": true,
|
||||
"node": true
|
||||
"node": true,
|
||||
"unused": "vars",
|
||||
"noarg": true
|
||||
}
|
||||
|
||||
@@ -146,12 +146,7 @@ less.Parser.fileLoader = function (file, currentFileInfo, callback, env) {
|
||||
}
|
||||
|
||||
var urlStr = isUrl ? file : url.resolve(currentFileInfo.currentDirectory, file),
|
||||
urlObj = url.parse(urlStr),
|
||||
req = {
|
||||
host: urlObj.hostname,
|
||||
port: urlObj.port || 80,
|
||||
path: urlObj.pathname + (urlObj.search||'')
|
||||
};
|
||||
urlObj = url.parse(urlStr);
|
||||
|
||||
request.get(urlStr, function (error, res, body) {
|
||||
if (res.statusCode === 404) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
var less, tree;
|
||||
|
||||
/*global environment */
|
||||
// Node.js does not have a header file added which defines less
|
||||
if (less === undefined) {
|
||||
less = exports;
|
||||
@@ -51,8 +50,6 @@ less.Parser = function Parser(env) {
|
||||
current, // index of current chunk, in `input`
|
||||
parser;
|
||||
|
||||
var that = this;
|
||||
|
||||
// Top parser on an import tree must be sure there is one "env"
|
||||
// which will then be passed around by reference.
|
||||
if (!(env instanceof tree.parseEnv)) {
|
||||
@@ -128,7 +125,7 @@ less.Parser = function Parser(env) {
|
||||
// Parse from a token, regexp or string, and move forward if match
|
||||
//
|
||||
function $(tok) {
|
||||
var match, args, length, index, k;
|
||||
var match, length;
|
||||
|
||||
//
|
||||
// Non-terminal
|
||||
@@ -300,7 +297,7 @@ less.Parser = function Parser(env) {
|
||||
// call `callback` when done.
|
||||
//
|
||||
parse: function (str, callback) {
|
||||
var root, start, end, zone, line, lines, buff = [], c, error = null;
|
||||
var root, line, lines, error = null;
|
||||
|
||||
i = j = current = furthest = 0;
|
||||
input = str.replace(/\r\n/g, '\n');
|
||||
@@ -418,12 +415,9 @@ less.Parser = function Parser(env) {
|
||||
}
|
||||
|
||||
root.toCSS = (function (evaluate) {
|
||||
var line, lines, column;
|
||||
|
||||
return function (options, variables) {
|
||||
options = options || {};
|
||||
var importError,
|
||||
evaldRoot,
|
||||
var evaldRoot,
|
||||
css,
|
||||
evalEnv = new tree.evalEnv(options);
|
||||
|
||||
@@ -779,7 +773,7 @@ less.Parser = function Parser(env) {
|
||||
|
||||
// A variable entity useing the protective {} e.g. @{var}
|
||||
variableCurly: function () {
|
||||
var name, curly, index = i;
|
||||
var curly, index = i;
|
||||
|
||||
if (input.charAt(i) === '@' && (curly = $(/^@\{([\w-]+)\}/))) {
|
||||
return new(tree.Variable)("@" + curly[1], index, env.currentFileInfo);
|
||||
@@ -921,7 +915,7 @@ less.Parser = function Parser(env) {
|
||||
// selector for now.
|
||||
//
|
||||
call: function () {
|
||||
var elements = [], e, c, args, delim, arg, index = i, s = input.charAt(i), important = false;
|
||||
var elements = [], e, c, args, index = i, s = input.charAt(i), important = false;
|
||||
|
||||
if (s !== '.' && s !== '#') { return; }
|
||||
|
||||
@@ -1065,7 +1059,7 @@ less.Parser = function Parser(env) {
|
||||
// the `{...}` block.
|
||||
//
|
||||
definition: function () {
|
||||
var name, params = [], match, ruleset, param, value, cond, variadic = false;
|
||||
var name, params = [], match, ruleset, cond, variadic = false;
|
||||
if ((input.charAt(i) !== '.' && input.charAt(i) !== '#') ||
|
||||
peek(/^[^{]*\}/)) {
|
||||
return;
|
||||
@@ -1151,7 +1145,7 @@ less.Parser = function Parser(env) {
|
||||
// and an element name, such as a tag a class, or `*`.
|
||||
//
|
||||
element: function () {
|
||||
var e, t, c, v;
|
||||
var e, c, v;
|
||||
|
||||
c = $(this.combinator);
|
||||
|
||||
@@ -1208,7 +1202,7 @@ less.Parser = function Parser(env) {
|
||||
// Selectors are made out of one or more Elements, see above.
|
||||
//
|
||||
selector: function (isLess) {
|
||||
var sel, e, elements = [], c, extend, extendList = [], when, condition;
|
||||
var e, elements = [], c, extend, extendList = [], when, condition;
|
||||
|
||||
while ((isLess && (extend = $(this.extend))) || (isLess && (when = $(/^when/))) || (e = $(this.element))) {
|
||||
if (when) {
|
||||
@@ -1234,7 +1228,7 @@ less.Parser = function Parser(env) {
|
||||
if (extendList.length) { error("Extend must be used to extend a selector, it cannot be used on its own"); }
|
||||
},
|
||||
attribute: function () {
|
||||
var attr = '', key, val, op;
|
||||
var key, val, op;
|
||||
|
||||
if (! $('[')) { return; }
|
||||
|
||||
@@ -1467,7 +1461,7 @@ less.Parser = function Parser(env) {
|
||||
// @charset "utf-8";
|
||||
//
|
||||
directive: function () {
|
||||
var name, value, rules, identifier, e, nodes, nonVendorSpecificName,
|
||||
var name, value, rules, nonVendorSpecificName,
|
||||
hasBlock, hasIdentifier, hasExpression;
|
||||
|
||||
if (input.charAt(i) !== '@') { return; }
|
||||
@@ -1553,7 +1547,7 @@ less.Parser = function Parser(env) {
|
||||
// and before the `;`.
|
||||
//
|
||||
value: function () {
|
||||
var e, expressions = [], important;
|
||||
var e, expressions = [];
|
||||
|
||||
while (e = $(this.expression)) {
|
||||
expressions.push(e);
|
||||
@@ -1582,7 +1576,7 @@ less.Parser = function Parser(env) {
|
||||
}
|
||||
},
|
||||
multiplication: function () {
|
||||
var m, a, op, operation, isSpaced, expression = [];
|
||||
var m, a, op, operation, isSpaced;
|
||||
if (m = $(this.operand)) {
|
||||
isSpaced = isWhitespace(input.charAt(i - 1));
|
||||
while (!peek(/^\/[*\/]/) && (op = ($('/') || $('*')))) {
|
||||
@@ -1670,7 +1664,7 @@ less.Parser = function Parser(env) {
|
||||
// @var * 2
|
||||
//
|
||||
expression: function () {
|
||||
var e, delim, entities = [], d;
|
||||
var e, delim, entities = [];
|
||||
|
||||
while (e = $(this.addition) || $(this.entity)) {
|
||||
entities.push(e);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*jshint rhino:true */
|
||||
/*global name:true, less */
|
||||
/*jshint rhino:true, unused: false */
|
||||
/*global name:true, less, loadStyleSheet */
|
||||
var name;
|
||||
|
||||
function loadStyleSheet(sheet, callback, reload, remaining) {
|
||||
|
||||
@@ -113,7 +113,7 @@ tree.Dimension.prototype = {
|
||||
|
||||
convertTo: function (conversions) {
|
||||
var value = this.value, unit = this.unit.clone(),
|
||||
i, groupName, group, conversion, targetUnit, derivedConversions = {}, applyUnit;
|
||||
i, groupName, group, targetUnit, derivedConversions = {}, applyUnit;
|
||||
|
||||
if (typeof conversions === 'string') {
|
||||
for(i in tree.UnitConversions) {
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// the file has been fetched, and parsed.
|
||||
//
|
||||
tree.Import = function (path, features, options, index, currentFileInfo) {
|
||||
var that = this;
|
||||
|
||||
this.options = options;
|
||||
this.index = index;
|
||||
this.path = path;
|
||||
|
||||
@@ -193,7 +193,7 @@ tree.mixin.Definition.prototype = {
|
||||
var _arguments = [],
|
||||
mixinFrames = this.frames.concat(env.frames),
|
||||
frame = this.evalParams(env, new(tree.evalEnv)(env, mixinFrames), args, _arguments),
|
||||
context, rules, start, ruleset;
|
||||
rules, ruleset;
|
||||
|
||||
frame.rules.unshift(new(tree.Rule)('@arguments', new(tree.Expression)(_arguments).eval(env)));
|
||||
|
||||
@@ -216,7 +216,7 @@ tree.mixin.Definition.prototype = {
|
||||
return true;
|
||||
},
|
||||
matchArgs: function (args, env) {
|
||||
var argsLength = (args && args.length) || 0, len, frame;
|
||||
var argsLength = (args && args.length) || 0, len;
|
||||
|
||||
if (! this.variadic) {
|
||||
if (argsLength < this.required) { return false; }
|
||||
|
||||
@@ -435,7 +435,7 @@ tree.Ruleset.prototype = {
|
||||
},
|
||||
|
||||
mergeElementsOnToSelectors: function(elements, selectors) {
|
||||
var i, sel, extendList;
|
||||
var i, sel;
|
||||
|
||||
if (selectors.length === 0) {
|
||||
selectors.push([ new(tree.Selector)(elements) ]);
|
||||
|
||||
@@ -35,12 +35,11 @@
|
||||
return node;
|
||||
},
|
||||
visitArray: function(nodes) {
|
||||
var i, newNodes = [], visitor = this;
|
||||
var i, newNodes = [];
|
||||
for(i = 0; i < nodes.length; i++) {
|
||||
var evald = this.visit(nodes[i]);
|
||||
if (evald instanceof Array) {
|
||||
evald = this.flatten(evald);
|
||||
//evald.forEach(this.doAccept, this);
|
||||
newNodes = newNodes.concat(evald);
|
||||
} else {
|
||||
newNodes.push(evald);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
sys = require('util');
|
||||
fs = require('fs');
|
||||
|
||||
var readDirFilesSync = function(dir, regex, callback) {
|
||||
fs.readdirSync(dir).forEach(function (file) {
|
||||
|
||||
@@ -220,7 +220,7 @@ function endTest() {
|
||||
}
|
||||
|
||||
function toCSS(options, path, callback) {
|
||||
var tree, css;
|
||||
var css;
|
||||
options = options || {};
|
||||
fs.readFile(path, 'utf8', function (e, str) {
|
||||
if (e) { return callback(e); }
|
||||
|
||||
Reference in New Issue
Block a user