summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSaivan <savian@me.com>2018-02-27 02:08:37 +1100
committerSaivan <savian@me.com>2018-02-27 02:08:37 +1100
commitdc6a25c008da1d84d49ffb4902a31fc5477e578e (patch)
treeb1edf8a35054f0bf16b6a310d4ef09d5f43d1851 /src
parent15637375c5a00b64ae6b493187e5791cfadbc94f (diff)
downloadsvg.js-dc6a25c008da1d84d49ffb4902a31fc5477e578e.tar.gz
svg.js-dc6a25c008da1d84d49ffb4902a31fc5477e578e.zip
Actually added the linter to gulp and fixed most errors
This commit fixes most of the errors raised by standard. There is still a strange call error, but that will be the focus of the next commit
Diffstat (limited to 'src')
-rw-r--r--src/HtmlNode.js2
-rw-r--r--src/array.js2
-rw-r--r--src/boxes.js2
-rw-r--r--src/color.js2
-rw-r--r--src/css.js2
-rw-r--r--src/element.js1
-rw-r--r--src/ellipse.js2
-rw-r--r--src/fx.js2
-rw-r--r--src/helpers.js2
-rw-r--r--src/line.js2
-rw-r--r--src/matrix.js11
-rw-r--r--src/parent.js2
-rw-r--r--src/path.js4
-rw-r--r--src/patharray.js6
-rw-r--r--src/pointarray.js2
-rw-r--r--src/pointed.js2
-rw-r--r--src/poly.js2
-rw-r--r--src/selector.js2
-rw-r--r--src/textpath.js2
-rw-r--r--src/transform.js12
-rw-r--r--src/use.js1
21 files changed, 47 insertions, 18 deletions
diff --git a/src/HtmlNode.js b/src/HtmlNode.js
index 37a231c..6d253a8 100644
--- a/src/HtmlNode.js
+++ b/src/HtmlNode.js
@@ -1,3 +1,5 @@
+/* global createElement */
+
SVG.HtmlNode = SVG.invent({
create: function (element) {
this.node = element
diff --git a/src/array.js b/src/array.js
index 0a1dd5a..ca51d8e 100644
--- a/src/array.js
+++ b/src/array.js
@@ -1,3 +1,5 @@
+/* global arrayClone */
+
// Module for array conversion
SVG.Array = function (array, fallback) {
array = (array || []).valueOf()
diff --git a/src/boxes.js b/src/boxes.js
index 7975ac8..a5ca1e8 100644
--- a/src/boxes.js
+++ b/src/boxes.js
@@ -1,3 +1,5 @@
+/* globals fullBox, domContains, isNulledBox, Exception */
+
SVG.Box = SVG.invent({
create: function (source) {
var base = [0, 0, 0, 0]
diff --git a/src/color.js b/src/color.js
index 9106355..8f47f70 100644
--- a/src/color.js
+++ b/src/color.js
@@ -1,3 +1,5 @@
+/* globals fullHex, compToHex */
+
// Module for color convertions
SVG.Color = function (color) {
var match
diff --git a/src/css.js b/src/css.js
index f710a77..c549bd5 100644
--- a/src/css.js
+++ b/src/css.js
@@ -1,3 +1,5 @@
+/* global camelCase */
+
SVG.extend(SVG.Element, {
// Dynamic style generator
css: function (s, v) {
diff --git a/src/element.js b/src/element.js
index 48173fd..b9feec1 100644
--- a/src/element.js
+++ b/src/element.js
@@ -1,3 +1,4 @@
+/* global proportionalSize, assignNewId, createElement, matches, is */
SVG.Element = SVG.invent({
// Initialize node
diff --git a/src/ellipse.js b/src/ellipse.js
index 42d772a..eb310f9 100644
--- a/src/ellipse.js
+++ b/src/ellipse.js
@@ -1,3 +1,5 @@
+/* global proportionalSize */
+
SVG.Circle = SVG.invent({
// Initialize node
create: 'circle',
diff --git a/src/fx.js b/src/fx.js
index c944834..a09b0a5 100644
--- a/src/fx.js
+++ b/src/fx.js
@@ -864,7 +864,7 @@ SVG.extend(SVG.FX, {
return this.plot([a, b, c, d])
}
- return this.add('plot', new (this.target().morphArray)(a))
+ return this.add('plot', new (this.target().MorphArray)(a))
},
// Add leading method
leading: function (value) {
diff --git a/src/helpers.js b/src/helpers.js
index 9fa87eb..9a7f47e 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -1,3 +1,5 @@
+/* eslint no-unused-vars: 0 */
+
function createElement (element, makeNested) {
if (element instanceof SVG.Element) return element
diff --git a/src/line.js b/src/line.js
index 67fa96b..b147218 100644
--- a/src/line.js
+++ b/src/line.js
@@ -1,3 +1,5 @@
+/* global proportionalSize */
+
SVG.Line = SVG.invent({
// Initialize node
create: 'line',
diff --git a/src/matrix.js b/src/matrix.js
index 83d0aaa..6e918d8 100644
--- a/src/matrix.js
+++ b/src/matrix.js
@@ -1,3 +1,5 @@
+/* global abcdef, arrayToMatrix, deltaTransformPoint, parseMatrix */
+
SVG.Matrix = SVG.invent({
// Initialize
create: function (source) {
@@ -7,15 +9,16 @@ SVG.Matrix = SVG.invent({
// ensure source as object
source = source instanceof SVG.Element ? source.matrixify()
: typeof source === 'string' ? arrayToMatrix(source.split(SVG.regex.delimiter).map(parseFloat))
- : arguments.length == 6 ? arrayToMatrix([].slice.call(arguments))
+ : arguments.length === 6 ? arrayToMatrix([].slice.call(arguments))
: Array.isArray(source) ? arrayToMatrix(source)
: typeof source === 'object' ? source
: base
// merge source
for (i = abcdef.length - 1; i >= 0; --i) {
- this[abcdef[i]] = source[abcdef[i]] != null ?
- source[abcdef[i]] : base[abcdef[i]]
+ this[abcdef[i]] = source[abcdef[i]] != null
+ ? source[abcdef[i]]
+ : base[abcdef[i]]
}
},
@@ -190,7 +193,5 @@ SVG.Matrix = SVG.invent({
}
return new SVG.Matrix(this.node.getScreenCTM())
}
-
}
-
})
diff --git a/src/parent.js b/src/parent.js
index 4583ebf..94523f2 100644
--- a/src/parent.js
+++ b/src/parent.js
@@ -1,3 +1,5 @@
+/* global createElement */
+
SVG.Parent = SVG.invent({
// Initialize node
create: function (node) {
diff --git a/src/path.js b/src/path.js
index 041027b..db3929b 100644
--- a/src/path.js
+++ b/src/path.js
@@ -1,3 +1,5 @@
+/* global proportionalSize */
+
SVG.Path = SVG.invent({
// Initialize node
create: 'path',
@@ -8,7 +10,7 @@ SVG.Path = SVG.invent({
// Add class methods
extend: {
// Define morphable array
- morphArray: SVG.PathArray,
+ MorphArray: SVG.PathArray,
// Get array
array: function () {
return this._array || (this._array = new SVG.PathArray(this.attr('d')))
diff --git a/src/patharray.js b/src/patharray.js
index d1b9420..d9ffecd 100644
--- a/src/patharray.js
+++ b/src/patharray.js
@@ -1,3 +1,5 @@
+/* globals arrayToString, pathRegReplace */
+
var pathHandlers = {
M: function (c, p, p0) {
p.x = p0.x = c[0]
@@ -229,9 +231,7 @@ SVG.extend(SVG.PathArray, {
if (array instanceof SVG.PathArray) return array.valueOf()
// prepare for parsing
- var i, x0, y0, s, seg, arr
- var x = 0
- var y = 0
+ var s
var paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 }
if (typeof array === 'string') {
diff --git a/src/pointarray.js b/src/pointarray.js
index 3941705..ecf5c40 100644
--- a/src/pointarray.js
+++ b/src/pointarray.js
@@ -104,7 +104,7 @@ SVG.extend(SVG.PointArray, {
return this
},
-
+
// Get bounding box of points
bbox: function () {
var maxX = -Infinity
diff --git a/src/pointed.js b/src/pointed.js
index 901b87b..6493964 100644
--- a/src/pointed.js
+++ b/src/pointed.js
@@ -1,7 +1,7 @@
// unify all point to point elements
SVG.extend([SVG.Line, SVG.Polyline, SVG.Polygon], {
// Define morphable array
- morphArray: SVG.PointArray,
+ MorphArray: SVG.PointArray,
// Move by left top corner over x-axis
x: function (x) {
return x == null ? this.bbox().x : this.move(x, this.bbox().y)
diff --git a/src/poly.js b/src/poly.js
index db29797..9625776 100644
--- a/src/poly.js
+++ b/src/poly.js
@@ -1,3 +1,5 @@
+/* global proportionalSize */
+
SVG.Polyline = SVG.invent({
// Initialize node
create: 'polyline',
diff --git a/src/selector.js b/src/selector.js
index 8627521..b4ea05f 100644
--- a/src/selector.js
+++ b/src/selector.js
@@ -1,3 +1,5 @@
+/* global idFromReference */
+
// Method for getting an element by id
SVG.get = function (id) {
var node = document.getElementById(idFromReference(id) || id)
diff --git a/src/textpath.js b/src/textpath.js
index 8362940..561f147 100644
--- a/src/textpath.js
+++ b/src/textpath.js
@@ -10,7 +10,7 @@ SVG.TextPath = SVG.invent({
// Add parent method
extend: {
- morphArray: SVG.PathArray,
+ MorphArray: SVG.PathArray,
// return the array of the path track element
array: function () {
var track = this.track()
diff --git a/src/transform.js b/src/transform.js
index b6beb0d..54e9900 100644
--- a/src/transform.js
+++ b/src/transform.js
@@ -1,3 +1,4 @@
+/* global ensureCentre, capitalize, arrayToMatrix */
SVG.extend(SVG.Element, {
// Add transformations
@@ -65,8 +66,8 @@ SVG.extend(SVG.Element, {
if (!relative) {
// absolute; reset skew values
- var e = matrix.extract()
- matrix = matrix.multiply(new SVG.Matrix().skew(e.skewX, e.skewY, o.cx, o.cy).inverse())
+ var el = matrix.extract()
+ matrix = matrix.multiply(new SVG.Matrix().skew(el.skewX, el.skewY, el.cx, el.cy).inverse())
}
matrix = matrix.skew(o.skewX, o.skewY, o.cx, o.cy)
@@ -227,15 +228,16 @@ SVG.Transformation = SVG.invent({
create: function (source, inversed) {
if (arguments.length > 1 && typeof inversed !== 'boolean') {
- return this.constructor.call(this, [].slice.call(arguments))
+ return this.constructor.bind(this)([].slice.call(arguments))
}
+ var i, len
if (Array.isArray(source)) {
- for (var i = 0, len = this.arguments.length; i < len; ++i) {
+ for (i = 0, len = this.arguments.length; i < len; ++i) {
this[this.arguments[i]] = source[i]
}
} else if (typeof source === 'object') {
- for (var i = 0, len = this.arguments.length; i < len; ++i) {
+ for (i = 0, len = this.arguments.length; i < len; ++i) {
this[this.arguments[i]] = source[this.arguments[i]]
}
}
diff --git a/src/use.js b/src/use.js
index 02bee12..2b8e65e 100644
--- a/src/use.js
+++ b/src/use.js
@@ -1,3 +1,4 @@
+
SVG.Use = SVG.invent({
// Initialize node
create: 'use',