Enable no-eq-null eslint rule

This commit is contained in:
Quincy Morgan
2020-10-23 11:27:32 -04:00
parent 64ec6424db
commit 6549bcc197
3 changed files with 6 additions and 5 deletions
+1
View File
@@ -29,6 +29,7 @@
"no-console": "warn",
"no-constructor-return": "error",
"no-div-regex": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
+2 -2
View File
@@ -14,14 +14,14 @@ export function utilGetSetValue(selection, value) {
function valueFunction() {
var x = value.apply(this, arguments);
if (x == null) {
if (x === null || x === undefined) {
delete this.value;
} else if (this.value !== x) {
this.value = x;
}
}
return value == null
return (value === null || value === undefined)
? valueNull : (typeof value === 'function'
? valueFunction : valueConstant);
}
+3 -3
View File
@@ -95,7 +95,7 @@ export function utilZoomPan() {
zoom.transform(selection, function() {
var e = extent.apply(this, arguments),
t0 = _transform,
p0 = p == null ? centroid(e) : typeof p === 'function' ? p.apply(this, arguments) : p,
p0 = !p ? centroid(e) : typeof p === 'function' ? p.apply(this, arguments) : p,
p1 = t0.invert(p0),
k1 = typeof k === 'function' ? k.apply(this, arguments) : k;
return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
@@ -115,7 +115,7 @@ export function utilZoomPan() {
zoom.transform(selection, function() {
var e = extent.apply(this, arguments),
t = _transform,
p0 = p == null ? centroid(e) : typeof p === 'function' ? p.apply(this, arguments) : p;
p0 = !p ? centroid(e) : typeof p === 'function' ? p.apply(this, arguments) : p;
return constrain(d3_zoomIdentity.translate(p0[0], p0[1]).scale(t.k).translate(
typeof x === 'function' ? -x.apply(this, arguments) : -x,
typeof y === 'function' ? -y.apply(this, arguments) : -y
@@ -146,7 +146,7 @@ export function utilZoomPan() {
args = arguments,
g = gesture(that, args),
e = extent.apply(that, args),
p = point == null ? centroid(e) : typeof point === 'function' ? point.apply(that, args) : point,
p = !point ? centroid(e) : typeof point === 'function' ? point.apply(that, args) : point,
w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),
a = _transform,
b = typeof transform === 'function' ? transform.apply(that, args) : transform,