Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: prepare #46

Merged
merged 4 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
module.exports = {
extends: [require.resolve('@umijs/fabric/dist/eslint')],
rules: {
Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion docs/examples/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import classNames from 'classnames';
import CSSMotion from 'rc-motion';
import React from 'react';
import './basic.less';

interface DemoState {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/deadline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import classNames from 'classnames';
import CSSMotion from 'rc-motion';
import React from 'react';
import './basic.less';

interface DemoState {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import classNames from 'classnames';
import { CSSMotionList } from 'rc-motion';
import React from 'react';
import './list.less';

interface DemoState {
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/ssr.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import classNames from 'classnames';
import CSSMotion from 'rc-motion';
import { genCSSMotion } from 'rc-motion/es/CSSMotion';
import React from 'react';
import { hydrate } from 'react-dom';
import ReactDOMServer from 'react-dom/server';
import classNames from 'classnames';
import { genCSSMotion } from 'rc-motion/es/CSSMotion';
import CSSMotion from 'rc-motion';
import './basic.less';

const ServerCSSMotion = genCSSMotion(false);
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/transition-inside-debug.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import CSSMotion from 'rc-motion';
import React from 'react';
import './transition-inside-debug.less';

export default function TransitionInsideDebug() {
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@
"docs:deploy": "gh-pages -d .doc",
"lint": "eslint src/ --ext .tsx,.ts",
"now-build": "npm run docs:build",
"prepare": "husky install",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
"postpublish": "npm run docs:deploy",
"start": "dumi dev",
"test": "rc-test"
},
"lint-staged": {
"**/*.{js,jsx,tsx,ts,md,json}": [
"prettier --write",
"git add"
]
},
"dependencies": {
"@babel/runtime": "^7.11.1",
"classnames": "^2.2.1",
Expand All @@ -48,7 +55,6 @@
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.0.0",
"@types/classnames": "^2.2.9",
"@types/enzyme": "^3.10.5",
"@types/jest": "^26.0.8",
"@types/react": "^16.9.2",
"@types/react-dom": "^16.9.0",
Expand All @@ -57,6 +63,8 @@
"dumi": "^2.0.18",
"eslint": "^7.0.0",
"father": "^4.1.2",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"np": "^6.2.4",
"prettier": "^2.1.1",
"rc-test": "^7.0.14",
Expand Down
10 changes: 5 additions & 5 deletions src/CSSMotionList.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* eslint react/prop-types: 0 */
import * as React from 'react';
import OriginCSSMotion from './CSSMotion';
import type { CSSMotionProps } from './CSSMotion';
import { supportTransition } from './util/motion';
import OriginCSSMotion from './CSSMotion';
import type { KeyObject } from './util/diff';
import {
diffKeys,
parseKeys,
STATUS_ADD,
STATUS_KEEP,
STATUS_REMOVE,
STATUS_REMOVED,
diffKeys,
parseKeys,
} from './util/diff';
import type { KeyObject } from './util/diff';
import { supportTransition } from './util/motion';

const MOTION_PROP_NAMES = [
'eventProps',
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useDomMotionEvents.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { useRef } from 'react';

import { animationEndName, transitionEndName } from '../util/motion';
import type { MotionEvent } from '../interface';
import { animationEndName, transitionEndName } from '../util/motion';

export default (
callback: (event: MotionEvent) => void,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useIsomorphicLayoutEffect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useLayoutEffect } from 'react';
import canUseDom from 'rc-util/lib/Dom/canUseDom';
import { useEffect, useLayoutEffect } from 'react';

// It's safe to use `useLayoutEffect` but the warning is annoying
const useIsomorphicLayoutEffect = canUseDom() ? useLayoutEffect : useEffect;
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useNextFrame.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import raf from 'rc-util/lib/raf';
import * as React from 'react';

export default (): [
(callback: (info: { isCanceled: () => boolean }) => void) => void,
Expand Down
8 changes: 3 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import CSSMotion from './CSSMotion';
import CSSMotionList from './CSSMotionList';
import type { CSSMotionProps } from './CSSMotion';
import CSSMotion from './CSSMotion';
import type { CSSMotionListProps } from './CSSMotionList';
import type { MotionEventHandler, MotionEndEventHandler } from './interface';
import CSSMotionList from './CSSMotionList';
import type { MotionEndEventHandler, MotionEventHandler } from './interface';
export { default as Provider } from './context';

export { CSSMotionList };

export type {
CSSMotionProps,
CSSMotionListProps,
Expand Down
8 changes: 4 additions & 4 deletions tests/CSSMotionList.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-disable react/no-render-return-value, react/prefer-stateless-function,
react/no-multi-comp, @typescript-eslint/no-implied-eval */
import React from 'react';
import { fireEvent, render } from '@testing-library/react';
import classNames from 'classnames';
import React from 'react';
import { act } from 'react-dom/test-utils';
import { render, fireEvent } from '@testing-library/react';
import { genCSSMotionList } from '../src/CSSMotionList';
import type { CSSMotionListProps } from '../src/CSSMotionList';
import { genCSSMotion } from '../src/CSSMotion';
import type { CSSMotionListProps } from '../src/CSSMotionList';
import { genCSSMotionList } from '../src/CSSMotionList';

describe('CSSMotionList', () => {
beforeEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions tests/StrictMode.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
react/no-render-return-value, max-classes-per-file,
react/prefer-stateless-function, react/no-multi-comp
*/
import { fireEvent, render } from '@testing-library/react';
import classNames from 'classnames';
import React from 'react';
import { act } from 'react-dom/test-utils';
import classNames from 'classnames';
import { render, fireEvent } from '@testing-library/react';
// import type { CSSMotionProps } from '../src/CSSMotion';
import { genCSSMotion } from '../src/CSSMotion';
// import RefCSSMotion, { genCSSMotion } from '../src/CSSMotion';
Expand Down
2 changes: 1 addition & 1 deletion tests/util.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getTransitionName } from '../src/util/motion';
import { diffKeys } from '../src/util/diff';
import { getTransitionName } from '../src/util/motion';

describe('Util', () => {
it('getTransitionName', () => {
Expand Down