-
-
Notifications
You must be signed in to change notification settings - Fork 161
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: use father #85
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/progress/kryv8374w |
package.json
Outdated
"rc-tools": "9.x", | ||
"react": "^16.9.0", | ||
"react-dom": "^16.9.0", | ||
"typescript": "^3.9.7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^4.0.2
PR 的过去了,push 的一直报错。 |
PR 是合到 master 后的 CI, Push 是当前 branch 的 CI。本地 |
package.json
Outdated
"eslint": "^7.6.0", | ||
"father": "^2.29.6", | ||
"np": "^6.5.0", | ||
"rc-tools": "9.x", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rc-tools 应该没用了。
Codecov Report
@@ Coverage Diff @@
## master #85 +/- ##
===========================================
+ Coverage 84.68% 99.05% +14.37%
===========================================
Files 4 3 -1
Lines 111 106 -5
Branches 24 26 +2
===========================================
+ Hits 94 105 +11
+ Misses 17 1 -16
Continue to review full report at Codecov.
|
|
||
node_js: | ||
- 10 | ||
- 12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
升级了就好了。
现在就剩下覆盖率的问题了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用例 转了下写法 就下降了 。。。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以补两个用例
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前的dialog 和 upload 咋没有覆盖率检查结果显示呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
版本的原因吧,那2个都是10
index.js
Outdated
@@ -1,4 +1,4 @@ | |||
import Progress, { Line, Circle } from './src/'; | |||
import Progress, { Line, Circle } from './src'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件应该没用了
src/interface.ts
Outdated
@@ -0,0 +1,22 @@ | |||
import * as React from 'react'; | |||
|
|||
export interface progressProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
类型定义以大写开头
@kermit-xuan 帮忙 Review 下~ |
src/Circle.tsx
Outdated
@@ -2,18 +2,26 @@ | |||
import React, { useMemo } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
导入 React 的时候最好使用 import * as React from 'React'
,否则当 tsconfig
未开启 esModuleInterop
选项时,编译会有问题。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return +percent.replace('%', ''); | ||
} | ||
|
||
function toArray(symArray) { | ||
function toArray(symArray: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里有具体类型的话,尽量写上类型,避免使用 any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toArray 一个传入 percent?: number | number[];
一个传入 string | string[] | object;
然后 下面 还用这个的返回值
😂 索性就改成 any 了
@@ -57,7 +65,7 @@ function getPathStyles(offset, percent, strokeColor, strokeWidth, gapDegree = 0, | |||
}; | |||
} | |||
|
|||
const Circle = ({ | |||
const Circle: React.FC<ProgressProps> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
函数式组件导出时,写上 displayName
属性。
|
||
const Line = ({ | ||
const Line: React.FC<ProgressProps> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
函数式组件导出时,写上 displayName
属性。
src/Line.tsx
Outdated
@@ -2,8 +2,9 @@ | |||
import React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
导入 React 的时候最好使用 import * as React from 'React',否则当 tsconfig 未开启 esModuleInterop 选项时,编译会有问题。
src/common.ts
Outdated
@@ -1,20 +1,22 @@ | |||
import { useRef, useEffect } from 'react'; | |||
import { StrokeLinecapType } from './interface'; | |||
|
|||
export const defaultProps = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultProps 最好加上类型 Partial<ProgressProps>
,另外 strokeLinecap
应该可以不用 as
@@ -60,7 +61,7 @@ const Line = ({ | |||
className={`${prefixCls}-line-path`} | |||
d={pathString} | |||
strokeLinecap={strokeLinecap} | |||
stroke={color} | |||
stroke={color as string} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 color
的类型有点迷,可以为 string
、string[]
和 object
,但是没有看见 object
用到。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
object 好像是这种的
{
0%: 'xxx'
50%: 'xxx'
100%: 'xxx',
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
明白了,Line 和 Circle 用的一个 Props 定义,但是有些字段的类型是有分叉的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我先发一个 minor 版本到 antd 再测测。 |
No description provided.