eslint-plugin-stratified-design 0.9.1 → 0.9.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.
@@ -124,7 +124,7 @@ const findLevelInChild = (structure) => {
124
124
  const fileDir = layer.name;
125
125
  const childStructure = readStructure(fileDir);
126
126
  const childLevel = findLevel(childStructure)(modulePath);
127
- return childLevel !== null ? findLevel(structure)(fileDir) : null;
127
+ return childLevel === 0 ? findLevel(structure)(fileDir) : null;
128
128
  };
129
129
  };
130
130
 
@@ -1 +1 @@
1
- [["layerBA"], ["layerBB"]]
1
+ [["index", "layerBA"], ["layerBB"]]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-stratified-design",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "ESlint rules for stratified design",
5
5
  "keywords": [
6
6
  "eslint",
@@ -32,7 +32,7 @@ const RuleTester = require("eslint").RuleTester;
32
32
 
33
33
  // layerB/.stratified.json
34
34
  [
35
- ["layerBA"],
35
+ ["index", "layerBA"],
36
36
  ["layerBB"]
37
37
  ]
38
38
 
@@ -279,5 +279,27 @@ ruleTester.run("stratified-imports", rule, {
279
279
  },
280
280
  ],
281
281
  },
282
+ {
283
+ code: "import { func } from './layerB/layerBB'",
284
+ filename: "./mocked/stratified-imports/layerA.js",
285
+ options: [],
286
+ errors: [
287
+ {
288
+ messageId: "not-lower-level",
289
+ data: { module: "layerBB", file: "layerA" },
290
+ },
291
+ ],
292
+ },
293
+ {
294
+ code: "import { func } from './layerD/layerDB/layerDBA'",
295
+ filename: "./mocked/stratified-imports/layerC.js",
296
+ options: [],
297
+ errors: [
298
+ {
299
+ messageId: "not-lower-level",
300
+ data: { module: "layerDBA", file: "layerC" },
301
+ },
302
+ ],
303
+ },
282
304
  ],
283
305
  });