eslint-plugin-big-react-app-plugin 0.0.8 → 0.1.1

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 (38) hide show
  1. package/.history/.gitignore_20251018083109 +0 -0
  2. package/.history/.gitignore_20251018083124 +1 -0
  3. package/.history/lib/helpers/index_20251018083334.js +0 -0
  4. package/.history/lib/helpers/index_20251018083357.js +6 -0
  5. package/.history/lib/helpers/index_20251018083414.js +6 -0
  6. package/.history/lib/helpers/index_20251018083417.js +6 -0
  7. package/.history/lib/helpers/index_20251018083618.js +6 -0
  8. package/.history/lib/rules/path-checker_20251018083151.js +89 -0
  9. package/.history/lib/rules/path-checker_20251018083710.js +87 -0
  10. package/.history/lib/rules/public-api-imports_20251018083042.js +44 -0
  11. package/.history/lib/rules/public-api-imports_20251018083211.js +50 -0
  12. package/.history/lib/rules/public-api-imports_20251018083235.js +43 -0
  13. package/.history/lib/rules/public-api-imports_20251018083244.js +51 -0
  14. package/.history/lib/rules/public-api-imports_20251018083454.js +51 -0
  15. package/.history/lib/rules/public-api-imports_20251018083640.js +40 -0
  16. package/.history/lib/rules/public-api-imports_20251018083748.js +42 -0
  17. package/.history/lib/rules/public-api-imports_20251018083818.js +42 -0
  18. package/.history/lib/rules/public-api-imports_20251018084540.js +41 -0
  19. package/.history/lib/rules/public-api-imports_20251018084843.js +44 -0
  20. package/.history/lib/rules/public-api-imports_20251018084847.js +44 -0
  21. package/.history/lib/rules/public-api-imports_20251018084906.js +44 -0
  22. package/.history/lib/rules/public-api-imports_20251018084913.js +43 -0
  23. package/.history/lib/rules/public-api-imports_20251018085014.js +48 -0
  24. package/.history/lib/rules/public-api-imports_20251018085807.js +48 -0
  25. package/.history/lib/rules/public-api-imports_20251018090400.js +58 -0
  26. package/.history/package_20251018085916.json +32 -0
  27. package/.history/package_20251018090415.json +32 -0
  28. package/.history/tests/lib/rules/public-api-imports_20251018083042.js +31 -0
  29. package/.history/tests/lib/rules/public-api-imports_20251018085128.js +34 -0
  30. package/.history/tests/lib/rules/public-api-imports_20251018085249.js +34 -0
  31. package/.history/tests/lib/rules/public-api-imports_20251018085350.js +40 -0
  32. package/.history/tests/lib/rules/public-api-imports_20251018085726.js +36 -0
  33. package/docs/rules/public-api-imports.md +35 -0
  34. package/lib/helpers/index.js +6 -0
  35. package/lib/rules/path-checker.js +3 -5
  36. package/lib/rules/public-api-imports.js +58 -0
  37. package/package.json +1 -1
  38. package/tests/lib/rules/public-api-imports.js +36 -0
