From 81e29c3176e464ace1f8506bbcfa17ee21d71958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86ndrew=20Rininsland?= Date: Sat, 27 May 2017 19:45:43 -0500 Subject: [PATCH] Improves linting --- .jshintrc | 15 +++------------ Gruntfile.coffee | 4 ++-- src/api.region.js | 1 - src/axis.js | 4 ++-- src/class-utils.js | 2 +- src/core.js | 6 ++---- src/index.js | 4 ++-- src/title.js | 1 - 8 files changed, 12 insertions(+), 25 deletions(-) diff --git a/.jshintrc b/.jshintrc index f5504fa..59389cc 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,4 +1,5 @@ { + "esversion": 6, "eqeqeq": true, "curly": true, "strict": false, @@ -8,7 +9,6 @@ "undef": true, "unused": true, "indent": 4, - "eqnull": true, "expr": true, "newcap": false, @@ -16,18 +16,9 @@ "bitwise": false, "browser": true, + "jasmine": true, "globals": { - "jasmine": false, - "describe": false, - "beforeEach": false, - "beforeAll": false, - "it": false, - "expect": false, - "d3": false, - "module": false, - "require": false, - "define": false + "d3": false } - } diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 745bf2a..f86ee2a 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -8,8 +8,8 @@ module.exports = (grunt) -> files: ['src/scss/*.scss'] jshint: - c3: 'c3.js' - spec: 'spec/*.js' + c3: 'src/**/*.js' + spec: 'spec/**/*.js' options: reporter: require('jshint-stylish') jshintrc: '.jshintrc' 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 78ba959..b432961 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 () {