eslint-plugin-big-react-app-plugin 0.1.4 → 0.1.5

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.
Files changed (103) hide show
  1. package/lib/rules/public-api-imports.js +18 -3
  2. package/package.json +2 -1
  3. package/tests/lib/rules/public-api-imports.js +13 -4
  4. package/.history/.gitignore_20251018083109 +0 -0
  5. package/.history/.gitignore_20251018083124 +0 -1
  6. package/.history/lib/helpers/index_20251018083334.js +0 -0
  7. package/.history/lib/helpers/index_20251018083357.js +0 -6
  8. package/.history/lib/helpers/index_20251018083414.js +0 -6
  9. package/.history/lib/helpers/index_20251018083417.js +0 -6
  10. package/.history/lib/helpers/index_20251018083618.js +0 -6
  11. package/.history/lib/helpers/index_20251018092620.js +0 -6
  12. package/.history/lib/helpers/index_20251018092627.js +0 -6
  13. package/.history/lib/rules/path-checker_20250906110609.js +0 -76
  14. package/.history/lib/rules/path-checker_20251016170231.js +0 -76
  15. package/.history/lib/rules/path-checker_20251016170238.js +0 -76
  16. package/.history/lib/rules/path-checker_20251016170240.js +0 -76
  17. package/.history/lib/rules/path-checker_20251016170512.js +0 -76
  18. package/.history/lib/rules/path-checker_20251016170543.js +0 -78
  19. package/.history/lib/rules/path-checker_20251016170608.js +0 -81
  20. package/.history/lib/rules/path-checker_20251016170627.js +0 -81
  21. package/.history/lib/rules/path-checker_20251016170714.js +0 -81
  22. package/.history/lib/rules/path-checker_20251016170716.js +0 -83
  23. package/.history/lib/rules/path-checker_20251016170723.js +0 -84
  24. package/.history/lib/rules/path-checker_20251016170726.js +0 -84
  25. package/.history/lib/rules/path-checker_20251016170750.js +0 -85
  26. package/.history/lib/rules/path-checker_20251016170808.js +0 -85
  27. package/.history/lib/rules/path-checker_20251016170811.js +0 -85
  28. package/.history/lib/rules/path-checker_20251016170821.js +0 -85
  29. package/.history/lib/rules/path-checker_20251016170941.js +0 -86
  30. package/.history/lib/rules/path-checker_20251016170953.js +0 -86
  31. package/.history/lib/rules/path-checker_20251016171234.js +0 -87
  32. package/.history/lib/rules/path-checker_20251016171235.js +0 -87
  33. package/.history/lib/rules/path-checker_20251016171244.js +0 -87
  34. package/.history/lib/rules/path-checker_20251016192227.js +0 -89
  35. package/.history/lib/rules/path-checker_20251016192245.js +0 -89
  36. package/.history/lib/rules/path-checker_20251018083151.js +0 -89
  37. package/.history/lib/rules/path-checker_20251018083710.js +0 -87
  38. package/.history/lib/rules/public-api-imports_20251018083042.js +0 -44
  39. package/.history/lib/rules/public-api-imports_20251018083211.js +0 -50
  40. package/.history/lib/rules/public-api-imports_20251018083235.js +0 -43
  41. package/.history/lib/rules/public-api-imports_20251018083244.js +0 -51
  42. package/.history/lib/rules/public-api-imports_20251018083454.js +0 -51
  43. package/.history/lib/rules/public-api-imports_20251018083640.js +0 -40
  44. package/.history/lib/rules/public-api-imports_20251018083748.js +0 -42
  45. package/.history/lib/rules/public-api-imports_20251018083818.js +0 -42
  46. package/.history/lib/rules/public-api-imports_20251018084540.js +0 -41
  47. package/.history/lib/rules/public-api-imports_20251018084843.js +0 -44
  48. package/.history/lib/rules/public-api-imports_20251018084847.js +0 -44
  49. package/.history/lib/rules/public-api-imports_20251018084906.js +0 -44
  50. package/.history/lib/rules/public-api-imports_20251018084913.js +0 -43
  51. package/.history/lib/rules/public-api-imports_20251018085014.js +0 -48
  52. package/.history/lib/rules/public-api-imports_20251018085807.js +0 -48
  53. package/.history/lib/rules/public-api-imports_20251018090400.js +0 -58
  54. package/.history/lib/rules/public-api-imports_20251018091033.js +0 -60
  55. package/.history/lib/rules/public-api-imports_20251018092312.js +0 -61
  56. package/.history/lib/rules/public-api-imports_20251018092340.js +0 -62
  57. package/.history/lib/rules/public-api-imports_20251018093209.js +0 -62
  58. package/.history/lib/rules/public-api-imports_20251018093226.js +0 -62
  59. package/.history/lib/rules/public-api-imports_20251018093319.js +0 -63
  60. package/.history/lib/rules/public-api-imports_20251018094349.js +0 -62
  61. package/.history/lib/rules/public-api-imports_20251018094423.js +0 -62
  62. package/.history/lib/rules/public-api-imports_20251018094442.js +0 -62
  63. package/.history/lib/rules/public-api-imports_20251018094512.js +0 -62
  64. package/.history/lib/rules/public-api-imports_20251018094549.js +0 -62
  65. package/.history/lib/rules/public-api-imports_20251018094630.js +0 -62
  66. package/.history/lib/rules/public-api-imports_20251018094655.js +0 -62
  67. package/.history/lib/rules/public-api-imports_20251018094728.js +0 -62
  68. package/.history/lib/rules/public-api-imports_20251018094729.js +0 -62
  69. package/.history/lib/rules/public-api-imports_20251018094801.js +0 -62
  70. package/.history/lib/rules/public-api-imports_20251018095046.js +0 -61
  71. package/.history/package_20250906110616.json +0 -32
  72. package/.history/package_20251016192249.json +0 -32
  73. package/.history/package_20251018085916.json +0 -32
  74. package/.history/package_20251018090415.json +0 -32
  75. package/.history/package_20251018091504.json +0 -32
  76. package/.history/package_20251018092723.json +0 -32
  77. package/.history/package_20251018095035.json +0 -32
  78. package/.history/tests/lib/rules/path-checker_20250906083402.js +0 -31
  79. package/.history/tests/lib/rules/path-checker_20251016165925.js +0 -33
  80. package/.history/tests/lib/rules/path-checker_20251016170059.js +0 -34
  81. package/.history/tests/lib/rules/path-checker_20251016170109.js +0 -34
  82. package/.history/tests/lib/rules/path-checker_20251016170128.js +0 -34
  83. package/.history/tests/lib/rules/path-checker_20251016170147.js +0 -34
  84. package/.history/tests/lib/rules/path-checker_20251016170208.js +0 -34
  85. package/.history/tests/lib/rules/path-checker_20251016170246.js +0 -34
  86. package/.history/tests/lib/rules/path-checker_20251016170253.js +0 -34
  87. package/.history/tests/lib/rules/path-checker_20251016170255.js +0 -34
  88. package/.history/tests/lib/rules/path-checker_20251016170323.js +0 -34
  89. package/.history/tests/lib/rules/path-checker_20251016170411.js +0 -38
  90. package/.history/tests/lib/rules/path-checker_20251016170459.js +0 -38
  91. package/.history/tests/lib/rules/path-checker_20251016171025.js +0 -43
  92. package/.history/tests/lib/rules/path-checker_20251016171041.js +0 -43
  93. package/.history/tests/lib/rules/path-checker_20251016171053.js +0 -43
  94. package/.history/tests/lib/rules/path-checker_20251016171136.js +0 -42
  95. package/.history/tests/lib/rules/path-checker_20251016171410.js +0 -44
  96. package/.history/tests/lib/rules/public-api-imports_20251018083042.js +0 -31
  97. package/.history/tests/lib/rules/public-api-imports_20251018085128.js +0 -34
  98. package/.history/tests/lib/rules/public-api-imports_20251018085249.js +0 -34
  99. package/.history/tests/lib/rules/public-api-imports_20251018085350.js +0 -40
  100. package/.history/tests/lib/rules/public-api-imports_20251018085726.js +0 -36
  101. package/.history/tests/lib/rules/public-api-imports_20251018090807.js +0 -86
  102. package/.history/tests/lib/rules/public-api-imports_20251018094915.js +0 -86
  103. package/.history/tests/lib/rules/public-api-imports_20251018094931.js +0 -78
