chore: fix lint issues

This commit is contained in:
chenjiahan
2020-08-21 17:45:51 +08:00
parent 9754a80597
commit 58650aeb9b
9 changed files with 345 additions and 248 deletions
+5 -4
View File
@@ -2,7 +2,8 @@ import { ref } from 'vue';
import { deepAssign } from '../utils/deep-assign';
import defaultMessages from './lang/zh-CN';
type Messages = Record<string, Record<string, any>>;
type Message = Record<string, any>;
type Messages = Record<string, Message>;
const lang = ref('zh-CN');
const messages = ref<Messages>({
@@ -10,16 +11,16 @@ const messages = ref<Messages>({
});
export default {
messages() {
messages(): Message {
return messages.value[lang.value];
},
use(newLang: string, newMessages?: object) {
use(newLang: string, newMessages?: Message) {
lang.value = newLang;
this.add({ [newLang]: newMessages });
},
add(newMessages = {}) {
add(newMessages: Message = {}) {
deepAssign(messages.value, newMessages);
},
};
+1 -1
View File
@@ -7,7 +7,7 @@ type BindEventMixinThis = {
binded: boolean;
};
type BindEventHandler = (bind: Function, isBind: boolean) => void;
type BindEventHandler = (bind: typeof on | typeof off, isBind: boolean) => void;
export function BindEventMixin(handler: BindEventHandler) {
function bind(this: BindEventMixinThis) {
+2 -8
View File
@@ -27,17 +27,11 @@
</demo-block>
<demo-block card v-if="!isWeapp" :title="t('cascade')">
<van-picker
:title="t('title')"
:columns="t('cascadeColumns')"
/>
<van-picker :title="t('title')" :columns="t('cascadeColumns')" />
</demo-block>
<demo-block card :title="t('disableOption')">
<van-picker
:title="t('title')"
:columns="t('disabledColumns')"
/>
<van-picker :title="t('title')" :columns="t('disabledColumns')" />
</demo-block>
<demo-block card :title="t('setColumnValues')">
+1 -1
View File
@@ -29,7 +29,7 @@ export function scrollTopTo(
scroller: HTMLElement,
to: number,
duration: number,
callback: Function
callback: () => void
) {
let current = getScrollTop(scroller);
+1 -1
View File
@@ -14,7 +14,7 @@ function assignKey(to: ObjectIndex, from: ObjectIndex, key: string) {
if (!hasOwnProperty.call(to, key) || !isObject(val)) {
to[key] = val;
} else {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
// eslint-disable-next-line no-use-before-define
to[key] = deepAssign(Object(to[key]), from[key]);
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { deepAssign } from './deep-assign';
export function deepClone(obj: object): object {
export function deepClone(obj: Record<string, any>): Record<string, any> {
if (Array.isArray(obj)) {
return obj.map((item) => deepClone(item));
}
+2 -1
View File
@@ -4,12 +4,13 @@ export { createNamespace } from './create';
// eslint-disable-next-line @typescript-eslint/no-empty-function
export function noop() {}
export const inBrowser = typeof window !== 'undefined'
export const inBrowser = typeof window !== 'undefined';
export function isDef(val: unknown): boolean {
return val !== undefined && val !== null;
}
// eslint-disable-next-line @typescript-eslint/ban-types
export function isFunction(val: unknown): val is Function {
return typeof val === 'function';
}