eslint-plugin-semi-design 2.60.0 → 2.61.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/README-zh_CN.md +0 -64
- package/README.md +0 -64
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-semi-design",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.61.0-alpha.1",
|
|
4
4
|
"description": "semi ui eslint plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"semi",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"bugs": {
|
|
42
42
|
"url": "https://github.com/DouyinFE/semi-design/issues"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "ba06de12d059c24363f1ef151dbf4076ea3969a5"
|
|
45
45
|
}
|
package/README-zh_CN.md
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# eslint-plugin-semi-design
|
|
2
|
-
|
|
3
|
-
Semi 仓库使用的 eslint 插件
|
|
4
|
-
|
|
5
|
-
## eslint 规则
|
|
6
|
-
|
|
7
|
-
### ✅ 不能在 semi-foundation 里引用 semi-ui
|
|
8
|
-
|
|
9
|
-
semi-ui 不应该作为 semi-foundation 的依赖。
|
|
10
|
-
|
|
11
|
-
原因:根据 Semi 的 foundation 和 adapter 设计,foundation 不应依赖 adapter。点击查看 [F/A 设计](https://bytedance.feishu.cn/wiki/wikcnOVYexosCS1Rmvb5qCsWT1f)。
|
|
12
|
-
|
|
13
|
-
### ✅ 不能在 semi-ui 和 semi-foundation 引用 lodash-es
|
|
14
|
-
|
|
15
|
-
使用 lodash 而不是 lodash-es。
|
|
16
|
-
|
|
17
|
-
原因:为了兼容 next,而 lodash-es 只提供了 es module 的产物。
|
|
18
|
-
|
|
19
|
-

|
|
20
|
-
|
|
21
|
-
点击查看[详情](https://github.com/vercel/next.js/issues/2259)。
|
|
22
|
-
|
|
23
|
-
### ✅ 不能在 semi-ui 或 semi-foundation 使用相对路径引用 packages 下的包
|
|
24
|
-
|
|
25
|
-
monorepo 下各个包之间的 import 请使用包名而不是相对路径。
|
|
26
|
-
|
|
27
|
-
原因:这两个包在用户项目的安装路径可能不在同一文件夹下,使用相对路径会找不到对应的包。
|
|
28
|
-
|
|
29
|
-
```javascript
|
|
30
|
-
// ❌ 不推荐
|
|
31
|
-
// semi-ui/input/index.tsx
|
|
32
|
-
import inputFoundation from '../semi-foundation/input/foundation';
|
|
33
|
-
|
|
34
|
-
// ✅ 推荐
|
|
35
|
-
// semi-ui/input/index.tsx
|
|
36
|
-
import inputFoundation from '@douyinfe/semi-foundation/input/foundation';
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### ✅ 不推荐在同个包下使用包名加路径引用其他模块
|
|
40
|
-
|
|
41
|
-
同一个包 import 请使用相对路径而不是引用包名。
|
|
42
|
-
|
|
43
|
-
```javascript
|
|
44
|
-
// ❌ 不推荐
|
|
45
|
-
// semi-ui/modal/Modal.tsx
|
|
46
|
-
import { Button } from '@douyinfe/semi-ui';
|
|
47
|
-
|
|
48
|
-
// ✅ 推荐
|
|
49
|
-
// semi-ui/modal/Modal.tsx
|
|
50
|
-
import Button from '../button';
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### ✅ 不能在 semi-foundation 引用 React 或 ReactDOM
|
|
54
|
-
|
|
55
|
-
```javascript
|
|
56
|
-
// ❌
|
|
57
|
-
// packages/semi-foundation/input/foundation.ts
|
|
58
|
-
import React from 'react';
|
|
59
|
-
import ReactDOM from 'react-dom';
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## 相关资料
|
|
63
|
-
|
|
64
|
-
- eslint plugin 文档:https://eslint.org/docs/developer-guide/working-with-plugins
|
package/README.md
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# eslint-plugin-semi-design
|
|
2
|
-
|
|
3
|
-
eslint plugin for semi design
|
|
4
|
-
|
|
5
|
-
## Rules
|
|
6
|
-
|
|
7
|
-
### ✅ Should not reference semi-ui in semi-foundation
|
|
8
|
-
|
|
9
|
-
semi-ui should not be used as a dependency of semi-foundation.
|
|
10
|
-
|
|
11
|
-
Why: According to Semi's foundation and adapter design, foundation should not depend on adapter. Click to view the [F/A design](https://bytedance.feishu.cn/wiki/wikcnOVYexosCS1Rmvb5qCsWT1f).
|
|
12
|
-
|
|
13
|
-
### ✅ Should not import lodash-es in semi-ui and semi-foundation
|
|
14
|
-
|
|
15
|
-
Use lodash instead of lodash-es.
|
|
16
|
-
|
|
17
|
-
Why: In order to be compatible with next, lodash-es only provides the product of es module.
|
|
18
|
-
|
|
19
|
-

|
|
20
|
-
|
|
21
|
-
See more [here](https://github.com/vercel/next.js/issues/2259)。
|
|
22
|
-
|
|
23
|
-
### ✅ Should not use relative paths to import a package under packages in semi-ui or semi-foundation
|
|
24
|
-
|
|
25
|
-
For imports between packages under monorepo, use package names instead of relative paths.
|
|
26
|
-
|
|
27
|
-
Why: These two packages may not be in the same folder in the installation path of the user project, and the corresponding package cannot be found using the relative path.
|
|
28
|
-
|
|
29
|
-
```javascript
|
|
30
|
-
// ❌ Not recommend
|
|
31
|
-
// semi-ui/input/index.tsx
|
|
32
|
-
import inputFoundation from '../semi-foundation/input/foundation';
|
|
33
|
-
|
|
34
|
-
// ✅ Recommend
|
|
35
|
-
// semi-ui/input/index.tsx
|
|
36
|
-
import inputFoundation from '@douyinfe/semi-foundation/input/foundation';
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### ✅ Should not use the package name and path to import other modules under the same package
|
|
40
|
-
When importing the same package, use relative paths instead of referencing the package name.
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
// ❌ Not recommend
|
|
44
|
-
// semi-ui/modal/Modal.tsx
|
|
45
|
-
import { Button } from '@douyinfe/semi-ui';
|
|
46
|
-
|
|
47
|
-
// ✅ Recommend
|
|
48
|
-
// semi-ui/modal/Modal.tsx
|
|
49
|
-
import Button from '../button';
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### ✅ Should not import React or ReactDOM in semi-foundation
|
|
54
|
-
|
|
55
|
-
```javascript
|
|
56
|
-
// ❌
|
|
57
|
-
// packages/semi-foundation/input/foundation.ts
|
|
58
|
-
import React from 'react';
|
|
59
|
-
import ReactDOM from 'react-dom';
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Related docs
|
|
63
|
-
|
|
64
|
-
- eslint plugin doc:https://eslint.org/docs/developer-guide/working-with-plugins
|