[improvement] optimize eslint-disable (#4070)

This commit is contained in:
neverland
2019-08-08 20:01:41 +08:00
committed by GitHub
parent 5777762249
commit c74d90c561
13 changed files with 9 additions and 20 deletions
+1 -1
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-use-before-define */
import { isDef, isObj } from '.';
import { ObjectIndex } from './types';
@@ -14,6 +13,7 @@ function assignKey(to: ObjectIndex, from: ObjectIndex, key: string) {
if (!hasOwnProperty.call(to, key) || !isObj(val) || typeof val === 'function') {
to[key] = val;
} else {
// eslint-disable-next-line no-use-before-define
to[key] = deepAssign(Object(to[key]), from[key]);
}
}
+3 -3
View File
@@ -1,21 +1,21 @@
/* eslint-disable no-empty */
/* eslint-disable getter-return */
/* eslint-disable import/no-mutable-exports */
import { isServer } from '..';
import { EventHandler } from '../types';
// eslint-disable-next-line import/no-mutable-exports
export let supportsPassive = false;
if (!isServer) {
try {
const opts = {};
Object.defineProperty(opts, 'passive', {
// eslint-disable-next-line getter-return
get() {
/* istanbul ignore next */
supportsPassive = true;
}
});
window.addEventListener('test-passive', null as any, opts);
// eslint-disable-next-line no-empty
} catch (e) {}
}
+1 -2
View File
@@ -1,5 +1,3 @@
/* eslint-disable no-self-compare */
export function isNumber(value: string): boolean {
return /^\d+(\.\d+)?$/.test(value);
}
@@ -9,5 +7,6 @@ export function isNaN(value: any): boolean {
return Number.isNaN(value);
}
// eslint-disable-next-line no-self-compare
return value !== value;
}