From fdec896a548496a5de69b6c9f469e2976603a7a1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 20 Feb 2021 18:37:21 +0800 Subject: [PATCH] upgrade father, fix eslint and prettier --- .eslintrc.js | 5 +--- examples/case.tsx | 7 +++-- examples/click-nested.js | 12 +------- examples/nested.js | 14 +++------- examples/simple.tsx | 26 +++++++++--------- package.json | 4 +-- src/Popup/Mask.tsx | 5 ++-- src/Popup/MobilePopupInner.tsx | 4 +-- src/Popup/PopupInner.tsx | 13 +++++---- src/Popup/index.tsx | 9 +++--- src/Popup/useStretchStyle.ts | 2 +- src/Popup/useVisibleStatus.ts | 5 ++-- src/index.tsx | 50 ++++++++++++++++++---------------- src/interface.ts | 6 ++-- src/utils/alignUtil.ts | 8 ++++-- src/utils/legacyUtil.ts | 4 +-- tsconfig.json | 16 +++++++++++ 17 files changed, 99 insertions(+), 91 deletions(-) create mode 100644 tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 75f728b1..d85cf221 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,9 +1,6 @@ -const base = require('@umijs/fabric/dist/eslint'); - module.exports = { - ...base, + extends: [require.resolve('@umijs/fabric/dist/eslint')], rules: { - ...base.rules, 'default-case': 0, 'import/no-extraneous-dependencies': 0, 'react/no-find-dom-node': 0, diff --git a/examples/case.tsx b/examples/case.tsx index 8c2f0066..d0aff15a 100644 --- a/examples/case.tsx +++ b/examples/case.tsx @@ -1,8 +1,9 @@ /* eslint no-console:0 */ import React from 'react'; -import { CSSMotionProps } from 'rc-motion'; -import Trigger, { BuildInPlacements } from '../src'; +import type { CSSMotionProps } from 'rc-motion'; +import type { BuildInPlacements } from '../src'; +import Trigger from '../src'; import './case.less'; const builtinPlacements: BuildInPlacements = { @@ -202,7 +203,7 @@ const Demo = () => { maskMotion={motion ? MaskMotion : null} maskClosable={maskClosable} stretch={stretch} - action={Object.keys(actions).filter(action => actions[action])} + action={Object.keys(actions).filter((action) => actions[action])} builtinPlacements={builtinPlacements} forceRender={forceRender} popupStyle={{ diff --git a/examples/click-nested.js b/examples/click-nested.js index c81790a4..3fd27b2a 100644 --- a/examples/click-nested.js +++ b/examples/click-nested.js @@ -37,17 +37,7 @@ const popupBorderStyle = { background: 'rgba(255, 0, 0, 0.1)', }; -function saveRef(name, component) { - this[name] = component; -} - class Test extends React.Component { - constructor(props) { - super(props); - - this.saveContainerRef = saveRef.bind(this, 'containerInstance'); - } - render() { return (
@@ -68,7 +58,7 @@ class Test extends React.Component { i am a click popup{' '}