Skip to content

Commit

Permalink
Upgrade gulp-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Jul 11, 2017
1 parent f16d8a3 commit 2580be7
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 43 deletions.
9 changes: 5 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ecmaFeatures:
modules: true
jsx: true
parserOptions:
ecmaFeatures:
modules: true
jsx: true

env:
amd: true
Expand Down Expand Up @@ -72,7 +73,7 @@ rules:
no-lone-blocks: 2
no-loop-func: 2
no-magic-number: 0
no-multi-spaces: 2
no-multi-spaces: [2, {ignoreEOLComments: true}]
no-multi-str: 2
no-native-reassign: 2
no-new-func: 2
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@
"url": "https://github.com/chartjs/Chart.js.git"
},
"devDependencies": {
"browserify": "^14.3.0",
"browserify": "^14.4.0",
"browserify-istanbul": "^2.0.0",
"bundle-collapser": "^1.2.1",
"child-process-promise": "^2.2.1",
"coveralls": "^2.13.1",
"gitbook-cli": "^2.3.0",
"gitbook-cli": "^2.3.1",
"gulp": "3.9.x",
"gulp-concat": "~2.6.x",
"gulp-connect": "~5.0.0",
"gulp-eslint": "^3.0.1",
"gulp-eslint": "^4.0.0",
"gulp-file": "^0.3.0",
"gulp-html-validator": "^0.0.5",
"gulp-insert": "~0.5.0",
"gulp-replace": "^0.5.4",
"gulp-replace": "^0.6.1",
"gulp-size": "~2.1.0",
"gulp-streamify": "^1.0.2",
"gulp-uglify": "~3.0.x",
"gulp-util": "~3.0.x",
"gulp-zip": "~4.0.0",
"jasmine": "^2.6.0",
"jasmine-core": "^2.6.2",
"jasmine-core": "^2.6.4",
"karma": "^1.7.0",
"karma-browserify": "^5.1.1",
"karma-chrome-launcher": "^2.1.1",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.1",
"karma-jasmine": "^1.1.0",
Expand All @@ -42,7 +42,7 @@
"pixelmatch": "^4.0.2",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.9.0",
"yargs": "^8.0.1"
"yargs": "^8.0.2"
},
"spm": {
"main": "Chart.js"
Expand Down
6 changes: 3 additions & 3 deletions src/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ require('./charts/Chart.Scatter')(Chart);
var plugins = [];

plugins.push(
require('./plugins/plugin.filler')(Chart),
require('./plugins/plugin.legend')(Chart),
require('./plugins/plugin.title')(Chart)
require('./plugins/plugin.filler')(Chart),
require('./plugins/plugin.legend')(Chart),
require('./plugins/plugin.title')(Chart)
);

Chart.plugins.register(plugins);
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/controller.doughnut.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ module.exports = function(Chart) {
var endAngle = startAngle + circumference;
var start = {x: Math.cos(startAngle), y: Math.sin(startAngle)};
var end = {x: Math.cos(endAngle), y: Math.sin(endAngle)};
var contains0 = (startAngle <= 0 && 0 <= endAngle) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle);
var contains0 = (startAngle <= 0 && endAngle >= 0) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle);
var contains90 = (startAngle <= Math.PI * 0.5 && Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 2.5 && Math.PI * 2.5 <= endAngle);
var contains180 = (startAngle <= -Math.PI && -Math.PI <= endAngle) || (startAngle <= Math.PI && Math.PI <= endAngle);
var contains270 = (startAngle <= -Math.PI * 0.5 && -Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 1.5 && Math.PI * 1.5 <= endAngle);
Expand Down
6 changes: 3 additions & 3 deletions src/core/core.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = function(Chart) {
* @private
*/
me.chart = me;
me.controller = me; // chart.chart.controller #inception
me.controller = me; // chart.chart.controller #inception

// Add the chart instance to the global namespace
Chart.instances[me.id] = me;
Expand Down Expand Up @@ -170,7 +170,7 @@ module.exports = function(Chart) {
// the canvas render width and height will be casted to integers so make sure that
// the canvas display style uses the same integer values to avoid blurring effect.

// Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased
// Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased
var newWidth = Math.max(0, Math.floor(helpers.getMaximumWidth(canvas)));
var newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas)));

