eslint-plugin-big-react-app-plugin 0.1.9 → 0.2.0
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/layer-imports_20251101143845.js +44 -0
- package/.history/lib/rules/layer-imports_20251101144032.js +106 -0
- package/.history/lib/rules/layer-imports_20251101144044.js +106 -0
- package/.history/lib/rules/layer-imports_20251101144137.js +106 -0
- package/.history/lib/rules/layer-imports_20251101144214.js +110 -0
- package/.history/package_20251102101931.json +33 -0
- package/.history/package_20251102101944.json +33 -0
- package/.history/tests/lib/rules/layer-imports_20251101143845.js +31 -0
- package/.history/tests/lib/rules/layer-imports_20251101144101.js +77 -0
- package/.history/tests/lib/rules/layer-imports_20251101144110.js +81 -0
- package/.history/tests/lib/rules/layer-imports_20251101144121.js +83 -0
- package/.history/tests/lib/rules/layer-imports_20251101144130.js +97 -0
- package/.history/tests/lib/rules/path-checker_20251101143521.js +34 -0
- package/.history/tests/lib/rules/public-api-imports_20251101143401.js +95 -0
- package/.history/tests/lib/rules/public-api-imports_20251101143431.js +95 -0
- package/.history/tests/lib/rules/public-api-imports_20251101143526.js +87 -0
- package/docs/rules/layer-imports.md +35 -0
- package/lib/rules/layer-imports.js +110 -0
- package/package.json +1 -1
- package/tests/lib/rules/layer-imports.js +97 -0
- package/tests/lib/rules/path-checker.js +1 -11
- package/tests/lib/rules/public-api-imports.js +1 -10
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The rule ensures that the layers above are not used in the layers below.
|
|
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: "The rule ensures that the layers above are not used in the layers below.",
|
|
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,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The rule ensures that the layers above are not used in the layers below.
|
|
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: "saf",
|
|
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: [
|
|
25
|
+
{
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
alias: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
},
|
|
31
|
+
ignoreImportPatterns: {
|
|
32
|
+
type: 'array',
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
create(context) {
|
|
40
|
+
const layers = {
|
|
41
|
+
'app': ['pages', 'widgets', 'features', 'shared', 'entities'],
|
|
42
|
+
'pages': ['widgets', 'features', 'shared', 'entities'],
|
|
43
|
+
'widgets': ['features', 'shared', 'entities'],
|
|
44
|
+
'features': ['shared', 'entities'],
|
|
45
|
+
'entities': ['shared', 'entities'],
|
|
46
|
+
'shared': ['shared'],
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const availableLayers = {
|
|
50
|
+
'app': 'app',
|
|
51
|
+
'entities': 'entities',
|
|
52
|
+
'features': 'features',
|
|
53
|
+
'shared': 'shared',
|
|
54
|
+
'pages': 'pages',
|
|
55
|
+
'widgets': 'widgets',
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const {alias = '', ignoreImportPatterns = []} = context.options[0] ?? {};
|
|
60
|
+
|
|
61
|
+
const getCurrentFileLayer = () => {
|
|
62
|
+
const currentFilePath = context.getFilename();
|
|
63
|
+
|
|
64
|
+
const normalizedPath = path.toNamespacedPath(currentFilePath);
|
|
65
|
+
const projectPath = normalizedPath?.split('src')[1];
|
|
66
|
+
const segments = projectPath?.split('\\')
|
|
67
|
+
|
|
68
|
+
return segments?.[1];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const getImportLayer = (value) => {
|
|
72
|
+
const importPath = alias ? value.replace(`${alias}/`, '') : value;
|
|
73
|
+
const segments = importPath?.split('/')
|
|
74
|
+
|
|
75
|
+
return segments?.[0]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
ImportDeclaration(node) {
|
|
80
|
+
const importPath = node.source.value
|
|
81
|
+
const currentFileLayer = getCurrentFileLayer()
|
|
82
|
+
const importLayer = getImportLayer(importPath)
|
|
83
|
+
|
|
84
|
+
if(isPathRelative(importPath)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if(!availableLayers[importLayer] || !availableLayers[currentFileLayer]) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const isIgnored = ignoreImportPatterns.some(pattern => {
|
|
93
|
+
return micromatch.isMatch(importPath, pattern)
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if(isIgnored) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if(!layers[currentFileLayer]?.includes(importLayer)) {
|
|
101
|
+
context.report(node, 'Слой может импортировать в себя только нижележащие слои (shared, entities, features, widgets, pages, app)');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The rule ensures that the layers above are not used in the layers below.
|
|
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: "saf",
|
|
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: [
|
|
25
|
+
{
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
alias: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
},
|
|
31
|
+
ignoreImportPatterns: {
|
|
32
|
+
type: 'array',
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
create(context) {
|
|
40
|
+
const layers = {
|
|
41
|
+
'app': ['pages', 'widgets', 'features', 'shared', 'entities'],
|
|
42
|
+
'pages': ['widgets', 'features', 'shared', 'entities'],
|
|
43
|
+
'widgets': ['features', 'shared', 'entities'],
|
|
44
|
+
'features': ['shared', 'entities'],
|
|
45
|
+
'entities': ['shared', 'entities'],
|
|
46
|
+
'shared': ['shared'],
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const availableLayers = {
|
|
50
|
+
'app': 'app',
|
|
51
|
+
'entities': 'entities',
|
|
52
|
+
'features': 'features',
|
|
53
|
+
'shared': 'shared',
|
|
54
|
+
'pages': 'pages',
|
|
55
|
+
'widgets': 'widgets',
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const {alias = '', ignoreImportPatterns = []} = context.options[0] ?? {};
|
|
60
|
+
|
|
61
|
+
const getCurrentFileLayer = () => {
|
|
62
|
+
const currentFilePath = context.getFilename();
|
|
63
|
+
|
|
64
|
+
const normalizedPath = path.toNamespacedPath(currentFilePath);
|
|
65
|
+
const projectPath = normalizedPath?.split('src')[1];
|
|
66
|
+
const segments = projectPath?.split('\\')
|
|
67
|
+
|
|
68
|
+
return segments?.[1];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const getImportLayer = (value) => {
|
|
72
|
+
const importPath = alias ? value.replace(`${alias}/`, '') : value;
|
|
73
|
+
const segments = importPath?.split('/')
|
|
74
|
+
|
|
75
|
+
return segments?.[0]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
ImportDeclaration(node) {
|
|
80
|
+
const importPath = node.source.value
|
|
81
|
+
const currentFileLayer = getCurrentFileLayer()
|
|
82
|
+
const importLayer = getImportLayer(importPath)
|
|
83
|
+
|
|
84
|
+
if(isPathRelative(importPath)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if(!availableLayers[importLayer] || !availableLayers[currentFileLayer]) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const isIgnored = ignoreImportPatterns.some(pattern => {
|
|
93
|
+
return micromatch.isMatch(importPath, pattern)
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if(isIgnored) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if(!layers[currentFileLayer]?.includes(importLayer)) {
|
|
101
|
+
context.report(node, 'Слой может импортировать в себя только нижележащие слои (shared, entities, features, widgets, pages, app)');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The rule ensures that the layers above are not used in the layers below.
|
|
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: "saf",
|
|
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: [
|
|
25
|
+
{
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
alias: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
},
|
|
31
|
+
ignoreImportPatterns: {
|
|
32
|
+
type: 'array',
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
create(context) {
|
|
40
|
+
const layers = {
|
|
41
|
+
'app': ['pages', 'widgets', 'features', 'shared', 'entities'],
|
|
42
|
+
'pages': ['widgets', 'features', 'shared', 'entities'],
|
|
43
|
+
'widgets': ['features', 'shared', 'entities'],
|
|
44
|
+
'features': ['shared', 'entities'],
|
|
45
|
+
'entities': ['shared', 'entities'],
|
|
46
|
+
'shared': ['shared'],
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const availableLayers = {
|
|
50
|
+
'app': 'app',
|
|
51
|
+
'entities': 'entities',
|
|
52
|
+
'features': 'features',
|
|
53
|
+
'shared': 'shared',
|
|
54
|
+
'pages': 'pages',
|
|
55
|
+
'widgets': 'widgets',
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const {alias = '', ignoreImportPatterns = []} = context.options[0] ?? {};
|
|
60
|
+
|
|
61
|
+
const getCurrentFileLayer = () => {
|
|
62
|
+
const currentFilePath = context.getFilename();
|
|
63
|
+
|
|
64
|
+
const normalizedPath = path.toNamespacedPath(currentFilePath);
|
|
65
|
+
const projectPath = normalizedPath?.split('src')[1];
|
|
66
|
+
const segments = projectPath?.split('\\')
|
|
67
|
+
|
|
68
|
+
return segments?.[1];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const getImportLayer = (value) => {
|
|
72
|
+
const importPath = alias ? value.replace(`${alias}/`, '') : value;
|
|
73
|
+
const segments = importPath?.split('/')
|
|
74
|
+
|
|
75
|
+
return segments?.[0]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
ImportDeclaration(node) {
|
|
80
|
+
const importPath = node.source.value
|
|
81
|
+
const currentFileLayer = getCurrentFileLayer()
|
|
82
|
+
const importLayer = getImportLayer(importPath)
|
|
83
|
+
|
|
84
|
+
if(isPathRelative(importPath)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if(!availableLayers[importLayer] || !availableLayers[currentFileLayer]) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const isIgnored = ignoreImportPatterns.some(pattern => {
|
|
93
|
+
return micromatch.isMatch(importPath, pattern)
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if(isIgnored) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if(!layers[currentFileLayer]?.includes(importLayer)) {
|
|
101
|
+
context.report(node, 'Слой может импортировать в себя только нижележащие слои (shared, entities, features, widgets, pages, app)');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The rule ensures that the layers above are not used in the layers below.
|
|
3
|
+
* @author vasilii
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
//------------------------------------------------------------------------------
|
|
8
|
+
// Rule Definition
|
|
9
|
+
//------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @type {import('eslint').Rule.RuleModule}
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const {isPathRelative} = require('../helpers');
|
|
17
|
+
const micromatch = require('micromatch');
|
|
18
|
+
module.exports = {
|
|
19
|
+
meta: {
|
|
20
|
+
type: null, // `problem`, `suggestion`, or `layout`
|
|
21
|
+
docs: {
|
|
22
|
+
description: "saf",
|
|
23
|
+
category: "Fill me in",
|
|
24
|
+
recommended: false,
|
|
25
|
+
url: null, // URL to the documentation page for this rule
|
|
26
|
+
},
|
|
27
|
+
fixable: null, // Or `code` or `whitespace`
|
|
28
|
+
schema: [
|
|
29
|
+
{
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {
|
|
32
|
+
alias: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
},
|
|
35
|
+
ignoreImportPatterns: {
|
|
36
|
+
type: 'array',
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
create(context) {
|
|
44
|
+
const layers = {
|
|
45
|
+
'app': ['pages', 'widgets', 'features', 'shared', 'entities'],
|
|
46
|
+
'pages': ['widgets', 'features', 'shared', 'entities'],
|
|
47
|
+
'widgets': ['features', 'shared', 'entities'],
|
|
48
|
+
'features': ['shared', 'entities'],
|
|
49
|
+
'entities': ['shared', 'entities'],
|
|
50
|
+
'shared': ['shared'],
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const availableLayers = {
|
|
54
|
+
'app': 'app',
|
|
55
|
+
'entities': 'entities',
|
|
56
|
+
'features': 'features',
|
|
57
|
+
'shared': 'shared',
|
|
58
|
+
'pages': 'pages',
|
|
59
|
+
'widgets': 'widgets',
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const {alias = '', ignoreImportPatterns = []} = context.options[0] ?? {};
|
|
64
|
+
|
|
65
|
+
const getCurrentFileLayer = () => {
|
|
66
|
+
const currentFilePath = context.getFilename();
|
|
67
|
+
|
|
68
|
+
const normalizedPath = path.toNamespacedPath(currentFilePath);
|
|
69
|
+
const projectPath = normalizedPath?.split('src')[1];
|
|
70
|
+
const segments = projectPath?.split('\\')
|
|
71
|
+
|
|
72
|
+
return segments?.[1];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const getImportLayer = (value) => {
|
|
76
|
+
const importPath = alias ? value.replace(`${alias}/`, '') : value;
|
|
77
|
+
const segments = importPath?.split('/')
|
|
78
|
+
|
|
79
|
+
return segments?.[0]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
ImportDeclaration(node) {
|
|
84
|
+
const importPath = node.source.value
|
|
85
|
+
const currentFileLayer = getCurrentFileLayer()
|
|
86
|
+
const importLayer = getImportLayer(importPath)
|
|
87
|
+
|
|
88
|
+
if(isPathRelative(importPath)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if(!availableLayers[importLayer] || !availableLayers[currentFileLayer]) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const isIgnored = ignoreImportPatterns.some(pattern => {
|
|
97
|
+
return micromatch.isMatch(importPath, pattern)
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
if(isIgnored) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if(!layers[currentFileLayer]?.includes(importLayer)) {
|
|
105
|
+
context.report(node, 'Слой может импортировать в себя только нижележащие слои (shared, entities, features, widgets, pages, app)');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-plugin-big-react-app-plugin",
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"description": "plugin for prod proj",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint",
|
|
7
|
+
"eslintplugin",
|
|
8
|
+
"eslint-plugin"
|
|
9
|
+
],
|
|
10
|
+
"author": "Vasilii",
|
|
11
|
+
"main": "lib/index.js",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "eslint .",
|
|
14
|
+
"test": "mocha tests --recursive"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"micromatch": "^4.0.5",
|
|
18
|
+
"requireindex": "^1.2.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"eslint": "^8.0.1",
|
|
22
|
+
"eslint-plugin-eslint-plugin": "^4.0.1",
|
|
23
|
+
"eslint-plugin-node": "^11.1.0",
|
|
24
|
+
"mocha": "^9.1.3"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": "12.x || 14.x || >= 16"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"eslint": ">=6"
|
|
31
|
+
},
|
|
32
|
+
"license": "ISC"
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-plugin-big-react-app-plugin",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "plugin for prod proj",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint",
|
|
7
|
+
"eslintplugin",
|
|
8
|
+
"eslint-plugin"
|
|
9
|
+
],
|
|
10
|
+
"author": "Vasilii",
|
|
11
|
+
"main": "lib/index.js",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "eslint .",
|
|
14
|
+
"test": "mocha tests --recursive"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"micromatch": "^4.0.5",
|
|
18
|
+
"requireindex": "^1.2.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"eslint": "^8.0.1",
|
|
22
|
+
"eslint-plugin-eslint-plugin": "^4.0.1",
|
|
23
|
+
"eslint-plugin-node": "^11.1.0",
|
|
24
|
+
"mocha": "^9.1.3"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": "12.x || 14.x || >= 16"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"eslint": ">=6"
|
|
31
|
+
},
|
|
32
|
+
"license": "ISC"
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The rule ensures that the layers above are not used in the layers below.
|
|
3
|
+
* @author vasilii
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
//------------------------------------------------------------------------------
|
|
8
|
+
// Requirements
|
|
9
|
+
//------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
const rule = require("../../../lib/rules/layer-imports"),
|
|
12
|
+
RuleTester = require("eslint").RuleTester;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
//------------------------------------------------------------------------------
|
|
16
|
+
// Tests
|
|
17
|
+
//------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
const ruleTester = new RuleTester();
|
|
20
|
+
ruleTester.run("layer-imports", rule, {
|
|
21
|
+
valid: [
|
|
22
|
+
// give me some code that won't trigger a warning
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
invalid: [
|
|
26
|
+
{
|
|
27
|
+
code: "",
|
|
28
|
+
errors: [{ message: "Fill me in.", type: "Me too" }],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The rule ensures that the layers above are not used in the layers below.
|
|
3
|
+
* @author vasilii
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
//------------------------------------------------------------------------------
|
|
8
|
+
// Requirements
|
|
9
|
+
//------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
const rule = require("../../../lib/rules/layer-imports"),
|
|
12
|
+
RuleTester = require("eslint").RuleTester;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
//------------------------------------------------------------------------------
|
|
16
|
+
// Tests
|
|
17
|
+
//------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
const ruleTester = new RuleTester();
|
|
20
|
+
ruleTester.run("layer-imports", rule, {
|
|
21
|
+
valid: [
|
|
22
|
+
{
|
|
23
|
+
filename: 'C:\\Users\\tim\\Desktop\\javascript\\production_project\\src\\features\\Article',
|
|
24
|
+
code: "import { addCommentFormActions, addCommentFormReducer } from '@/shared/Button.tsx'",
|
|
25
|
+
errors: [],
|
|
26
|
+
options: aliasOptions,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
filename: 'C:\\Users\\tim\\Desktop\\javascript\\production_project\\src\\features\\Article',
|
|
30
|
+
code: "import { addCommentFormActions, addCommentFormReducer } from '@/entities/Article'",
|
|
31
|
+
errors: [],
|
|
32
|
+
options: aliasOptions,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
filename: 'C:\\Users\\tim\\Desktop\\javascript\\production_project\\src\\app\\providers',
|
|
36
|
+
code: "import { addCommentFormActions, addCommentFormReducer } from '@/widgets/Articl'",
|
|
37
|
+
errors: [],
|
|
38
|
+
options: aliasOptions,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
filename: 'C:\\Users\\tim\\Desktop\\javascript\\production_project\\src\\widgets\\pages',
|
|
42
|
+
code: "import { useLocation } from 'react-router-dom'",
|
|
43
|
+
errors: [],
|
|
44
|
+
options: aliasOptions,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
filename: 'C:\\Users\\tim\\Desktop\\javascript\\production_project\\src\\app\\providers',
|
|
48
|
+
code: "import { addCommentFormActions, addCommentFormReducer } from 'redux'",
|
|
49
|
+
errors: [],
|
|
50
|
+
options: aliasOptions,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
filename: 'C:\\Users\\tim\\Desktop\\javascript\\production_project\\src\\index.tsx',
|
|
54
|
+
code: "import { StoreProvider } from '@/app/providers/StoreProvider';",
|
|
55
|
+
errors: [],
|
|
56
|
+
options: aliasOptions,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
filename: 'C:\\Users\\tim\\Desktop\\javascript\\production_project\\src\\entities\\Article.tsx',
|
|
60
|
+
code: "import { StateSchema } from '@/app/providers/StoreProvider'",
|
|
61
|
+
errors: [],
|
|
62
|
+
options: [
|
|
63
|
+
{
|
|
64
|
+
alias: '@',
|
|
65
|
+
ignoreImportPatterns: ['**/StoreProvider']
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
|
|
71
|
+
invalid: [
|
|
72
|
+
{
|
|
73
|
+
code: "",
|
|
74
|
+
errors: [{ message: "Fill me in.", type: "Me too" }],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
});
|