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.
- package/lib/rules/path-checker.js +16 -14
- package/package.json +1 -1
|
@@ -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];
|
|
64
|
-
const toSlice = toArray[1];
|
|
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 =
|
|
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
|
-
|
|
75
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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",
|