eslint-plugin-big-react-app-plugin 0.1.4 → 0.1.6
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/.history/lib/rules/{public-api-imports_20251018094512.js → public-api-imports_20251028164625.js} +19 -5
- package/.history/lib/rules/{public-api-imports_20251018094801.js → public-api-imports_20251028165757.js} +17 -4
- package/.history/lib/rules/{public-api-imports_20251018095046.js → public-api-imports_20251028165803.js} +17 -3
- package/.history/{package_20250906110616.json → package_20251028164641.json} +2 -1
- package/.history/{package_20251016192249.json → package_20251028165941.json} +2 -1
- package/lib/rules/public-api-imports.js +17 -3
- package/package.json +2 -1
- package/tests/lib/rules/public-api-imports.js +13 -4
- package/.history/.gitignore_20251018083109 +0 -0
- package/.history/.gitignore_20251018083124 +0 -1
- package/.history/lib/helpers/index_20251018083334.js +0 -0
- package/.history/lib/helpers/index_20251018083357.js +0 -6
- package/.history/lib/helpers/index_20251018083414.js +0 -6
- package/.history/lib/helpers/index_20251018083417.js +0 -6
- package/.history/lib/helpers/index_20251018083618.js +0 -6
- package/.history/lib/helpers/index_20251018092620.js +0 -6
- package/.history/lib/helpers/index_20251018092627.js +0 -6
- package/.history/lib/rules/path-checker_20250906110609.js +0 -76
- package/.history/lib/rules/path-checker_20251016170231.js +0 -76
- package/.history/lib/rules/path-checker_20251016170238.js +0 -76
- package/.history/lib/rules/path-checker_20251016170240.js +0 -76
- package/.history/lib/rules/path-checker_20251016170512.js +0 -76
- package/.history/lib/rules/path-checker_20251016170543.js +0 -78
- package/.history/lib/rules/path-checker_20251016170608.js +0 -81
- package/.history/lib/rules/path-checker_20251016170627.js +0 -81
- package/.history/lib/rules/path-checker_20251016170714.js +0 -81
- package/.history/lib/rules/path-checker_20251016170716.js +0 -83
- package/.history/lib/rules/path-checker_20251016170723.js +0 -84
- package/.history/lib/rules/path-checker_20251016170726.js +0 -84
- package/.history/lib/rules/path-checker_20251016170750.js +0 -85
- package/.history/lib/rules/path-checker_20251016170808.js +0 -85
- package/.history/lib/rules/path-checker_20251016170811.js +0 -85
- package/.history/lib/rules/path-checker_20251016170821.js +0 -85
- package/.history/lib/rules/path-checker_20251016170941.js +0 -86
- package/.history/lib/rules/path-checker_20251016170953.js +0 -86
- package/.history/lib/rules/path-checker_20251016171234.js +0 -87
- package/.history/lib/rules/path-checker_20251016171235.js +0 -87
- package/.history/lib/rules/path-checker_20251016171244.js +0 -87
- package/.history/lib/rules/path-checker_20251016192227.js +0 -89
- package/.history/lib/rules/path-checker_20251016192245.js +0 -89
- package/.history/lib/rules/path-checker_20251018083151.js +0 -89
- package/.history/lib/rules/path-checker_20251018083710.js +0 -87
- package/.history/lib/rules/public-api-imports_20251018083042.js +0 -44
- package/.history/lib/rules/public-api-imports_20251018083211.js +0 -50
- package/.history/lib/rules/public-api-imports_20251018083235.js +0 -43
- package/.history/lib/rules/public-api-imports_20251018083244.js +0 -51
- package/.history/lib/rules/public-api-imports_20251018083454.js +0 -51
- package/.history/lib/rules/public-api-imports_20251018083640.js +0 -40
- package/.history/lib/rules/public-api-imports_20251018083748.js +0 -42
- package/.history/lib/rules/public-api-imports_20251018083818.js +0 -42
- package/.history/lib/rules/public-api-imports_20251018084540.js +0 -41
- package/.history/lib/rules/public-api-imports_20251018084843.js +0 -44
- package/.history/lib/rules/public-api-imports_20251018084847.js +0 -44
- package/.history/lib/rules/public-api-imports_20251018084906.js +0 -44
- package/.history/lib/rules/public-api-imports_20251018084913.js +0 -43
- package/.history/lib/rules/public-api-imports_20251018085014.js +0 -48
- package/.history/lib/rules/public-api-imports_20251018085807.js +0 -48
- package/.history/lib/rules/public-api-imports_20251018090400.js +0 -58
- package/.history/lib/rules/public-api-imports_20251018091033.js +0 -60
- package/.history/lib/rules/public-api-imports_20251018092312.js +0 -61
- package/.history/lib/rules/public-api-imports_20251018092340.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018093209.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018093226.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018093319.js +0 -63
- package/.history/lib/rules/public-api-imports_20251018094349.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018094423.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018094442.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018094549.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018094630.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018094655.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018094728.js +0 -62
- package/.history/lib/rules/public-api-imports_20251018094729.js +0 -62
- package/.history/package_20251018085916.json +0 -32
- package/.history/package_20251018090415.json +0 -32
- package/.history/package_20251018091504.json +0 -32
- package/.history/package_20251018092723.json +0 -32
- package/.history/package_20251018095035.json +0 -32
- package/.history/tests/lib/rules/path-checker_20250906083402.js +0 -31
- package/.history/tests/lib/rules/path-checker_20251016165925.js +0 -33
- package/.history/tests/lib/rules/path-checker_20251016170059.js +0 -34
- package/.history/tests/lib/rules/path-checker_20251016170109.js +0 -34
- package/.history/tests/lib/rules/path-checker_20251016170128.js +0 -34
- package/.history/tests/lib/rules/path-checker_20251016170147.js +0 -34
- package/.history/tests/lib/rules/path-checker_20251016170208.js +0 -34
- package/.history/tests/lib/rules/path-checker_20251016170246.js +0 -34
- package/.history/tests/lib/rules/path-checker_20251016170253.js +0 -34
- package/.history/tests/lib/rules/path-checker_20251016170255.js +0 -34
- package/.history/tests/lib/rules/path-checker_20251016170323.js +0 -34
- package/.history/tests/lib/rules/path-checker_20251016170411.js +0 -38
- package/.history/tests/lib/rules/path-checker_20251016170459.js +0 -38
- package/.history/tests/lib/rules/path-checker_20251016171025.js +0 -43
- package/.history/tests/lib/rules/path-checker_20251016171041.js +0 -43
- package/.history/tests/lib/rules/path-checker_20251016171053.js +0 -43
- package/.history/tests/lib/rules/path-checker_20251016171136.js +0 -42
- package/.history/tests/lib/rules/path-checker_20251016171410.js +0 -44
- package/.history/tests/lib/rules/public-api-imports_20251018083042.js +0 -31
- package/.history/tests/lib/rules/public-api-imports_20251018085128.js +0 -34
- package/.history/tests/lib/rules/public-api-imports_20251018085249.js +0 -34
- package/.history/tests/lib/rules/public-api-imports_20251018085350.js +0 -40
- package/.history/tests/lib/rules/public-api-imports_20251018085726.js +0 -36
- package/.history/tests/lib/rules/public-api-imports_20251018090807.js +0 -86
- package/.history/tests/lib/rules/public-api-imports_20251018094915.js +0 -86
- package/.history/tests/lib/rules/public-api-imports_20251018094931.js +0 -78
|
@@ -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,89 +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:{
|
|
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'))
|
|
@@ -1,89 +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:{
|
|
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'))
|
|
@@ -1,89 +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:{
|
|
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'))
|
|
@@ -1,87 +0,0 @@
|
|
|
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'))
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
};
|