-
Notifications
You must be signed in to change notification settings - Fork 146
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: code style format #994
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: e99b586 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #994 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 720 720
Lines 22210 22210
Branches 1287 1287
=========================================
Hits 22210 22210 ☔ View full report in Codecov by Sentry. |
@@ -1,5 +1,6 @@ | |||
import React from 'react'; | |||
import { ConnectModal, ConnectModalProps } from '@ant-design/web3'; | |||
import type { ConnectModalProps } from '@ant-design/web3'; | |||
import { ConnectModal } from '@ant-design/web3'; |
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.
这块要讨论下,目前项目里有两种写法:
// 第一种
import { Foo, type Bar } from 'xxx';
// 第二种
import { Foo } from 'xxx';
import type { Bar } from 'xxx';
从语法上来说,第一种被 tsc 支持的时间更晚,但看起来会更简单,大家什么看法呢
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.
感觉都可以,一般如果 type 比较多就用第二种,如果只有一两个就用第一种,感觉写的时怎么简洁怎么来,不用来纠结
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.
第二种写法的优点是更清晰,明确地区分了值导入和类型导入。这可以使你的代码更易于理解,特别是对于那些不熟悉 TypeScript 的开发者, 所以在用于demo的时候好像第二种更好。
不过其实确实不用关心这一块,我是运行插件命令 eslint fix, 推荐我用2写法 然后统一修复的。
@@ -1,6 +1,6 @@ | |||
import type { Wallet, WalletMetadata } from '@ant-design/web3-common'; |
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.
这种也需要 changelog 的,不然发不出版本
No description provided.