File without changes
@@ -0,0 +1 @@
1
+ .history
File without changes
@@ -0,0 +1,6 @@
1
+ export const pathRelative = (path)=>{
2
+ return path = path.startsWith('.' || './' || './/')
3
+ }
4
+ module.exports = {
5
+ pathRelative
6
+ }
@@ -0,0 +1,6 @@
1
+ const pathRelative = (path)=>{
2
+ return path = path.startsWith('.' || './' || './/')
3
+ }
4
+ module.exports = {
5
+ pathRelative
6
+ }
@@ -0,0 +1,6 @@
1
+ const pathRelative = (path)=>{
2
+ return path = path.startsWith('.' || './' || './/')
3
+ }
4
+ module.exports = {
5
+ pathRelative
6
+ }
@@ -0,0 +1,6 @@
1
+ const isPathRelative = (path)=>{
2
+ return path = path.startsWith('.' || './' || './/')
3
+ }
4
+ module.exports = {
5
+ isPathRelative
6
+ }
@@ -0,0 +1,89 @@
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:{
22
+ type: 'string'
23
+ }
24
+ }
25
+ }
26
+ ],
27
+ },
28
+
29
+ create(context) {
30
+ const alias = context.options[0]?.alias ?? "";
31
+ return {
32
+ ImportDeclaration(node) {
33
+ // example app/entities/Article
34
+ const value = node.source.value;
35
+ const importTo = alias ? value.replace(`${alias}/`, "") : value;
36
+
37
+ // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
38
+ const fromFilename = context.getFilename();
39
+ if(shouldBeRelative(fromFilename, importTo)) {
40
+ context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
41
+ }
42
+ }
43
+ };
44
+ },
45
+ };
46
+
47
+ const layers = {
48
+ "entities":"entities",
49
+ "features":"features",
50
+ "pages":"pages",
51
+ "shared":"shared",
52
+ "widgets":"widgets",
53
+ }
54
+ const shouldBeRelative = (from, to)=>{
55
+ if(pathRelative(to)){
56
+ return false
57
+ }
58
+ const toArray = to.split('/')
59
+ //app/entities/Article
60
+ const toLayer = toArray[0];
61
+ //"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
62
+ const toSlice = toArray[1];
63
+ if(!toLayer || !toSlice || !layers[toLayer]){
64
+ return false
65
+ }
66
+ //нормализуем путь
67
+ const normalizationPath = path.toNamespacedPath(from);
68
+ const projFrom = normalizationPath.split('src')[1]
69
+ const fromArray = projFrom.split('\\')
70
+
71
+ const fromLayer = fromArray[1];
72
+ const fromSlice = fromArray[2];
73
+ if(!fromLayer || !fromSlice || !layers[fromLayer]){
74
+ return false
75
+ }
76
+
77
+ return toSlice === fromSlice && toLayer === fromLayer
78
+ }
79
+ const pathRelative = (path)=>{
80
+ return path = path.startsWith('.' || './' || './/')
81
+ }
82
+
83
+ // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/Article/fasfasfas'))
84
+ // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'entities/ASdasd/fasfasfas'))
85
+ // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'features/Article/fasfasfas'))
86
+ // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\features\\Article', 'features/Article/fasfasfas'))
87
+ // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', 'app/index.tsx'))
88
+ // console.log(shouldBeRelative('C:/Users/tim/Desktop/javascript/GOOD_COURSE_test/src/entities/Article', 'entities/Article/asfasf/asfasf'))
89
+ // console.log(shouldBeRelative('C:\\Users\\tim\\Desktop\\javascript\\GOOD_COURSE_test\\src\\entities\\Article', '../../model/selectors/getSidebarItems'))
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ const { type } = require('os');
4
+ const path = require('path');
5
+ const {isPathRelative} = require("../helpers")
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:{
22
+ type: 'string'
23
+ }
24
+ }
25
+ }
26
+ ],
27
+ },
28
+
29
+ create(context) {
30
+ const alias = context.options[0]?.alias ?? "";
31
+ return {
32
+ ImportDeclaration(node) {
33
+ // example app/entities/Article
34
+ const value = node.source.value;
35
+ const importTo = alias ? value.replace(`${alias}/`, "") : value;
36
+
37
+ // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
38
+ const fromFilename = context.getFilename();
39
+ if(shouldBeRelative(fromFilename, importTo)) {
40
+ context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
41
+ }
42
+ }
43
+ };
44
+ },
45
+ };
46
+
47
+ const layers = {
48
+ "entities":"entities",
49
+ "features":"features",
50
+ "pages":"pages",
51
+ "shared":"shared",
52
+ "widgets":"widgets",
53
+ }
54
+ const shouldBeRelative = (from, to)=>{
55
+ if(isPathRelative(to)){
56
+ return false
57
+ }
58
+ const toArray = to.split('/')
59
+ //app/entities/Article
60
+ const toLayer = toArray[0];
61
+ //"C:\Users\ADMIN\Documents\GitHub\ulbi\big-app-react\src\entities\Article\model\types\artcile.ts"
62
+ const toSlice = toArray[1];
63
+ if(!toLayer || !toSlice || !layers[toLayer]){
64
+ return false
65
+ }
66
+ //нормализуем путь
67
+ const normalizationPath = path.toNamespacedPath(from);
68
+ const projFrom = normalizationPath.split('src')[1]
69
+ const fromArray = projFrom.split('\\')
70
+
71
+ const fromLayer = fromArray[1];
72
+ const fromSlice = fromArray[2];
73
+ if(!fromLayer || !fromSlice || !layers[fromLayer]){
74
+ return false
75
+ }
76
+
77
+ return toSlice === fromSlice && toLayer === fromLayer
78
+ }
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'))
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @fileoverview description
3
+ * @author vasilii
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ //------------------------------------------------------------------------------
10
+
11
+ /**
12
+ * @type {import('eslint').Rule.RuleModule}
13
+ */
14
+ module.exports = {
15
+ meta: {
16
+ type: null, // `problem`, `suggestion`, or `layout`
17
+ docs: {
18
+ description: "description",
19
+ category: "Fill me in",
20
+ recommended: false,
21
+ url: null, // URL to the documentation page for this rule
22
+ },
23
+ fixable: null, // Or `code` or `whitespace`
24
+ schema: [], // Add a schema if the rule has options
25
+ },
26
+
27
+ create(context) {
28
+ // variables should be defined here
29
+
30
+ //----------------------------------------------------------------------
31
+ // Helpers
32
+ //----------------------------------------------------------------------
33
+
34
+ // any helper functions should go here or else delete this section
35
+
36
+ //----------------------------------------------------------------------
37
+ // Public
38
+ //----------------------------------------------------------------------
39
+
40
+ return {
41
+ // visitor functions for different types of nodes
42
+ };
43
+ },
44
+ };
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @fileoverview description
3
+ * @author vasilii
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ //------------------------------------------------------------------------------
10
+
11
+ /**
12
+ * @type {import('eslint').Rule.RuleModule}
13
+ */
14
+ module.exports = {
15
+ meta: {
16
+ type: null, // `problem`, `suggestion`, or `layout`
17
+ docs: {
18
+ description: "description",
19
+ category: "Fill me in",
20
+ recommended: false,
21
+ url: null, // URL to the documentation page for this rule
22
+ },
23
+ fixable: null, // Or `code` or `whitespace`
24
+ schema: [], // Add a schema if the rule has options
25
+ },
26
+ const layers = {
27
+ "entities":"entities",
28
+ "features":"features",
29
+ "pages":"pages",
30
+ "shared":"shared",
31
+ "widgets":"widgets",
32
+ }
33
+ create(context) {
34
+ // variables should be defined here
35
+
36
+ //----------------------------------------------------------------------
37
+ // Helpers
38
+ //----------------------------------------------------------------------
39
+
40
+ // any helper functions should go here or else delete this section
41
+
42
+ //----------------------------------------------------------------------
43
+ // Public
44
+ //----------------------------------------------------------------------
45
+
46
+ return {
47
+ // visitor functions for different types of nodes
48
+ };
49
+ },
50
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @fileoverview description
3
+ * @author vasilii
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ //------------------------------------------------------------------------------
10
+
11
+ /**
12
+ * @type {import('eslint').Rule.RuleModule}
13
+ */
14
+ module.exports = {
15
+ meta: {
16
+ type: null, // `problem`, `suggestion`, or `layout`
17
+ docs: {
18
+ description: "description",
19
+ category: "Fill me in",
20
+ recommended: false,
21
+ url: null, // URL to the documentation page for this rule
22
+ },
23
+ fixable: null, // Or `code` or `whitespace`
24
+ schema: [], // Add a schema if the rule has options
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
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @fileoverview description
3
+ * @author vasilii
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ //------------------------------------------------------------------------------
10
+
11
+ /**
12
+ * @type {import('eslint').Rule.RuleModule}
13
+ */
14
+ module.exports = {
15
+ meta: {
16
+ type: null, // `problem`, `suggestion`, or `layout`
17
+ docs: {
18
+ description: "description",
19
+ category: "Fill me in",
20
+ recommended: false,
21
+ url: null, // URL to the documentation page for this rule
22
+ },
23
+ fixable: null, // Or `code` or `whitespace`
24
+ schema: [], // Add a schema if the rule has options
25
+ },
26
+
27
+
28
+ create(context) {
29
+ const layers = {
30
+ "entities":"entities",
31
+ "features":"features",
32
+ "pages":"pages",
33
+ "shared":"shared",
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
+ // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
44
+ const fromFilename = context.getFilename();
45
+ if(shouldBeRelative(fromFilename, importTo)) {
46
+ context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
47
+ }
48
+ }
49
+ };
50
+ },
51
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @fileoverview description
3
+ * @author vasilii
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ //------------------------------------------------------------------------------
10
+
11
+ /**
12
+ * @type {import('eslint').Rule.RuleModule}
13
+ */
14
+ module.exports = {
15
+ meta: {
16
+ type: null,
17
+ docs: {
18
+ description: "description",
19
+ category: "Fill me in",
20
+ recommended: false,
21
+ url: null,
22
+ },
23
+ fixable: null,
24
+ schema: [],
25
+ },
26
+
27
+
28
+ create(context) {
29
+ const layers = {
30
+ "entities":"entities",
31
+ "features":"features",
32
+ "pages":"pages",
33
+ "shared":"shared",
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
+ // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
44
+ const fromFilename = context.getFilename();
45
+ if(shouldBeRelative(fromFilename, importTo)) {
46
+ context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
47
+ }
48
+ }
49
+ };
50
+ },
51
+ };
@@ -0,0 +1,40 @@
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
+
32
+ // example C:\Users\tim\Desktop\javascript\production_project\src\entities\Article
33
+ const fromFilename = context.getFilename();
34
+ if(shouldBeRelative(fromFilename, importTo)) {
35
+ context.report({node: node, message: 'В рамках одного слайса все пути должны быть относительными'});
36
+ }
37
+ }
38
+ };
39
+ },
40
+ };
@@ -0,0 +1,42 @@
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
+ };
@@ -0,0 +1,42 @@
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
+ };
@@ -0,0 +1,41 @@
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
+ };
@@ -0,0 +1,44 @@
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
+ };