Expand Down Expand Up @@ -707,7 +707,7 @@ module.exports = function(Chart) {
var me = this;
me.tooltip = new Chart.Tooltip({
_chart: me,
_chartInstance: me, // deprecated, backward compatibility
_chartInstance: me, // deprecated, backward compatibility
_data: me.data,
_options: me.options.tooltips
}, me);
Expand Down
7 changes: 3 additions & 4 deletions src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,9 @@ module.exports = function(Chart) {
var min = me.min;
var max = me.max;

return me.beginAtZero ? 0:
min < 0 && max < 0? max :
min > 0 && max > 0? min :
0;
return me.beginAtZero ? 0 :
min < 0 && max < 0 ? max :
min > 0 && max > 0 ? min : 0;
},

// Actually draw the scale on the canvas
Expand Down
2 changes: 1 addition & 1 deletion src/scales/scale.logarithmic.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ module.exports = function(Chart) {
if (me.isHorizontal()) {
innerDimension = me.width;
value = me.start * Math.pow(10, (pixel - me.left) * range / innerDimension);
} else { // todo: if start === 0
} else { // todo: if start === 0
innerDimension = me.height;
value = Math.pow(10, (me.bottom - pixel) * range / innerDimension) / me.start;
}
Expand Down
7 changes: 3 additions & 4 deletions src/scales/scale.radialLinear.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,9 @@ module.exports = function(Chart) {
var max = me.max;

return me.getPointPositionForValue(0,
me.beginAtZero? 0:
min < 0 && max < 0? max :
min > 0 && max > 0? min :
0);
me.beginAtZero ? 0 :
min < 0 && max < 0 ? max :
min > 0 && max > 0 ? min : 0);
},

draw: function() {
Expand Down
2 changes: 1 addition & 1 deletion test/jasmine.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function injectCSS(css) {
var head = document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.setAttribute('type', 'text/css');
if (style.styleSheet) { // IE
if (style.styleSheet) { // IE
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
Expand Down
4 changes: 2 additions & 2 deletions test/specs/controller.polarArea.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ describe('Polar area controller tests', function() {
type: 'polarArea',
data: {
datasets: [
{data: []},
{data: []}
{data: []},
{data: []}
],
labels: []
}
Expand Down
2 changes: 1 addition & 1 deletion test/specs/scale.category.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Category scale tests', function() {
padding: 0,
reverse: false,
display: true,
callback: defaultConfig.ticks.callback, // make this nicer, then check explicitly below
callback: defaultConfig.ticks.callback, // make this nicer, then check explicitly below
autoSkip: true,
autoSkipPadding: 0,
labelOffset: 0,
Expand Down
24 changes: 12 additions & 12 deletions test/specs/scale.logarithmic.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,20 +717,20 @@ describe('Logarithmic Scale tests', function() {
});

var xScale = chart.scales.xScale;
expect(xScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(495); // right - paddingRight
expect(xScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(495); // right - paddingRight
expect(xScale.getPixelForValue(1, 0, 0)).toBeCloseToPixel(37); // left + paddingLeft
expect(xScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(278); // halfway
expect(xScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(278); // halfway
expect(xScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(37); // 0 is invalid, put it on the left.

expect(xScale.getValueForPixel(495)).toBeCloseToPixel(80);
expect(xScale.getValueForPixel(48)).toBeCloseTo(1, 1e-4);
expect(xScale.getValueForPixel(278)).toBeCloseTo(10, 1e-4);

var yScale = chart.scales.yScale;
expect(yScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(32); // top + paddingTop
expect(yScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(32); // top + paddingTop
expect(yScale.getPixelForValue(1, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom
expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(246); // halfway
expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484); // 0 is invalid. force it on bottom
expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(246); // halfway
expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484); // 0 is invalid. force it on bottom

expect(yScale.getValueForPixel(32)).toBeCloseTo(80, 1e-4);
expect(yScale.getValueForPixel(484)).toBeCloseTo(1, 1e-4);
Expand Down Expand Up @@ -761,20 +761,20 @@ describe('Logarithmic Scale tests', function() {
});

var yScale = chart.scales.yScale;
expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(32); // top + paddingTop
expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom
expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(475); // minNotZero 2% from range
expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(32); // top + paddingTop
expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom
expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(475); // minNotZero 2% from range
expect(yScale.getPixelForValue(0.5, 0, 0)).toBeCloseToPixel(344);
expect(yScale.getPixelForValue(4, 0, 0)).toBeCloseToPixel(213);
expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(155);
expect(yScale.getPixelForValue(63, 0, 0)).toBeCloseToPixel(38.5);

chart.options.scales.yAxes[0].ticks.reverse = true; // Reverse mode
chart.options.scales.yAxes[0].ticks.reverse = true; // Reverse mode
chart.update();

expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom
expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(32); // top + paddingTop
expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(41); // minNotZero 2% from range
expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom
expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(32); // top + paddingTop
expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(41); // minNotZero 2% from range
expect(yScale.getPixelForValue(0.5, 0, 0)).toBeCloseToPixel(172);
expect(yScale.getPixelForValue(4, 0, 0)).toBeCloseToPixel(303);
expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(361);
Expand Down

0 comments on commit 2580be7

Please sign in to comment.