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,42 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [],
14
- },
15
-
16
-
17
- create(context) {
18
- const layers = {
19
- "entities":"entities",
20
- "features":"features",
21
- "pages":"pages",
22
- "shared":"shared",
23
- "widgets":"widgets",
24
- }
25
- const alias = context.options[0]?.alias ?? "";
26
- return {
27
- ImportDeclaration(node) {
28
- // example app/entities/Article
29
- const value = node.source.value;
30
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
31
- if(isPathRelative(importTo)){
32
- return;
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
- };
@@ -1,41 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [],
14
- },
15
-
16
-
17
- create(context) {
18
- const layers = {
19
- "entities":"entities",
20
- "features":"features",
21
- "pages":"pages",
22
- "shared":"shared",
23
- "widgets":"widgets",
24
- }
25
- const alias = context.options[0]?.alias ?? "";
26
- return {
27
- ImportDeclaration(node) {
28
- // example app/entities/Article
29
- const value = node.source.value;
30
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
31
- if(isPathRelative(importTo)){
32
- return;
33
- }
34
- const segments = importTo.split('/')
35
- if() {
36
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
37
- }
38
- }
39
- };
40
- },
41
- };
@@ -1,44 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [],
14
- },
15
-
16
-
17
- create(context) {
18
- const layers = {
19
- "entities":"entities",
20
- "features":"features",
21
- "pages":"pages",
22
- "shared":"shared",
23
- "widgets":"widgets",
24
- }
25
- const alias = context.options[0]?.alias ?? "";
26
- return {
27
- ImportDeclaration(node) {
28
- // example app/entities/Article
29
- const value = node.source.value;
30
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
31
- if(isPathRelative(importTo)){
32
- return;
33
- }
34
- const segments = importTo.split('/')
35
- //[enteties, article, ... далее еще что-то может быть]
36
- const isImportNotFromPublicApi = segments.lenght > 2;
37
-
38
- if() {
39
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
40
- }
41
- }
42
- };
43
- },
44
- };
@@ -1,44 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [],
14
- },
15
-
16
-
17
- create(context) {
18
- const layers = {
19
- "entities":"entities",
20
- "features":"features",
21
- "pages":"pages",
22
- "shared":"shared",
23
- "widgets":"widgets",
24
- }
25
- const alias = context.options[0]?.alias ?? "";
26
- return {
27
- ImportDeclaration(node) {
28
- // example app/entities/Article
29
- const value = node.source.value;
30
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
31
- if(isPathRelative(importTo)){
32
- return;
33
- }
34
- const segments = importTo.split('/')
35
- //[enteties, article, ... далее еще что-то может быть]
36
- const isImportNotFromPublicApi = segments.lenght > 2;
37
-
38
- if(isImportNotFromPublicApi) {
39
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
40
- }
41
- }
42
- };
43
- },
44
- };
@@ -1,44 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [],
14
- },
15
-
16
-
17
- create(context) {
18
- const checkingLayers = {
19
- "entities":"entities",
20
- "features":"features",
21
- "pages":"pages",
22
- "shared":"shared",
23
- "widgets":"widgets",
24
- }
25
- const alias = context.options[0]?.alias ?? "";
26
- return {
27
- ImportDeclaration(node) {
28
- // example app/entities/Article
29
- const value = node.source.value;
30
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
31
- if(isPathRelative(importTo)){
32
- return;
33
- }
34
- const segments = importTo.split('/')
35
- //[enteties, article, ... далее еще что-то может быть]
36
- const isImportNotFromPublicApi = segments.lenght > 2;
37
-
38
- if(isImportNotFromPublicApi) {
39
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
40
- }
41
- }
42
- };
43
- },
44
- };
@@ -1,43 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [],
14
- },
15
-
16
-
17
- create(context) {
18
- const checkingLayers = {
19
- "entities":"entities",
20
- "features":"features",
21
- "pages":"pages",
22
- "widgets":"widgets",
23
- }
24
- const alias = context.options[0]?.alias ?? "";
25
- return {
26
- ImportDeclaration(node) {
27
- // example app/entities/Article
28
- const value = node.source.value;
29
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
30
- if(isPathRelative(importTo)){
31
- return;
32
- }
33
- const segments = importTo.split('/')
34
- //[enteties, article, ... далее еще что-то может быть]
35
- const isImportNotFromPublicApi = segments.lenght > 2;
36
-
37
- if(isImportNotFromPublicApi) {
38
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
39
- }
40
- }
41
- };
42
- },
43
- };
@@ -1,48 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [],
14
- },
15
-
16
-
17
- create(context) {
18
- const checkingLayers = {
19
- "entities":"entities",
20
- "features":"features",
21
- "pages":"pages",
22
- "widgets":"widgets",
23
- }
24
- const alias = context.options[0]?.alias ?? "";
25
- return {
26
- ImportDeclaration(node) {
27
- // example app/entities/Article
28
- const value = node.source.value;
29
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
30
- if(isPathRelative(importTo)){
31
- return;
32
- }
33
- //[enteties, article, ... далее еще что-то может быть]
34
- const segments = importTo.split('/')
35
- const layer = segments[0]//получаем слой
36
- if(!checkingLayers[layer]){
37
- return;
38
- }
39
-
40
- const isImportNotFromPublicApi = segments.lenght > 2;
41
-
42
- if(isImportNotFromPublicApi) {
43
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
44
- }
45
- }
46
- };
47
- },
48
- };
@@ -1,48 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [],
14
- },
15
-
16
-
17
- create(context) {
18
- const checkingLayers = {
19
- "entities":"entities",
20
- "features":"features",
21
- "pages":"pages",
22
- "widgets":"widgets",
23
- }
24
- const alias = context.options[0]?.alias ?? "";
25
- return {
26
- ImportDeclaration(node) {
27
- // example app/entities/Article
28
- const value = node.source.value;
29
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
30
- if(isPathRelative(importTo)){
31
- return;
32
- }
33
- //[enteties, article, ... далее еще что-то может быть]
34
- const segments = importTo.split('/')
35
- const layer = segments[0]//получаем слой
36
- if(!checkingLayers[layer]){
37
- return;
38
- }
39
-
40
- const isImportNotFromPublicApi = segments.lenght > 2;
41
-
42
- if(isImportNotFromPublicApi) {
43
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
44
- }
45
- }
46
- };
47
- },
48
- };
@@ -1,58 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [
14
- {
15
- type:"object",
16
- properties:
17
- {
18
- alias:{
19
- type: 'string'
20
- }
21
- }
22
- }
23
- ],
24
- },
25
-
26
-
27
- create(context) {
28
- const checkingLayers = {
29
- "entities":"entities",
30
- "features":"features",
31
- "pages":"pages",
32
- "widgets":"widgets",
33
- }
34
- const alias = context.options[0]?.alias ?? "";
35
- return {
36
- ImportDeclaration(node) {
37
- // example app/entities/Article
38
- const value = node.source.value;
39
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
40
- if(isPathRelative(importTo)){
41
- return;
42
- }
43
- //[enteties, article, ... далее еще что-то может быть]
44
- const segments = importTo.split('/')
45
- const layer = segments[0]//получаем слой
46
- if(!checkingLayers[layer]){
47
- return;
48
- }
49
-
50
- const isImportNotFromPublicApi = segments.lenght > 2;
51
-
52
- if(isImportNotFromPublicApi) {
53
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
54
- }
55
- }
56
- };
57
- },
58
- };
@@ -1,60 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [
14
- {
15
- type: 'object',
16
- properties: {
17
- alias: {
18
- type: 'string'
19
- },
20
- testFilesPatterns: {
21
- type: 'array'
22
- }
23
- }
24
- }
25
- ],
26
- },
27
-
28
-
29
- create(context) {
30
- const checkingLayers = {
31
- "entities":"entities",
32
- "features":"features",
33
- "pages":"pages",
34
- "widgets":"widgets",
35
- }
36
- const alias = context.options[0]?.alias ?? "";
37
- return {
38
- ImportDeclaration(node) {
39
- // example app/entities/Article
40
- const value = node.source.value;
41
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
42
- if(isPathRelative(importTo)){
43
- return;
44
- }
45
- //[enteties, article, ... далее еще что-то может быть]
46
- const segments = importTo.split('/')
47
- const layer = segments[0]//получаем слой
48
- if(!checkingLayers[layer]){
49
- return;
50
- }
51
-
52
- const isImportNotFromPublicApi = segments.lenght > 2;
53
-
54
- if(isImportNotFromPublicApi) {
55
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
56
- }
57
- }
58
- };
59
- },
60
- };
@@ -1,61 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [
14
- {
15
- type: 'object',
16
- properties: {
17
- alias: {
18
- type: 'string'
19
- },
20
- testFilesPatterns: {
21
- type: 'array'
22
- }
23
- }
24
- }
25
- ],
26
- },
27
-
28
-
29
- create(context) {
30
- const checkingLayers = {
31
- "entities":"entities",
32
- "features":"features",
33
- "pages":"pages",
34
- "widgets":"widgets",
35
- }
36
- const alias = context.options[0]?.alias ?? "";
37
- return {
38
- ImportDeclaration(node) {
39
- // example app/entities/Article
40
- const value = node.source.value;
41
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
42
- //если путь относительный то выходим
43
- if(isPathRelative(importTo)){
44
- return;
45
- }
46
- //[enteties, article, ... далее еще что-то может быть]
47
- const segments = importTo.split('/')
48
- const layer = segments[0]//получаем слой
49
- if(!checkingLayers[layer]){
50
- return;
51
- }
52
-
53
- const isImportNotFromPublicApi = segments.lenght > 2;
54
-
55
- if(isImportNotFromPublicApi) {
56
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
57
- }
58
- }
59
- };
60
- },
61
- };
@@ -1,62 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [
14
- {
15
- type: 'object',
16
- properties: {
17
- alias: {
18
- type: 'string'
19
- },
20
- testFilesPatterns: {
21
- type: 'array'
22
- }
23
- }
24
- }
25
- ],
26
- },
27
-
28
-
29
- create(context) {
30
- const checkingLayers = {
31
- "entities":"entities",
32
- "features":"features",
33
- "pages":"pages",
34
- "widgets":"widgets",
35
- }
36
- const alias = context.options[0]?.alias ?? "";
37
- return {
38
- ImportDeclaration(node) {
39
- // example app/entities/Article
40
- const value = node.source.value;
41
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
42
- //если путь относительный то выходим
43
- if(isPathRelative(importTo)){
44
- return;
45
- }
46
- //[enteties, article, ... далее еще что-то может быть]
47
- const segments = importTo.split('/')
48
- const layer = segments[0]//получаем слой
49
- // проверяем что есть слой из массива
50
- if(!checkingLayers[layer]){
51
- return;
52
- }
53
-
54
- const isImportNotFromPublicApi = segments.lenght > 2;
55
-
56
- if(isImportNotFromPublicApi) {
57
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
58
- }
59
- }
60
- };
61
- },
62
- };
@@ -1,62 +0,0 @@
1
- "use strict";
2
- const {isPathRelative} = require("../helpers")
3
- module.exports = {
4
- meta: {
5
- type: null,
6
- docs: {
7
- description: "description",
8
- category: "Fill me in",
9
- recommended: false,
10
- url: null,
11
- },
12
- fixable: null,
13
- schema: [
14
- {
15
- type: 'object',
16
- properties: {
17
- alias: {
18
- type: 'string'
19
- },
20
- testFilesPatterns: {
21
- type: 'array'
22
- }
23
- }
24
- }
25
- ],
26
- },
27
-
28
-
29
- create(context) {
30
- const checkingLayers = {
31
- "entities":"entities",
32
- "features":"features",
33
- "pages":"pages",
34
- "widgets":"widgets",
35
- }
36
- const alias = context.options[0]?.alias ?? "";
37
- return {
38
- ImportDeclaration(node) {
39
- // example app/entities/Article
40
- const value = node.source.value;
41
- const importTo = alias ? value.replace(`${alias}/`, "") : value;
42
- //если путь относительный то выходим
43
- if(isPathRelative(importTo)){
44
- return;
45
- }
46
- //[enteties, article, ... далее еще что-то может быть]
47
- const segments = importTo.split('/')
48
- const layer = segments[0]//получаем слой
49
- // проверяем что есть слой из массива
50
- if(!checkingLayers[layer]){
51
- return;
52
- }
53
- console.log("Работает")
54
- const isImportNotFromPublicApi = segments.lenght > 2;
55
-
56
- if(isImportNotFromPublicApi) {
57
- context.report({node: node, message: 'Абсолютный импорт разрешен только из Public Api(index.ts)'});
58
- }
59
- }
60
- };
61
- },
62
- };