added eslint & use strict

This commit is contained in:
soulgalore 2015-01-28 15:42:07 +01:00
parent 0d0af1e21f
commit 3d4f4bc75f
96 changed files with 223 additions and 20 deletions

View File

@ -1,5 +1,13 @@
#!/usr/bin/env node
/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Sitespeed = require('../lib/sitespeed'),
config = require('../lib/cli'),
winston = require('winston');

View File

@ -4,8 +4,10 @@
* and other contributors
* Released under the Apache 2.0 License
*/
var Stats = require('fast-stats').Stats;
var util = require('../util/util');
'use strict';
var Stats = require('fast-stats').Stats,
util = require('../util/util');
/**
* Create a aggregator that collects and aggregates statistics from web pages.

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Stats = require('fast-stats').Stats;
var util = require('../../util/util');
var timeMetrics = {};

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator'),
winston = require('winston');

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('scoreGPSI', 'Google Page Speed Insights Score',

View File

@ -4,8 +4,9 @@
* and other contributors
* Released under the Apache 2.0 License
*/
var Stats = require('fast-stats').Stats;
var util = require('../../util/util');
'use strict';
var Stats = require('fast-stats').Stats,
util = require('../../util/util');
var timeMetrics = {};
var descriptions = {};
@ -70,4 +71,4 @@ exports.generateResults = function() {
exports.clear = function() {
timeMetrics = {};
};
};

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Stats = require('fast-stats').Stats;
var util = require('../../util/util');
var timeMetrics = {};

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('TTFBWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('BytesWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('FirstPaintWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('ImageSavingsWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('ImageTotalWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('LoadTimeWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('RenderWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('RequestsWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('ServerRTTWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('SpeedIndexWPT',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('userTiming',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var WPTAggregator = require('../wptAggregator');
module.exports = new WPTAggregator('VisualCompleteWPT',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../util/util');
var WPTMetric = require('./wptMetric');
var views = ['firstView', 'repeatView'];

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Stats = require('fast-stats').Stats;
function WPTMetric(metricName, view, location, browser, connectivity) {

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('browserScaledImages',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../../util/yslowUtil');
var Aggregator = require('../aggregator');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('criticalPathScore',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('cssImagesPerPage',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('cssPerPage', 'Number of CSS files per page',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('cssWeight', 'CSS Weight',

View File

@ -4,8 +4,10 @@
* and other contributors
* Released under the Apache 2.0 License
*/
var Aggregator = require('../aggregator');
var util = require('../../util/yslowUtil');
'use strict';
var Aggregator = require('../aggregator'),
util = require('../../util/yslowUtil');
module.exports = new Aggregator('cssWeightPerPage', 'CSS File Weight Per Page',
'Do not download large front-end CSS framework when you only use small parts of it.',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('docWeight', 'Document Weight',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('domElements', 'Number of DOM elements',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('fontsPerPage', 'Number of font files per page',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('imagesPerPage', 'Number of images per page',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('imageWeight', 'Image Weight',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
var util = require('../../util/yslowUtil');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('jsPerPage', 'Number of JS files per page',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('jsSyncInHead',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('jsWeight', 'JS Weight',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
var util = require('../../util/yslowUtil');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../../util/yslowUtil');
var Aggregator = require('../aggregator');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('noDuplicates', 'Remove duplicate JS and CSS',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../../util/yslowUtil');
var Aggregator = require('../aggregator');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../../util/yslowUtil');
var Aggregator = require('../aggregator');

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('pagesWithSPOF', 'Pages with SPOF',

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('redirectsPerPage', 'Redirects Per Page',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('requests', 'Number of requests per page',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../../util/yslowUtil');
var Aggregator = require('../aggregator');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('requestsWithoutGzip', 'Requests without GZip',

View File

@ -1,3 +1,10 @@
/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('ruleScore', 'Rule Score',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../../util/yslowUtil');
var Aggregator = require('../aggregator');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Aggregator = require('../aggregator');
module.exports = new Aggregator('spofPerPage',

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../../util/yslowUtil');
var Aggregator = require('../aggregator');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var yslow = require('./yslow'),
gpsi = require('./gpsi'),
browsertime = require('./browsertime'),

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../util/util'),
fs = require('fs-extra'),

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var path = require('path'),
util = require('../util/util'),

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var path = require('path'),
childProcess = require('child_process'),
phantomPath = require('phantomjs').path,

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var path = require('path'),
childProcess = require('child_process'),
phantomPath = require('phantomjs').path,

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var path = require('path'),
util = require('../util/util'),

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var path = require('path'),
childProcess = require('child_process'),
phantomPath = require('phantomjs').path,

View File

@ -1,3 +1,10 @@
/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var path = require('path'),
dateFormat = require('dateformat'),
fs = require('fs-extra'),

View File

@ -1,3 +1,11 @@
/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var crawler = require('./crawler/crawler'),
Analyzer = require('./analyze/analyzer'),
SiteHTMLRenderer = require('./siteHTMLRenderer'),

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var fs = require('fs-extra'),
fileHelper = require('./util/fileHelpers'),
defaultConfig = require('../conf/defaultConfig'),

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var fs = require('fs-extra'),
path = require('path'),
winston = require('winston'),

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../util/util'),
yslowUtil = require('../util/yslowUtil'),
@ -49,4 +50,4 @@ exports.generateResults = function() {
exports.clear = function() {
assets = {};
};
};

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../util/util'),
assets = {},

View File

@ -4,7 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../util/util'),
domains = {},
RequestTiming = require('../requestTiming'),

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('../util/util'),
yslowUtil = require('../util/yslowUtil');

View File

@ -1,3 +1,10 @@
/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var urlParser = require('url'),
defaultConfig = require('../conf/defaultConfig'),
dateFormat = require('dateformat'),

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var spawn = require('cross-spawn'),
path = require('path'),
urlParser = require('url'),

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var util = require('./util/util'),
winston = require('winston'),
net = require('net');

View File

@ -4,8 +4,10 @@
* and other contributors
* Released under the Apache 2.0 License
*/
var Stats = require('fast-stats').Stats;
var util = require('../util/util');
'use strict';
var Stats = require('fast-stats').Stats,
util = require('../util/util');
var timeMetrics = ['domainLookupTime', 'redirectionTime', 'serverConnectionTime', 'serverResponseTime',
'pageDownloadTime', 'domInteractiveTime', 'domContentLoadedTime', 'pageLoadTime', 'frontEndTime', 'backEndTime'
];

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var fs = require('fs-extra'),
path = require('path');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var render = require('../util/htmlRenderer');
exports.task = function(result, config, cb) {

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var render = require('../util/htmlRenderer');
exports.task = function(result, config, cb) {

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var render = require('../util/htmlRenderer');
exports.task = function(result, config, cb) {

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var hotlistUtil = require('../util/hotlist'),
render = require('../util/htmlRenderer'),
util = require('../util/util');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var columnsMetaData = require('../../conf/columnsMetaData.json'),
render = require('../util/htmlRenderer');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var render = require('../util/htmlRenderer');
exports.task = function(result, config, cb) {

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var render = require('../util/htmlRenderer');
exports.task = function(result, config, cb) {
if (config.screenshot) {
@ -20,4 +22,4 @@ exports.task = function(result, config, cb) {
} else {
cb();
}
};
};

View File

@ -4,10 +4,11 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var async = require('async'),
render = require('../util/htmlRenderer');
exports.task = function(result, config, cb) {
if (config.html) {
// TODO change to reduce

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Graphite = require('../graphite');
exports.task = function(result, config, cb) {
@ -16,4 +17,4 @@ exports.task = function(result, config, cb) {
cb();
}
};
};

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var path = require('path'),
winston = require('winston'),
fs = require('fs-extra');

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var path = require('path'),
winston = require('winston'),
fs = require('fs-extra');

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var Stats = require('fast-stats').Stats;
/**
@ -31,4 +32,4 @@ RequestTiming.prototype.stats = function() {
return this.stats;
};
module.exports = RequestTiming;
module.exports = RequestTiming;

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var ySlowUtil = require('./util/yslowUtil'),
util = require('./util/util'),
render = require('./util/htmlRenderer');

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var render = require('./util/htmlRenderer'),
columnsMetaData = require('../conf/columnsMetaData.json');

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under theApache 2.0 License
*/
'use strict';
var path = require('path'),
async = require('async'),
conf = require('./config.js'),

View File

@ -1,3 +1,11 @@
/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var builder = require('xmlbuilder');
function JUnitTestSuites(filename, config) {
@ -63,4 +71,4 @@ JUnitTestSuites.prototype.render = function(cb) {
cb();
};
module.exports = JUnitTestSuites;
module.exports = JUnitTestSuites;

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var tap = require('tape'),
EOL = require('os').EOL;
@ -35,4 +37,4 @@ exports.writeTap = function(results, cb) {
});
});
};
};

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var JUnitTestSuites = require('./jUnitTestSuites'),
tap = require('./tap'),
async = require('async'),

View File

@ -1,3 +1,10 @@
/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var fs = require('fs-extra'),
path = require('path'),
EOL = require('os').EOL,

View File

@ -4,6 +4,8 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var hb = require('handlebars'),
util = require('./util'),
yslowUtil = require('./yslowUtil');

View File

@ -1,3 +1,10 @@
/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
module.exports = {
getAssetsBySize: function(assets, limit) {
@ -86,4 +93,4 @@ module.exports = {
}
};
};

View File

@ -1,3 +1,10 @@
/**
* Sitespeed.io - How speedy is your site? (http://www.sitespeed.io)
* Copyright (c) 2014, Peter Hedenskog, Tobias Lidskog
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var fs = require('fs-extra'),
hb = require('handlebars'),
path = require('path'),

View File

@ -4,6 +4,7 @@
* and other contributors
* Released under the Apache 2.0 License
*/
'use strict';
var crypto = require('crypto'),
url = require('url'),
path = require('path'),

View File

@ -5,6 +5,8 @@
* Released under the Apache 2.0 License
*/
'use strict';
/**
* Here are utility methods handling YSlow objects,
* mostly the component object
@ -198,4 +200,4 @@ module.exports = {
);
}
};
};

View File

@ -45,7 +45,7 @@
"devDependencies": {
"mocha": "1.20.x",
"expect.js": "0.3.x",
"jshint": "2.5.x"
"eslint": "0.13.x"
},
"main": "./lib/sitespeed.js",
"dependencies": {