Commit 7e1147e7 authored by S Anand's avatar S Anand

Fix most eslint errors

parent 47dc90c6
module.exports = {
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
},
"env": {
"browser": true, // Include browser globals
"jquery": true, // Include jQuery and $
"mocha": true, // Include it(), assert(), etc
"es6": true, // Include ES6 features
},
"globals": {
"_": true, // underscore.js
"d3": true, // d3.js
},
"extends": "eslint:recommended",
"rules": {
/* Override default rules */
// "indent": ["warn", 2], // We want 2 space indentation
// "linebreak-style": ["error", "unix"], // We want UNIX style line
// "semi": ["warn", "never"], // We don't use semicolon
"no-cond-assign": ["off", "always"], // We use this a lot in loops
}
};
dist/G.min.js.gz
# Ignore test output file
test/lib/G.js
# Ignore node related items
node_modules/
npm-debug.log
# Creates G.js via ES6 modules
es6:
npm install
npm run build
......@@ -37,8 +38,8 @@ CSS= css/network.css \
all: hint dist/dbapi.min.js dist/G.min.js.gz dist/G.min.css
hint: $(G_JS) $(DB_JS)
jshint $(filter-out lib/start.js lib/end.js lib/jquery/start.js lib/jquery/end.js,$+)
lint:
eslint lib
# For size comparison: minified file
dist/G.min.js.gz: dist/G.min.js
......
let version = "0.0.10";
/*JS modules are imported here.*/
import * as url from "./lib/url.js"
export {csv} from "./lib/csv.js"
export {style, styles} from "./lib/style.js"
export {download} from "./lib/download.js"
export {wrap} from "./lib/wrap.js"
export {zoom} from "./lib/zoom.js"
import * as network from "./lib/chart/network.js"
export {version, url, network}
export {unpack} from './lib/chart/unpack.js'
export {map} from './lib/chart/map.js'
/*jQuery modules are imported here*/
import {dispatch} from "./lib/jquery/dispatch.js"
import {findall, notall, getSize} from './lib/jquery/start.js'
import {addClass, removeClass, toggleClass, hasClass} from './lib/jquery/svgdom.js'
import {aspect} from './lib/jquery/aspect.js'
import {urlfilter} from './lib/jquery/urlfilter.js'
import {search} from './lib/jquery/search.js'
import {highlight} from './lib/jquery/highlight.js'
import {panzoom} from './lib/jquery/panzoom.js'
import {reveal} from './lib/jquery/reveal.js'
import {template} from './lib/jquery/template.js'
import {doodle} from './lib/jquery/doodle.js'
if (typeof jQuery != 'undefined') {
jQuery.extend(jQuery.fn, {
dispatch: dispatch,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
hasClass: hasClass,
findall: findall,
notall: notall,
getSize: getSize,
aspect: aspect,
urlfilter: urlfilter,
search: search,
highlight: highlight,
panzoom: panzoom,
reveal: reveal,
template: template,
doodle: doodle
});
}
\ No newline at end of file
let version = "0.0.10";
// Import JS modules
import * as url from "./lib/url.js"
export {csv} from "./lib/csv.js"
export {style, styles} from "./lib/style.js"
export {download} from "./lib/download.js"
export {wrap} from "./lib/wrap.js"
export {zoom} from "./lib/zoom.js"
import * as network from "./lib/chart/network.js"
export {version, url, network}
export {unpack} from './lib/chart/unpack.js'
export {map} from './lib/chart/map.js'
/*jQuery modules are imported here*/
import {dispatch} from "./lib/jquery/dispatch.js"
import {findall, notall, getSize} from './lib/jquery/start.js'
import {addClass, removeClass, toggleClass, hasClass} from './lib/jquery/svgdom.js'
import {aspect} from './lib/jquery/aspect.js'
import {urlfilter} from './lib/jquery/urlfilter.js'
import {search} from './lib/jquery/search.js'
import {highlight} from './lib/jquery/highlight.js'
import {panzoom} from './lib/jquery/panzoom.js'
import {reveal} from './lib/jquery/reveal.js'
import {template} from './lib/jquery/template.js'
import {doodle} from './lib/jquery/doodle.js'
if (typeof jQuery != 'undefined') {
jQuery.extend(jQuery.fn, {
dispatch: dispatch,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
hasClass: hasClass,
findall: findall,
notall: notall,
getSize: getSize,
aspect: aspect,
urlfilter: urlfilter,
search: search,
highlight: highlight,
panzoom: panzoom,
reveal: reveal,
template: template,
doodle: doodle
})
}
import {unpack} from './unpack.js'
let map = function() {
var shape, // GeoJSON shape
width,
......@@ -143,4 +142,4 @@ let map = function() {
)
}
export {map}
\ No newline at end of file
export {map}
/*var _G_network = G.network = {}*/
var _G_network = {}
/* We assign functions for .draw_circle, .draw_label, etc -- so allow function assignment */
/* eslint-disable no-func-assign */
// A k-partite graph has k sets of nodes.
// Each node represents a unique value for one key.
// For example, with cricket data, I could use ['Player', 'Country', 'Ground'] as the keys.
......@@ -403,8 +404,7 @@ let force = function() {
viewbox = svg_node.viewBox.baseVal,
size = svg_node.getBoundingClientRect(),
width = viewbox.width || size.width,
height = viewbox.height || size.height,
enter
height = viewbox.height || size.height
force.size([width, height])
// Create / find the g.lines and g.circles layers
......@@ -429,7 +429,7 @@ let force = function() {
.data(links, function(d) { return d.id })
self.lines.exit().remove()
if (draw_line) {
enter = self.lines.enter()
self.lines.enter()
.append('line')
.attr('class', 'link')
draw_line(self.lines)
......@@ -439,7 +439,7 @@ let force = function() {
.data(nodes, function(d) { return d.id })
self.circles.exit().remove()
if (draw_circle) {
enter = self.circles.enter()
self.circles.enter()
.append('circle')
.attr('class', 'node')
.on('dblclick.release', _node_release)
......@@ -451,7 +451,7 @@ let force = function() {
.data(nodes, function(d) { return d.id })
self.labels.exit().remove()
if (draw_label) {
enter = self.labels.enter()
self.labels.enter()
.append('text')
.attr('class', 'node')
.on('dblclick.release', _node_release)
......@@ -535,4 +535,4 @@ var collide = {
export {kpartite, relation, force, collide}
// TODO: arrows (how to do bi-directional relations?)
// - http://www.jansipke.nl/creating-network-diagrams-with-d3-js/
// - http://jsfiddle.net/tk7Wv/2/
\ No newline at end of file
// - http://jsfiddle.net/tk7Wv/2/
G.url = {
parse: _url_parse,
unparse: _url_unparse
};
})(this);
(function(global, undefined) {
(function(global, undefined) { // eslint-disable-line no-unused-vars
var operators = /^(=|!=|~|!~|>=|<=|>|<)/,
euc = global.encodeURIComponent,
......
......@@ -27,7 +27,7 @@ try {
};
} catch (e) {
_event = function(name, options) {
var evt = global.document.createEvent('event');
var evt = document.createEvent('event');
evt.initEvent(name, options.bubbles, options.cancelable);
return evt;
};
......@@ -41,4 +41,4 @@ var dispatch = function(name, options) {
});
};
export {dispatch}
\ No newline at end of file
export {dispatch}
} // end of jQuery check
// jQuery plugins are added to this folder
// Include them only if jQuery exists
/*var $ = jQuery,
jQuery = $;
*/
// Return all values that match the selector
// AMONG and UNDER the node
// Return all values that match the selector
// AMONG and UNDER the node
var findall = function (node, selector) {
return node.filter(selector).add(node.find(selector))
};
......@@ -40,4 +38,3 @@ var getSize = function(node) {
};
export {findall, notall, getSize}
......@@ -185,4 +185,4 @@ let hasClass = function( selector ) {
return false;
};
export {addClass, removeClass, toggleClass, hasClass}
\ No newline at end of file
export {addClass, removeClass, toggleClass, hasClass}
(function(global, undefined){
var G = global.G = typeof exports == 'undefined' ? {} : exports;
G.version = "0.0.10"; // semver
// Utility global functions for use in other components.
// Convention for all internal variables: _lower_case
var _xmlns = 'http://www.w3.org/2000/xmlns/',
_xmlns_svg = 'http://www.w3.org/2000/svg',
_xmlns_xlink = 'http://www.w3.org/1999/xlink',
// Requires IE9+
_is_array = Array.isArray,
// URL
URL = global.URL || global.webkitURL
......@@ -3,8 +3,8 @@
// e.g. G.style('.item') returns last rule exactly matching '.item'
let style = function(selector) {
var styles = G.styles(selector)
return styles[styles.length - 1]
var sty = styles(selector)
return sty[sty.length - 1]
}
// e.g. G.styles(/^\.item$/i) returns all rules matching '.item'
......@@ -22,4 +22,4 @@ let styles = function(selector) {
return matches
}
export {style, styles}
\ No newline at end of file
export {style, styles}
......@@ -74,4 +74,4 @@ let zoom = function(options) {
return self
}
export {zoom}
\ No newline at end of file
export {zoom}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment