diff --git a/.jshintrc b/.jshintrc index b0fcc7c..4b465d4 100644 --- a/.jshintrc +++ b/.jshintrc @@ -8,7 +8,7 @@ "undef": true, "unused": true, "indent": 4, - + "esversion": 6, "eqnull": true, "expr": true, "newcap": false, diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 745bf2a..67317e5 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -8,7 +8,7 @@ module.exports = (grunt) -> files: ['src/scss/*.scss'] jshint: - c3: 'c3.js' + c3: 'src/**/*.js' spec: 'spec/*.js' options: reporter: require('jshint-stylish') diff --git a/package.json b/package.json index 4fe368e..5f7fba8 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "grunt-contrib-uglify": "~0.4.0", "grunt-contrib-watch": "^0.6.1", "grunt-karma": "^0.12.1", - "grunt-sass": "^1.0.0", + "grunt-sass": "^2.0.0", "jasmine-core": "^2.3.4", "jshint-stylish": "^2.1.0", "karma": "^0.13.10", diff --git a/src/api.region.js b/src/api.region.js index 14d5bce..73d6a03 100644 --- a/src/api.region.js +++ b/src/api.region.js @@ -1,6 +1,5 @@ import CLASS from './class'; import { c3_chart_fn } from './core'; -import { getOption } from './util'; c3_chart_fn.regions = function (regions) { var $$ = this.internal, config = $$.config; diff --git a/src/axis.js b/src/axis.js index 982af2d..dbf784c 100644 --- a/src/axis.js +++ b/src/axis.js @@ -1,7 +1,7 @@ import CLASS from './class'; -import { inherit, API } from './core' +import { inherit, API } from './core'; import { isValue, isFunction, isString, isEmpty } from './util'; -import c3_axis from './c3.axis' +import c3_axis from './c3.axis'; export default function Axis(owner) { API.call(this, owner); diff --git a/src/class-utils.js b/src/class-utils.js index 63d54e9..741cd01 100644 --- a/src/class-utils.js +++ b/src/class-utils.js @@ -1,4 +1,4 @@ -import CLASS from './class' +import CLASS from './class'; import { c3_chart_internal_fn } from './core'; c3_chart_internal_fn.generateClass = function (prefix, targetId) { diff --git a/src/core.js b/src/core.js index 415aa9e..909aa5f 100644 --- a/src/core.js +++ b/src/core.js @@ -1,3 +1,4 @@ +import * as d3 from 'd3'; import Axis from './axis'; import CLASS from './class'; import { isValue, isFunction, isString, isUndefined, isDefined, ceil10, asHalfPixel, diffDomain, isEmpty, notEmpty, getOption, hasValue, sanitise, getPathBox } from './util'; @@ -8,8 +9,6 @@ export var c3_chart_fn; export var c3_chart_internal_fn; export var c3_chart_internal_axis_fn; -var d3 = window.d3 ? window.d3 : typeof require !== 'undefined' ? require("d3") : undefined; - export function API(owner) { this.owner = owner; } @@ -50,7 +49,7 @@ function Chart(config) { function ChartInternal(api) { var $$ = this; - $$.d3 = d3 + $$.d3 = d3; $$.api = api; $$.config = $$.getDefaultConfig(); $$.data = {}; @@ -1084,4 +1083,3 @@ c3_chart_internal_fn.hasValue = hasValue; c3_chart_internal_fn.sanitise = sanitise; c3_chart_internal_fn.getPathBox = getPathBox; c3_chart_internal_fn.CLASS = CLASS; - diff --git a/src/index.js b/src/index.js index dd9cbeb..c09cd6f 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -import { c3 } from './core' +import { c3 } from './core'; import './polyfill'; @@ -55,4 +55,4 @@ import './ua'; import './util'; import './zoom'; -export default c3 +export default c3; diff --git a/src/title.js b/src/title.js index 6c198c5..863f6ca 100644 --- a/src/title.js +++ b/src/title.js @@ -1,4 +1,3 @@ -import CLASS from './class'; import { c3_chart_internal_fn } from './core'; c3_chart_internal_fn.initTitle = function () {