[improvement] optimize eslint-disable (#4070)
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user