eslint-plugin-semi-design 2.13.0 → 2.14.0-beta.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/README-zh_CN.md +9 -0
- package/README.md +9 -0
- package/lib/rules/no-import.js +5 -1
- package/package.json +2 -2
package/README-zh_CN.md
CHANGED
|
@@ -50,6 +50,15 @@ import { Button } from '@douyinfe/semi-ui';
|
|
|
50
50
|
import Button from '../button';
|
|
51
51
|
```
|
|
52
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
|
+
|
|
53
62
|
## 相关资料
|
|
54
63
|
|
|
55
64
|
- eslint plugin 文档:https://eslint.org/docs/developer-guide/working-with-plugins
|
package/README.md
CHANGED
|
@@ -50,6 +50,15 @@ import Button from '../button';
|
|
|
50
50
|
|
|
51
51
|
```
|
|
52
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
|
+
|
|
53
62
|
## Related docs
|
|
54
63
|
|
|
55
64
|
- eslint plugin doc:https://eslint.org/docs/developer-guide/working-with-plugins
|
package/lib/rules/no-import.js
CHANGED
|
@@ -15,7 +15,8 @@ const rule = {
|
|
|
15
15
|
unexpected: "Unexpected import statement, semi ui should not be used as a dependency of semi foundation",
|
|
16
16
|
unexpectedLodashES: "Unexpected import statement, please use lodash instead of lodash-es.",
|
|
17
17
|
unexpectedRelativeImport: "Unexpected import statement, please use module name instead of relative path.",
|
|
18
|
-
unexpectedImportSelf: 'Unexpected import statement, please use relative paths to import modules in the same package.'
|
|
18
|
+
unexpectedImportSelf: 'Unexpected import statement, please use relative paths to import modules in the same package.',
|
|
19
|
+
unexpectedReactImport: "Unexpected import statement, React should not be used as a dependency of semi foundation"
|
|
19
20
|
},
|
|
20
21
|
schema: [],
|
|
21
22
|
},
|
|
@@ -32,6 +33,9 @@ const rule = {
|
|
|
32
33
|
if (importName.includes('semi-ui')) {
|
|
33
34
|
context.report({ node, messageId: "unexpected" });
|
|
34
35
|
}
|
|
36
|
+
if (importName.includes('react') || importName.includes('react-dom')) {
|
|
37
|
+
context.report({ node, messageId: "unexpectedReactImport" });
|
|
38
|
+
}
|
|
35
39
|
}
|
|
36
40
|
if (isFoundationFile || isUIFile) {
|
|
37
41
|
if (importName.includes('lodash-es')) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-semi-design",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0-beta.1",
|
|
4
4
|
"description": "semi ui eslint plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"semi",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"bugs": {
|
|
41
41
|
"url": "https://github.com/DouyinFE/semi-design/issues"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "7c7bcfeba01bbe507ab38f4b0354e2e7d79868a0"
|
|
44
44
|
}
|