eslint-plugin-path-checker-new 0.0.2 → 0.0.3

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.
@@ -58,21 +58,23 @@ function shouldBeRelative(from, to) {
58
58
  return false;
59
59
  }
60
60
 
61
- // example entities/Article'
62
61
  const toArray = to.split("/");
63
- const toLayer = toArray[0]; // entities
64
- const toSlice = toArray[1]; // Article
62
+ const toLayer = toArray[0];
63
+ const toSlice = toArray[1];
65
64
 
66
65
  if (!toLayer || !toSlice || !layers[toLayer]) {
67
66
  return false;
68
67
  }
69
68
 
70
- const normalizedPath = path.toNamespacedPath(from);
71
- const projectFrom = normalizedPath.split("src")[1];
72
- const fromArray = projectFrom.split("\\");
69
+ const normalizedPath = from.replace(/\\/g, "/");
70
+ const projectFrom = normalizedPath.split("/src/")[1];
73
71
 
74
- const fromLayer = fromArray[1];
75
- const fromSlice = fromArray[2];
72
+ if (!projectFrom) return false;
73
+
74
+ const fromArray = projectFrom.split("/");
75
+
76
+ const fromLayer = fromArray[0];
77
+ const fromSlice = fromArray[1];
76
78
 
77
79
  if (!fromLayer || !fromSlice || !layers[fromLayer]) {
78
80
  return false;
@@ -81,12 +83,12 @@ function shouldBeRelative(from, to) {
81
83
  return fromSlice === toSlice && toLayer === fromLayer;
82
84
  }
83
85
 
84
- console.log(
85
- shouldBeRelative(
86
- "C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article",
87
- "entities/Article/fasfasfas",
88
- ),
89
- );
86
+ // console.log(
87
+ // shouldBeRelative(
88
+ // "C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article",
89
+ // "entities/Article/fasfasfas",
90
+ // ),
91
+ // );
90
92
  // console.log(
91
93
  // shouldBeRelative(
92
94
  // "C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-path-checker-new",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "feature sliced relative path checker",
5
5
  "keywords": [
6
6
  "eslint",