eslint-plugin-stratified-design 0.5.1 → 0.5.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.
@@ -99,16 +99,20 @@ const reportHasProperLevelNumber = (context, options, rootDir, filePath) => {
99
99
  return toPath(parent);
100
100
  })();
101
101
 
102
- const { moduleLevel, isInterfaceError } = (() => {
102
+ const { moduleLevel, isBarrierError } = (() => {
103
103
  const segments = toSegments(toRelative(parentPath, modulePath));
104
- const level = extractLevel(segments[1]);
104
+ const moduleLevel = extractLevel(segments[1]);
105
+ const isBarrierError =
106
+ segments.length === 2
107
+ ? false
108
+ : segments.some((seg) => extractLevel(seg) !== null);
105
109
  return {
106
- moduleLevel: level,
107
- isInterfaceError: segments.length > 2,
110
+ moduleLevel,
111
+ isBarrierError,
108
112
  };
109
113
  })();
110
114
 
111
- if (isInterfaceError) {
115
+ if (isBarrierError) {
112
116
  report("barrier");
113
117
  return FINISHED;
114
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-stratified-design",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "ESlint rules for stratified design",
5
5
  "keywords": [
6
6
  "eslint",
@@ -187,6 +187,18 @@ ruleTester.run("lower-level-imports", rule, {
187
187
  },
188
188
  ],
189
189
  },
190
+ {
191
+ code: "import { func } from '@/layer1/subLayer2/sub'",
192
+ filename: "./src/layer1/subLayer1/1 layer.js",
193
+ options: [
194
+ {
195
+ structure,
196
+ root: "./src",
197
+ aliases: { "@/": "./src/" },
198
+ useLevelNumber: true,
199
+ },
200
+ ],
201
+ },
190
202
  ],
191
203
  invalid: [
192
204
  {