eslint-plugin-big-react-app-plugin 0.0.5 → 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.
@@ -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,20 +47,30 @@ 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[toArray]){
50
+ if(!toLayer || !toSlice || !layers[toLayer]){
52
51
  return false
53
52
  }
54
53
  //нормализуем путь
55
54
  const normalizationPath = path.toNamespacedPath(from);
56
- const fromArray = normalizationPath.split('\\')[1]
55
+ const projFrom = normalizationPath.split('src')[1]
56
+ const fromArray = projFrom.split('\\')
57
57
 
58
58
  const fromLayer = fromArray[1];
59
59
  const fromSlice = fromArray[2];
60
- if(!fromLayer || !fromSlice || !layers[fromArray]){
60
+ if(!fromLayer || !fromSlice || !layers[fromLayer]){
61
61
  return false
62
62
  }
63
+
63
64
  return toSlice === fromSlice && toLayer === fromLayer
64
65
  }
65
66
  const pathRelative = (path)=>{
66
67
  return path = path.startsWith('.' || './' || './/')
67
- }
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'))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-big-react-app-plugin",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "plugin for prod proj",
5
5
  "keywords": [
6
6
  "eslint",