eslint-plugin-stratified-design 0.8.0-beta.1 → 0.8.0-beta.2
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.md +1 -1
- package/docs/rules/no-same-level-funcs.md +42 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,5 +39,5 @@ Then configure the rules you wish to use under the rules section:
|
|
|
39
39
|
## Supported Rules
|
|
40
40
|
|
|
41
41
|
- [lower-level-imports](https://github.com/anisotropy/eslint-plugin-stratified-design/blob/main/docs/rules/lower-level-imports.md): Requires lower-level modules to be imported.
|
|
42
|
-
- [
|
|
42
|
+
- [stratified-imports](https://github.com/anisotropy/eslint-plugin-stratified-design/blob/main/docs/rules/stratified-imports.md): Requires lower-level modules to be imported. The stratified structure is set by `.stratified.json`.
|
|
43
43
|
- [no-same-level-funcs](https://github.com/anisotropy/eslint-plugin-stratified-design/blob/main/docs/rules/no-same-level-funcs.md): Disallows calling functions in the same file.
|
|
@@ -29,9 +29,7 @@ The default is as follows:
|
|
|
29
29
|
Examples of **incorrect** code for this rule:
|
|
30
30
|
|
|
31
31
|
```js
|
|
32
|
-
function func1(...) {
|
|
33
|
-
...
|
|
34
|
-
}
|
|
32
|
+
function func1(...) { ... }
|
|
35
33
|
|
|
36
34
|
const func2(...) => { ... }
|
|
37
35
|
|
|
@@ -39,16 +37,50 @@ function func3(...) {
|
|
|
39
37
|
func1(...);
|
|
40
38
|
func2(...);
|
|
41
39
|
}
|
|
40
|
+
|
|
41
|
+
const func4 = (...) => {
|
|
42
|
+
func1(...);
|
|
43
|
+
func2(...);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
const func1 = (...) => { ...}
|
|
49
|
+
|
|
50
|
+
const func2(func1) => { ... }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
const hof = (...) => { ... }
|
|
55
|
+
|
|
56
|
+
const funcByHof = hof((...) => {...})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
const ComponentA = (...) => { ... }
|
|
61
|
+
|
|
62
|
+
const ComponentB = (...) => {
|
|
63
|
+
...
|
|
64
|
+
return (
|
|
65
|
+
...
|
|
66
|
+
<ComponentA>{...}</ComponentA>
|
|
67
|
+
...
|
|
68
|
+
)
|
|
69
|
+
}
|
|
42
70
|
```
|
|
43
71
|
|
|
44
72
|
```js
|
|
45
73
|
// @level 1
|
|
46
74
|
const funcA = (...) => { ... }
|
|
47
75
|
|
|
76
|
+
// @level 1
|
|
77
|
+
function funcB(...) { ... }
|
|
78
|
+
|
|
48
79
|
// @level 2
|
|
49
|
-
const
|
|
80
|
+
const funcC = (...) => {
|
|
50
81
|
...
|
|
51
82
|
funcA(...)
|
|
83
|
+
funcB(...)
|
|
52
84
|
...
|
|
53
85
|
}
|
|
54
86
|
```
|
|
@@ -56,9 +88,7 @@ const funcB = (...) => {
|
|
|
56
88
|
Examples of **correct** code for this rule:
|
|
57
89
|
|
|
58
90
|
```js
|
|
59
|
-
function func1(...) {
|
|
60
|
-
...
|
|
61
|
-
}
|
|
91
|
+
function func1(...) { ... }
|
|
62
92
|
|
|
63
93
|
const func2(...) => { ... }
|
|
64
94
|
```
|
|
@@ -75,10 +105,14 @@ function func1(...) {
|
|
|
75
105
|
// @level 2
|
|
76
106
|
const funcA = (...) => { ... }
|
|
77
107
|
|
|
108
|
+
// @level 2
|
|
109
|
+
function funcB(...) { ... }
|
|
110
|
+
|
|
78
111
|
// @level 1
|
|
79
|
-
const
|
|
112
|
+
const funcC = (...) => {
|
|
80
113
|
...
|
|
81
114
|
funcA(...)
|
|
115
|
+
funcB(...)
|
|
82
116
|
...
|
|
83
117
|
}
|
|
84
118
|
```
|