@@ -1,85 +0,0 @@
1
- "use strict";
2
-
3
- const { type } = require('os');
4
- const path = require('path');
5
-
6
- module.exports = {
7
- meta: {
8
- type: null,
9
- docs: {
10
- description: "feature sliced relative path checker",
11
- category: "Fill me in",
12
- recommended: false,
13
- url: null,
14
- },
15
- fixable: null,
16
- schema: [
17
- {
18
- type:"object",
19
- properties:{
20
- alias:'string'
21
- }
22
- }
23
- ],
24
- },
25
-
26
- create(context) {
27
- const alias = context.options[0].alias ?? ""
28
- return {
29
- ImportDeclaration(node) {
30
- // example app/entities/Article
31
- const importTo = node.source.value;
32
-
33
- // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
34
- const fromFilename = context.getFilename();
35
- if(shouldBeRelative(fromFilename, importTo)) {
36
- context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
37
- }
38
- }
39
- };
40
- },
41
- };
42
-
43
- const layers = {
44
- "entities":"entities",
45
- "features":"features",
46
- "pages":"pages",
47
- "shared":"shared",
48
- "widgets":"widgets",
49
- }
50
- const shouldBeRelative = (from, to)=>{
51
- if(pathRelative(to)){
52
- return false
53
- }
54
- const toArray = to.split('/')
55
- //app/entities/Article
56
- const toLayer = toArray[0];
57
- //"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
58
- const toSlice = toArray[1];
59
- if(!toLayer || !toSlice || !layers[toLayer]){
60
- return false
61
- }
62
- //нормализуем путь
63
- const normalizationPath = path.toNamespacedPath(from);
64
- const projFrom = normalizationPath.split('src')[1]
65
- const fromArray = projFrom.split('\\')
66
-
67
- const fromLayer = fromArray[1];
68
- const fromSlice = fromArray[2];
69
- if(!fromLayer || !fromSlice || !layers[fromLayer]){
70
- return false
71
- }
72
-
73
- return toSlice === fromSlice && toLayer === fromLayer
74
- }
75
- const pathRelative = (path)=>{
76
- return path = path.startsWith('.' || './' || './/')
77
- }
78
-
79
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/Article/fasfasfas'))
80
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/ASdasd/fasfasfas'))
81
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'features/Article/fasfasfas'))
82
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\features\\Article', 'features/Article/fasfasfas'))
83
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'app/index.tsx'))
84
- // console.log(shouldBeRelative('C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article', 'entities/Article/asfasf/asfasf'))
85
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', '../../model/selectors/getSidebarItems'))
@@ -1,85 +0,0 @@
1
- "use strict";
2
-
3
- const { type } = require('os');
4
- const path = require('path');
5
-
6
- module.exports = {
7
- meta: {
8
- type: null,
9
- docs: {
10
- description: "feature sliced relative path checker",
11
- category: "Fill me in",
12
- recommended: false,
13
- url: null,
14
- },
15
- fixable: null,
16
- schema: [
17
- {
18
- type:"object",
19
- properties:{
20
- alias:'string'
21
- }
22
- }
23
- ],
24
- },
25
-
26
- create(context) {
27
- const alias = context.options[0].alias ?? "";
28
- return {
29
- ImportDeclaration(node) {
30
- // example app/entities/Article
31
- const importTo = node.source.value;
32
-
33
- // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
34
- const fromFilename = context.getFilename();
35
- if(shouldBeRelative(fromFilename, importTo)) {
36
- context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
37
- }
38
- }
39
- };
40
- },
41
- };
42
-
43
- const layers = {
44
- "entities":"entities",
45
- "features":"features",
46
- "pages":"pages",
47
- "shared":"shared",
48
- "widgets":"widgets",
49
- }
50
- const shouldBeRelative = (from, to)=>{
51
- if(pathRelative(to)){
52
- return false
53
- }
54
- const toArray = to.split('/')
55
- //app/entities/Article
56
- const toLayer = toArray[0];
57
- //"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
58
- const toSlice = toArray[1];
59
- if(!toLayer || !toSlice || !layers[toLayer]){
60
- return false
61
- }
62
- //нормализуем путь
63
- const normalizationPath = path.toNamespacedPath(from);
64
- const projFrom = normalizationPath.split('src')[1]
65
- const fromArray = projFrom.split('\\')
66
-
67
- const fromLayer = fromArray[1];
68
- const fromSlice = fromArray[2];
69
- if(!fromLayer || !fromSlice || !layers[fromLayer]){
70
- return false
71
- }
72
-
73
- return toSlice === fromSlice && toLayer === fromLayer
74
- }
75
- const pathRelative = (path)=>{
76
- return path = path.startsWith('.' || './' || './/')
77
- }
78
-
79
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/Article/fasfasfas'))
80
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/ASdasd/fasfasfas'))
81
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'features/Article/fasfasfas'))
82
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\features\\Article', 'features/Article/fasfasfas'))
83
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'app/index.tsx'))
84
- // console.log(shouldBeRelative('C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article', 'entities/Article/asfasf/asfasf'))
85
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', '../../model/selectors/getSidebarItems'))
@@ -1,86 +0,0 @@
1
- "use strict";
2
-
3
- const { type } = require('os');
4
- const path = require('path');
5
-
6
- module.exports = {
7
- meta: {
8
- type: null,
9
- docs: {
10
- description: "feature sliced relative path checker",
11
- category: "Fill me in",
12
- recommended: false,
13
- url: null,
14
- },
15
- fixable: null,
16
- schema: [
17
- {
18
- type:"object",
19
- properties:{
20
- alias:'string'
21
- }
22
- }
23
- ],
24
- },
25
-
26
- create(context) {
27
- const alias = context.options[0].alias ?? "";
28
- return {
29
- ImportDeclaration(node) {
30
- // example app/entities/Article
31
- const value = node.source.value;
32
- const importTo = alias ? value.replace(`${alias}`, "") : value;
33
-
34
- // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
35
- const fromFilename = context.getFilename();
36
- if(shouldBeRelative(fromFilename, importTo)) {
37
- context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
38
- }
39
- }
40
- };
41
- },
42
- };
43
-
44
- const layers = {
45
- "entities":"entities",
46
- "features":"features",
47
- "pages":"pages",
48
- "shared":"shared",
49
- "widgets":"widgets",
50
- }
51
- const shouldBeRelative = (from, to)=>{
52
- if(pathRelative(to)){
53
- return false
54
- }
55
- const toArray = to.split('/')
56
- //app/entities/Article
57
- const toLayer = toArray[0];
58
- //"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
59
- const toSlice = toArray[1];
60
- if(!toLayer || !toSlice || !layers[toLayer]){
61
- return false
62
- }
63
- //нормализуем путь
64
- const normalizationPath = path.toNamespacedPath(from);
65
- const projFrom = normalizationPath.split('src')[1]
66
- const fromArray = projFrom.split('\\')
67
-
68
- const fromLayer = fromArray[1];
69
- const fromSlice = fromArray[2];
70
- if(!fromLayer || !fromSlice || !layers[fromLayer]){
71
- return false
72
- }
73
-
74
- return toSlice === fromSlice && toLayer === fromLayer
75
- }
76
- const pathRelative = (path)=>{
77
- return path = path.startsWith('.' || './' || './/')
78
- }
79
-
80
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/Article/fasfasfas'))
81
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/ASdasd/fasfasfas'))
82
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'features/Article/fasfasfas'))
83
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\features\\Article', 'features/Article/fasfasfas'))
84
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'app/index.tsx'))
85
- // console.log(shouldBeRelative('C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article', 'entities/Article/asfasf/asfasf'))
86
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', '../../model/selectors/getSidebarItems'))
@@ -1,86 +0,0 @@
1
- "use strict";
2
-
3
- const { type } = require('os');
4
- const path = require('path');
5
-
6
- module.exports = {
7
- meta: {
8
- type: null,
9
- docs: {
10
- description: "feature sliced relative path checker",
11
- category: "Fill me in",
12
- recommended: false,
13
- url: null,
14
- },
15
- fixable: null,
16
- schema: [
17
- {
18
- type:"object",
19
- properties:{
20
- alias:'string'
21
- }
22
- }
23
- ],
24
- },
25
-
26
- create(context) {
27
- const alias = context.options[0].alias ?? "";
28
- return {
29
- ImportDeclaration(node) {
30
- // example app/entities/Article
31
- const value = node.source.value;
32
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
33
-
34
- // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
35
- const fromFilename = context.getFilename();
36
- if(shouldBeRelative(fromFilename, importTo)) {
37
- context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
38
- }
39
- }
40
- };
41
- },
42
- };
43
-
44
- const layers = {
45
- "entities":"entities",
46
- "features":"features",
47
- "pages":"pages",
48
- "shared":"shared",
49
- "widgets":"widgets",
50
- }
51
- const shouldBeRelative = (from, to)=>{
52
- if(pathRelative(to)){
53
- return false
54
- }
55
- const toArray = to.split('/')
56
- //app/entities/Article
57
- const toLayer = toArray[0];
58
- //"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
59
- const toSlice = toArray[1];
60
- if(!toLayer || !toSlice || !layers[toLayer]){
61
- return false
62
- }
63
- //нормализуем путь
64
- const normalizationPath = path.toNamespacedPath(from);
65
- const projFrom = normalizationPath.split('src')[1]
66
- const fromArray = projFrom.split('\\')
67
-
68
- const fromLayer = fromArray[1];
69
- const fromSlice = fromArray[2];
70
- if(!fromLayer || !fromSlice || !layers[fromLayer]){
71
- return false
72
- }
73
-
74
- return toSlice === fromSlice && toLayer === fromLayer
75
- }
76
- const pathRelative = (path)=>{
77
- return path = path.startsWith('.' || './' || './/')
78
- }
79
-
80
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/Article/fasfasfas'))
81
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/ASdasd/fasfasfas'))
82
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'features/Article/fasfasfas'))
83
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\features\\Article', 'features/Article/fasfasfas'))
84
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'app/index.tsx'))
85
- // console.log(shouldBeRelative('C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article', 'entities/Article/asfasf/asfasf'))
86
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', '../../model/selectors/getSidebarItems'))
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- const { type } = require('os');
4
- const path = require('path');
5
-
6
- module.exports = {
7
- meta: {
8
- type: null,
9
- docs: {
10
- description: "feature sliced relative path checker",
11
- category: "Fill me in",
12
- recommended: false,
13
- url: null,
14
- },
15
- fixable: null,
16
- schema: [
17
- {
18
- type:"object",
19
- properties:
20
- {
21
- alias:'string'
22
- }
23
- }
24
- ],
25
- },
26
-
27
- create(context) {
28
- const alias = context.options[0]?.alias ?? "";
29
- return {
30
- ImportDeclaration(node) {
31
- // example app/entities/Article
32
- const value = node.source.value;
33
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
34
-
35
- // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
36
- const fromFilename = context.getFilename();
37
- if(shouldBeRelative(fromFilename, importTo)) {
38
- context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
39
- }
40
- }
41
- };
42
- },
43
- };
44
-
45
- const layers = {
46
- "entities":"entities",
47
- "features":"features",
48
- "pages":"pages",
49
- "shared":"shared",
50
- "widgets":"widgets",
51
- }
52
- const shouldBeRelative = (from, to)=>{
53
- if(pathRelative(to)){
54
- return false
55
- }
56
- const toArray = to.split('/')
57
- //app/entities/Article
58
- const toLayer = toArray[0];
59
- //"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
60
- const toSlice = toArray[1];
61
- if(!toLayer || !toSlice || !layers[toLayer]){
62
- return false
63
- }
64
- //нормализуем путь
65
- const normalizationPath = path.toNamespacedPath(from);
66
- const projFrom = normalizationPath.split('src')[1]
67
- const fromArray = projFrom.split('\\')
68
-
69
- const fromLayer = fromArray[1];
70
- const fromSlice = fromArray[2];
71
- if(!fromLayer || !fromSlice || !layers[fromLayer]){
72
- return false
73
- }
74
-
75
- return toSlice === fromSlice && toLayer === fromLayer
76
- }
77
- const pathRelative = (path)=>{
78
- return path = path.startsWith('.' || './' || './/')
79
- }
80
-
81
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/Article/fasfasfas'))
82
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/ASdasd/fasfasfas'))
83
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'features/Article/fasfasfas'))
84
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\features\\Article', 'features/Article/fasfasfas'))
85
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'app/index.tsx'))
86
- // console.log(shouldBeRelative('C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article', 'entities/Article/asfasf/asfasf'))
87
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', '../../model/selectors/getSidebarItems'))
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- const { type } = require('os');
4
- const path = require('path');
5
-
6
- module.exports = {
7
- meta: {
8
- type: null,
9
- docs: {
10
- description: "feature sliced relative path checker",
11
- category: "Fill me in",
12
- recommended: false,
13
- url: null,
14
- },
15
- fixable: null,
16
- schema: [
17
- {
18
- type:"object",
19
- properties:
20
- {
21
- alias:'string'
22
- }
23
- }
24
- ],
25
- },
26
-
27
- create(context) {
28
- const alias = context.options[0].alias ?? "";
29
- return {
30
- ImportDeclaration(node) {
31
- // example app/entities/Article
32
- const value = node.source.value;
33
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
34
-
35
- // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
36
- const fromFilename = context.getFilename();
37
- if(shouldBeRelative(fromFilename, importTo)) {
38
- context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
39
- }
40
- }
41
- };
42
- },
43
- };
44
-
45
- const layers = {
46
- "entities":"entities",
47
- "features":"features",
48
- "pages":"pages",
49
- "shared":"shared",
50
- "widgets":"widgets",
51
- }
52
- const shouldBeRelative = (from, to)=>{
53
- if(pathRelative(to)){
54
- return false
55
- }
56
- const toArray = to.split('/')
57
- //app/entities/Article
58
- const toLayer = toArray[0];
59
- //"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
60
- const toSlice = toArray[1];
61
- if(!toLayer || !toSlice || !layers[toLayer]){
62
- return false
63
- }
64
- //нормализуем путь
65
- const normalizationPath = path.toNamespacedPath(from);
66
- const projFrom = normalizationPath.split('src')[1]
67
- const fromArray = projFrom.split('\\')
68
-
69
- const fromLayer = fromArray[1];
70
- const fromSlice = fromArray[2];
71
- if(!fromLayer || !fromSlice || !layers[fromLayer]){
72
- return false
73
- }
74
-
75
- return toSlice === fromSlice && toLayer === fromLayer
76
- }
77
- const pathRelative = (path)=>{
78
- return path = path.startsWith('.' || './' || './/')
79
- }
80
-
81
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/Article/fasfasfas'))
82
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/ASdasd/fasfasfas'))
83
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'features/Article/fasfasfas'))
84
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\features\\Article', 'features/Article/fasfasfas'))
85
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'app/index.tsx'))
86
- // console.log(shouldBeRelative('C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article', 'entities/Article/asfasf/asfasf'))
87
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', '../../model/selectors/getSidebarItems'))
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- const { type } = require('os');
4
- const path = require('path');
5
-
6
- module.exports = {
7
- meta: {
8
- type: null,
9
- docs: {
10
- description: "feature sliced relative path checker",
11
- category: "Fill me in",
12
- recommended: false,
13
- url: null,
14
- },
15
- fixable: null,
16
- schema: [
17
- {
18
- type:"object",
19
- properties:
20
- {
21
- alias:'string'
22
- }
23
- }
24
- ],
25
- },
26
-
27
- create(context) {
28
- const alias = context.options[0]?.alias ?? "";
29
- return {
30
- ImportDeclaration(node) {
31
- // example app/entities/Article
32
- const value = node.source.value;
33
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
34
-
35
- // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
36
- const fromFilename = context.getFilename();
37
- if(shouldBeRelative(fromFilename, importTo)) {
38
- context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
39
- }
40
- }
41
- };
42
- },
43
- };
44
-
45
- const layers = {
46
- "entities":"entities",
47
- "features":"features",
48
- "pages":"pages",
49
- "shared":"shared",
50
- "widgets":"widgets",
51
- }
52
- const shouldBeRelative = (from, to)=>{
53
- if(pathRelative(to)){
54
- return false
55
- }
56
- const toArray = to.split('/')
57
- //app/entities/Article
58
- const toLayer = toArray[0];
59
- //"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
60
- const toSlice = toArray[1];
61
- if(!toLayer || !toSlice || !layers[toLayer]){
62
- return false
63
- }
64
- //нормализуем путь
65
- const normalizationPath = path.toNamespacedPath(from);
66
- const projFrom = normalizationPath.split('src')[1]
67
- const fromArray = projFrom.split('\\')
68
-
69
- const fromLayer = fromArray[1];
70
- const fromSlice = fromArray[2];
71
- if(!fromLayer || !fromSlice || !layers[fromLayer]){
72
- return false
73
- }
74
-
75
- return toSlice === fromSlice && toLayer === fromLayer
76
- }
77
- const pathRelative = (path)=>{
78
- return path = path.startsWith('.' || './' || './/')
79
- }
80
-
81
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/Article/fasfasfas'))
82
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/ASdasd/fasfasfas'))
83
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'features/Article/fasfasfas'))
84
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\features\\Article', 'features/Article/fasfasfas'))
85
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'app/index.tsx'))
86
- // console.log(shouldBeRelative('C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article', 'entities/Article/asfasf/asfasf'))
87
- // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', '../../model/selectors/getSidebarItems'))