Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hengkx committed Sep 16, 2020
1 parent b878297 commit 9d676eb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ module.exports = {
// https://github.com/typescript-eslint/typescript-eslint/issues/2540#issuecomment-692866111
'no-use-before-define': 0,
'@typescript-eslint/no-use-before-define': 2,
'no-shadow': 0,
'@typescript-eslint/no-shadow': [2, { ignoreTypeValueShadow: true }],
// https://github.com/typescript-eslint/typescript-eslint/issues/2528#issuecomment-689369395
'no-undef': 0,
},
globals: {
gtag: true,
Expand Down
2 changes: 1 addition & 1 deletion components/_util/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const tupleNum = <T extends number[]>(...args: T) => args;
* https://stackoverflow.com/a/59187769
* Extract the type of an element of an array/tuple without performing indexing
*/
export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer E)[] ? E : never;
export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer F)[] ? F : never;

/**
* https://github.com/Microsoft/TypeScript/issues/29729
Expand Down
4 changes: 2 additions & 2 deletions components/date-picker/generatePicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function generatePicker<DateType>(generateConfig: GenerateConfig<DateType>) {
const RangePicker = generateRangePicker(generateConfig);

// =========================== Export ===========================
type MergedDatePicker = typeof DatePicker & {
type MergedDatePickerType = typeof DatePicker & {
WeekPicker: typeof WeekPicker;
MonthPicker: typeof MonthPicker;
YearPicker: typeof YearPicker;
Expand All @@ -145,7 +145,7 @@ function generatePicker<DateType>(generateConfig: GenerateConfig<DateType>) {
QuarterPicker: typeof QuarterPicker;
};

const MergedDatePicker = DatePicker as MergedDatePicker;
const MergedDatePicker = DatePicker as MergedDatePickerType;
MergedDatePicker.WeekPicker = WeekPicker;
MergedDatePicker.MonthPicker = MonthPicker;
MergedDatePicker.YearPicker = YearPicker;
Expand Down
7 changes: 4 additions & 3 deletions components/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import List from './FormList';
import { FormProvider } from './context';
import devWarning from '../_util/devWarning';

type InternalForm = typeof InternalForm;
interface Form extends InternalForm {
type InternalFormType = typeof InternalForm;

interface FormInterface extends InternalFormType {
useForm: typeof useForm;
Item: typeof Item;
List: typeof List;
Expand All @@ -16,7 +17,7 @@ interface Form extends InternalForm {
create: () => void;
}

const Form: Form = InternalForm as Form;
const Form = InternalForm as FormInterface;

Form.Item = Item;
Form.List = List;
Expand Down
4 changes: 2 additions & 2 deletions components/modal/confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface ModalStaticFunctions {
export default function confirm(config: ModalFuncProps) {
const div = document.createElement('div');
document.body.appendChild(div);
// eslint-disable-next-line no-use-before-define
// eslint-disable-next-line @typescript-eslint/no-use-before-define
let currentConfig = { ...config, close, visible: true } as any;

function destroy(...args: any[]) {
Expand All @@ -47,7 +47,7 @@ export default function confirm(config: ModalFuncProps) {
}
for (let i = 0; i < destroyFns.length; i++) {
const fn = destroyFns[i];
// eslint-disable-next-line no-use-before-define
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (fn === close) {
destroyFns.splice(i, 1);
break;
Expand Down
2 changes: 1 addition & 1 deletion components/transfer/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint no-use-before-define: "off" */
/* eslint @typescript-eslint/no-use-before-define: "off" */
import React from 'react';
import { render, mount } from 'enzyme';
import Transfer from '..';
Expand Down

0 comments on commit 9d676eb

Please sign in to comment.