[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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 9 additions and 20 deletions

View File

@ -5,8 +5,7 @@ const Components = require('./get-components')();
const packageJson = require('../package.json'); const packageJson = require('../package.json');
const version = process.env.VERSION || packageJson.version; const version = process.env.VERSION || packageJson.version;
const tips = `/* eslint-disable */ const tips = '// This file is auto gererated by build/build-entry.js';
// This file is auto gererated by build/build-entry.js`;
function buildEntry() { function buildEntry() {
const uninstallComponents = [ const uninstallComponents = [

View File

@ -1,4 +1,3 @@
/* eslint-disable camelcase */
import AddressEdit from '..'; import AddressEdit from '..';
import areaList from '../../area/demo/area.simple'; import areaList from '../../area/demo/area.simple';
import { mount, later } from '../../../test/utils'; import { mount, later } from '../../../test/utils';

View File

@ -24,7 +24,6 @@
</template> </template>
<script> <script>
/* eslint-disable camelcase */
export default { export default {
i18n: { i18n: {
'zh-CN': { 'zh-CN': {

View File

@ -1,4 +1,3 @@
/* eslint-disable */
// This file is auto gererated by build/build-entry.js // This file is auto gererated by build/build-entry.js
import { VueConstructor } from 'vue/types'; import { VueConstructor } from 'vue/types';
import ActionSheet from './action-sheet'; import ActionSheet from './action-sheet';

View File

@ -1,4 +1,3 @@
/* eslint-disable prefer-spread */
import { createNamespace, addUnit } from '../utils'; import { createNamespace, addUnit } from '../utils';
import { emit, inherit } from '../utils/functional'; import { emit, inherit } from '../utils/functional';
import { preventDefault } from '../utils/dom/event'; import { preventDefault } from '../utils/dom/event';

View File

@ -1,4 +1,3 @@
/* eslint-disable object-shorthand */
import Search from '..'; import Search from '..';
import { mount } from '../../../test/utils'; import { mount } from '../../../test/utils';
@ -99,9 +98,7 @@ test('right-icon prop', () => {
test('right-icon slot', () => { test('right-icon slot', () => {
const wrapper = mount(Search, { const wrapper = mount(Search, {
scopedSlots: { scopedSlots: {
'right-icon'() { 'right-icon': () => 'Custom Right Icon'
return 'Custom Right Icon';
}
} }
}); });

View File

@ -1,4 +1,3 @@
/* eslint-disable camelcase */
import Vue from 'vue'; import Vue from 'vue';
import Popup from '../popup'; import Popup from '../popup';
import Toast from '../toast'; import Toast from '../toast';

View File

@ -100,7 +100,7 @@ export default createComponent({
if (value === '') { if (value === '') {
// 必填字段的校验 // 必填字段的校验
if (String(message.required) === '1') { // eslint-disable-line if (String(message.required) === '1') {
const textType = message.type === 'image' const textType = message.type === 'image'
? '请上传' ? '请上传'
: '请填写'; : '请填写';

View File

@ -1,4 +1,3 @@
/* eslint-disable */
export default { export default {
goods_id: '946755', goods_id: '946755',
quota: 15, quota: 15,

View File

@ -1,4 +1,3 @@
/* eslint-disable object-shorthand */
import { createNamespace } from '../utils'; import { createNamespace } from '../utils';
import { ChildrenMixin } from '../mixins/relation'; import { ChildrenMixin } from '../mixins/relation';
@ -30,6 +29,7 @@ export default createComponent({
}, },
watch: { watch: {
// eslint-disable-next-line object-shorthand
'parent.currentIndex'() { 'parent.currentIndex'() {
this.inited = this.inited || this.isActive; this.inited = this.inited || this.isActive;
}, },

View File

@ -1,4 +1,3 @@
/* eslint-disable no-use-before-define */
import { isDef, isObj } from '.'; import { isDef, isObj } from '.';
import { ObjectIndex } from './types'; 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') { if (!hasOwnProperty.call(to, key) || !isObj(val) || typeof val === 'function') {
to[key] = val; to[key] = val;
} else { } else {
// eslint-disable-next-line no-use-before-define
to[key] = deepAssign(Object(to[key]), from[key]); to[key] = deepAssign(Object(to[key]), from[key]);
} }
} }

View File

@ -1,21 +1,21 @@
/* eslint-disable no-empty */
/* eslint-disable getter-return */
/* eslint-disable import/no-mutable-exports */
import { isServer } from '..'; import { isServer } from '..';
import { EventHandler } from '../types'; import { EventHandler } from '../types';
// eslint-disable-next-line import/no-mutable-exports
export let supportsPassive = false; export let supportsPassive = false;
if (!isServer) { if (!isServer) {
try { try {
const opts = {}; const opts = {};
Object.defineProperty(opts, 'passive', { Object.defineProperty(opts, 'passive', {
// eslint-disable-next-line getter-return
get() { get() {
/* istanbul ignore next */ /* istanbul ignore next */
supportsPassive = true; supportsPassive = true;
} }
}); });
window.addEventListener('test-passive', null as any, opts); window.addEventListener('test-passive', null as any, opts);
// eslint-disable-next-line no-empty
} catch (e) {} } catch (e) {}
} }

View File

@ -1,5 +1,3 @@
/* eslint-disable no-self-compare */
export function isNumber(value: string): boolean { export function isNumber(value: string): boolean {
return /^\d+(\.\d+)?$/.test(value); return /^\d+(\.\d+)?$/.test(value);
} }
@ -9,5 +7,6 @@ export function isNaN(value: any): boolean {
return Number.isNaN(value); return Number.isNaN(value);
} }
// eslint-disable-next-line no-self-compare
return value !== value; return value !== value;
} }