Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies to latest, fix spec linting errors #975

Merged
merged 4 commits into from
Aug 25, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 22 additions & 78 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -1,87 +1,31 @@
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireOperatorBeforeLineBreak": true,
"preset": "google",
"maximumLineLength": {
"value": 120,
"allowComments": true,
"allowRegex": true
"value": 140
},
"validateIndentation": 4,
"validateQuoteMarks": "'",
"disallowMultipleLineStrings": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBinaryOperators": [
"=",
"+=",
"-=",
"*=",
"/=",
"%=",
"<<=",
">>=",
">>>=",
"&=",
"|=",
"^=",
"+=",
"+",
"-",
"*",
"/",
"%",
"<<",
">>",
">>>",
"&",
"|",
"^",
"&&",
"||",
"===",
"==",
">=",
"<=",
"<",
">",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": true,
"requireSpacesInConditionalExpression": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInForStatement": true,
"requireLineFeedAtFileEnd": true,
"disallowMultipleVarDecl": null,
"requireSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInsideObjectBrackets": "all",
"disallowSpacesInsideArrayBrackets": "all",
"disallowSpacesInsideParentheses": true,
"validateJSDoc": {
"requireSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionExpression": null,
"disallowSpacesInAnonymousFunctionExpression": null,
"disallowSpacesInFunctionDeclaration": null,
"jsDoc": {
"checkAnnotations": "closurecompiler",
"checkParamNames": true,
"requireParamTypes": true
"requireParamTypes": true,
"checkRedundantParams": true,
"checkReturnTypes": true,
"checkRedundantReturns": true,
"requireReturnTypes": true,
"checkTypes": "capitalizedNativeCase",
"checkRedundantAccess": true
},
"disallowMultipleLineBreaks": true
"esnext": true
}
64 changes: 52 additions & 12 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,28 +1,68 @@
{
"browser": true,
"bitwise": false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, we do have bitwise operators in portions of the code. Turn this off to find them...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting. all of those look legitimate except for this one:

   src/data-table.js
    106 |            bAllFunctions = bAllFunctions & (typeof f === 'function');

which i'll fix when i merge this for the next beta release. it's harmless, but one still shouldn't use bitwise for booleans.

then there's the annoying but apparently very fast n | 0...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://jsperf.com/floor-vs-parseint-vs-bitwise

25% faster than Math.floor, but likely negligible performance hit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, it's probably not helping anything. our bottleneck is the DOM, not math.

"camelcase": true,
"curly": true,
"eqeqeq": true,
"evil": false,
"forin": false,
"freeze": true,
"immed": true,
"indent": 4,
"latedef": true,
"loopfunc": true,
"maxlen": 120,
"multistr": true,
"newcap": true,
"noarg": true,
"noempty": true,
"nonbsp": true,
"nonew": true,
"quotmark": "single",
"sub": true,
"noempty": true,
"plusplus": false,
"undef": true,
"unused": "vars",
"globals" : {
"strict": false,
"maxparams": 5,
"maxdepth": 4,
"maxstatements": false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files exceed 100 max statements...

"maxcomplexity": 10,
"maxlen": 140,
"quotmark": "single",
"asi": false,
"boss": false,
"debug": false,
"eqnull": false,
"esnext": true,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"loopfunc": false,
"maxerr": 50,
"multistr": false,
"notypeof": false,
"proto": false,
"scripturl": false,
"shadow": false,
"supernew": false,
"sub": true,
"validthis": false,
"noyield": false,
"browser": true,
"couch": false,
"devel": false,
"dojo": false,
"jquery": false,
"mootools": false,
"node": true,
"nonstandard": false,
"prototypejs": false,
"rhino": false,
"worker": false,
"wsh": false,
"yui": false,
"globals": {
"console": false,
"crossfilter" : false,
"d3" : false,
"dc" : false,
"crossfilter": false,
"d3": false,
"dc": false,
"global": false,
"module": false,
"process": false,
Expand Down
12 changes: 6 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ module.exports = function (grunt) {
conf: config,

concat: {
options : {
options: {
process: true,
sourceMap: true,
banner : '<%= conf.banner %>'
banner: '<%= conf.banner %>'
},
js: {
src: '<%= conf.jsFiles %>',
Expand All @@ -36,7 +36,7 @@ module.exports = function (grunt) {
mangle: true,
compress: true,
sourceMap: true,
banner : '<%= conf.banner %>'
banner: '<%= conf.banner %>'
},
src: '<%= conf.pkg.name %>.js',
dest: '<%= conf.pkg.name %>.min.js'
Expand Down Expand Up @@ -116,9 +116,9 @@ module.exports = function (grunt) {
'<%= conf.pkg.name %>.js'
]
},
coverage:{
coverage: {
src: '<%= jasmine.specs.src %>',
options:{
options: {
specs: '<%= jasmine.specs.options.specs %>',
helpers: '<%= jasmine.specs.options.helpers %>',
version: '<%= jasmine.specs.options.version %>',
Expand Down Expand Up @@ -201,7 +201,7 @@ module.exports = function (grunt) {
docco: {
options: {
dst: '<%= conf.web %>/docs',
basepath:'<%= conf.web %>'
basepath: '<%= conf.web %>'
},
howto: {
files: [
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@
"devDependencies": {
"emu": "~0.0.2",
"grunt": "~0.4.5",
"grunt-browserify": "~3.3.0",
"grunt-browserify": "~4.0.0",
"grunt-changed": "~0.1.x",
"grunt-cli": "~0.1.13",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-connect": "~0.9.0",
"grunt-contrib-copy": "~0.7.0",
"grunt-contrib-jasmine": "~0.8.2",
"grunt-contrib-connect": "~0.11.2",
"grunt-contrib-copy": "~0.8.0",
"grunt-contrib-jasmine": "~0.9.1",
"grunt-contrib-jshint": "~0.11.0",
"grunt-contrib-uglify": "~0.8.0",
"grunt-contrib-uglify": "~0.9.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-debug-task": "~0.1.5",
"grunt-docco2": "~0.2.0",
"grunt-fileindex": "^0.1.0",
"grunt-gh-pages": "~0.9.1",
"grunt-jscs": "~1.2.0",
"grunt-lib-phantomjs": "~0.6.0",
"grunt-gh-pages": "~0.10.0",
"grunt-jscs": "~2.0.0",
"grunt-lib-phantomjs": "~0.7.1",
"grunt-markdown": "~0.7.0",
"grunt-saucelabs": "~8.5.0",
"grunt-saucelabs": "~8.6.1",
"grunt-shell": "~1.1.1",
"grunt-template-jasmine-istanbul": "~0.3.2",
"load-grunt-tasks": "~3.0.0",
"load-grunt-tasks": "~3.2.0",
"jsdifflib": "~1.1.0",
"marked": "~0.3.3",
"uglify-js": "2.4.x",
"time-grunt": "~1.0.0"
"time-grunt": "~1.2.1"
},
"scripts": {
"test": "grunt test"
Expand Down
8 changes: 4 additions & 4 deletions src/bar-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ dc.barChart = function (parent, chartGroup) {
});
};

function barHeight(d) {
function barHeight (d) {
return dc.utils.safeNumber(Math.abs(_chart.y()(d.y + d.y0) - _chart.y()(d.y0)));
}

function renderBars(layer, layerIndex, d) {
function renderBars (layer, layerIndex, d) {
var bars = layer.selectAll('rect.bar')
.data(d.values, dc.pluck('x'));

Expand Down Expand Up @@ -135,7 +135,7 @@ dc.barChart = function (parent, chartGroup) {
.remove();
}

function calculateBarWidth() {
function calculateBarWidth () {
if (_barWidth === undefined) {
var numberOfBars = _chart.xUnitCount();

Expand Down Expand Up @@ -279,7 +279,7 @@ dc.barChart = function (parent, chartGroup) {
return _chart;
};

function colorFilter(color, inv) {
function colorFilter (color, inv) {
return function () {
var item = d3.select(this);
var match = item.attr('fill') === color;
Expand Down
12 changes: 6 additions & 6 deletions src/base-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,15 +369,15 @@ dc.baseMixin = function (_chart) {
return generateSvg();
};

function sizeSvg() {
function sizeSvg () {
if (_svg) {
_svg
.attr('width', _chart.width())
.attr('height', _chart.height());
}
}

function generateSvg() {
function generateSvg () {
_svg = _chart.root().append('svg');
sizeSvg();
return _svg;
Expand Down Expand Up @@ -450,7 +450,7 @@ dc.baseMixin = function (_chart) {
return _chart;
};

function checkForMandatoryAttributes(a) {
function checkForMandatoryAttributes (a) {
if (!_chart[a] || !_chart[a]()) {
throw new dc.errors.InvalidStateException('Mandatory attribute chart.' + a +
' is missing on chart[#' + _chart.anchorName() + ']');
Expand Down Expand Up @@ -488,13 +488,13 @@ dc.baseMixin = function (_chart) {
if (_chart.transitionDuration() > 0 && _svg) {
_svg.transition().duration(_chart.transitionDuration())
.each('end', function () {
_listeners['renderlet'](_chart);
_listeners.renderlet(_chart);
if (event) {
_listeners[event](_chart);
}
});
} else {
_listeners['renderlet'](_chart);
_listeners.renderlet(_chart);
if (event) {
_listeners[event](_chart);
}
Expand Down Expand Up @@ -707,7 +707,7 @@ dc.baseMixin = function (_chart) {
return _chart;
};

function applyFilters() {
function applyFilters () {
if (_chart.dimension() && _chart.dimension().filter) {
var fs = _filterHandler(_chart.dimension(), _filters);
_filters = fs ? fs : _filters;
Expand Down
6 changes: 3 additions & 3 deletions src/box-plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ dc.boxPlot = function (parent, chartGroup) {
_chart.fadeDeselectedArea();
};

function renderBoxes(boxesG) {
function renderBoxes (boxesG) {
var boxesGEnter = boxesG.enter().append('g');

boxesGEnter
Expand All @@ -161,7 +161,7 @@ dc.boxPlot = function (parent, chartGroup) {
});
}

function updateBoxes(boxesG) {
function updateBoxes (boxesG) {
dc.transition(boxesG, _chart.transitionDuration())
.attr('transform', boxTransform)
.call(_box)
Expand All @@ -170,7 +170,7 @@ dc.boxPlot = function (parent, chartGroup) {
});
}

function removeBoxes(boxesG) {
function removeBoxes (boxesG) {
boxesG.exit().remove().call(_box);
}

Expand Down
Loading