eslint-plugin-big-react-app-plugin 0.0.6 → 0.0.7
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 +12 -4
- package/package.json +1 -1
|
@@ -23,7 +23,6 @@ module.exports = {
|
|
|
23
23
|
|
|
24
24
|
// example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
|
|
25
25
|
const fromFilename = context.getFilename();
|
|
26
|
-
|
|
27
26
|
if(shouldBeRelative(fromFilename, importTo)) {
|
|
28
27
|
context.report(node, 'В рамках одного слайса все пути должны быть относительными');
|
|
29
28
|
}
|
|
@@ -48,7 +47,7 @@ const shouldBeRelative = (from, to)=>{
|
|
|
48
47
|
const toLayer = toArray[0];
|
|
49
48
|
//"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
|
|
50
49
|
const toSlice = toArray[1];
|
|
51
|
-
if(!toLayer || !toSlice || !layers[
|
|
50
|
+
if(!toLayer || !toSlice || !layers[toLayer]){
|
|
52
51
|
return false
|
|
53
52
|
}
|
|
54
53
|
//нормализуем путь
|
|
@@ -58,11 +57,20 @@ const shouldBeRelative = (from, to)=>{
|
|
|
58
57
|
|
|
59
58
|
const fromLayer = fromArray[1];
|
|
60
59
|
const fromSlice = fromArray[2];
|
|
61
|
-
if(!fromLayer || !fromSlice || !layers[
|
|
60
|
+
if(!fromLayer || !fromSlice || !layers[fromLayer]){
|
|
62
61
|
return false
|
|
63
62
|
}
|
|
63
|
+
|
|
64
64
|
return toSlice === fromSlice && toLayer === fromLayer
|
|
65
65
|
}
|
|
66
66
|
const pathRelative = (path)=>{
|
|
67
67
|
return path = path.startsWith('.' || './' || './/')
|
|
68
|
-
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/Article/fasfasfas'))
|
|
71
|
+
// console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/ASdasd/fasfasfas'))
|
|
72
|
+
// console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'features/Article/fasfasfas'))
|
|
73
|
+
// console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\features\\Article', 'features/Article/fasfasfas'))
|
|
74
|
+
// console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'app/index.tsx'))
|
|
75
|
+
// console.log(shouldBeRelative('C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article', 'entities/Article/asfasf/asfasf'))
|
|
76
|
+
// console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', '../../model/selectors/getSidebarItems'))
|