eslint-plugin-stratified-design 0.6.0-beta → 0.6.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.
|
@@ -66,6 +66,12 @@ If you want to register the level of a layer by 'number,' set the option `useLev
|
|
|
66
66
|
|
|
67
67
|
The options `structure` and `useLevelNumber` can be used together.
|
|
68
68
|
|
|
69
|
+
An `index.xxx` file can be the highest level layer when the option `isIndexHighest` is set to `true`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
"lower-level-imports": ["error", { "isIndexHighest": true }]
|
|
73
|
+
```
|
|
74
|
+
|
|
69
75
|
You can register the files to apply the rule (`lower-level-imports`) using the `include` and `exclude` options:
|
|
70
76
|
|
|
71
77
|
```json
|
|
@@ -180,3 +186,9 @@ import { func } from "./1 layer";
|
|
|
180
186
|
// ./src/layer.js
|
|
181
187
|
import { func } from "../layer3/entry";
|
|
182
188
|
```
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
/* "lower-level-imports": ["error", { "isIndexHighest": true }] */
|
|
192
|
+
// ./src/layer/index.js
|
|
193
|
+
import { func } from "./anything";
|
|
194
|
+
```
|
|
@@ -176,10 +176,10 @@ module.exports = {
|
|
|
176
176
|
report(node);
|
|
177
177
|
},
|
|
178
178
|
ExportNamedDeclaration(node) {
|
|
179
|
-
report(node);
|
|
179
|
+
if (node.source) report(node);
|
|
180
180
|
},
|
|
181
181
|
ExportAllDeclaration(node) {
|
|
182
|
-
report(node);
|
|
182
|
+
if (node.source) report(node);
|
|
183
183
|
},
|
|
184
184
|
};
|
|
185
185
|
},
|
package/package.json
CHANGED
|
@@ -37,6 +37,21 @@ ruleTester.run("lower-level-imports", rule, {
|
|
|
37
37
|
filename: "./src/otherLayerA.js",
|
|
38
38
|
options: [{ structure, root: "./src" }],
|
|
39
39
|
},
|
|
40
|
+
{
|
|
41
|
+
code: "export { func } from './otherLayerB/otherSubLayer'",
|
|
42
|
+
filename: "./src/otherLayerA.js",
|
|
43
|
+
options: [{ structure, root: "./src" }],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
code: "export * from './otherLayerB/otherSubLayer'",
|
|
47
|
+
filename: "./src/otherLayerA.js",
|
|
48
|
+
options: [{ structure, root: "./src" }],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
code: "const func = () => null; export { func }; ",
|
|
52
|
+
filename: "./src/otherLayerA.js",
|
|
53
|
+
options: [{ structure, root: "./src" }],
|
|
54
|
+
},
|
|
40
55
|
{
|
|
41
56
|
code: "import { func } from '../layer1/subLayer2'",
|
|
42
57
|
filename: "./src/layer1/subLayer1.js",
|