-
Notifications
You must be signed in to change notification settings - Fork 4
/
lite.js
63 lines (54 loc) · 2.01 KB
/
lite.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const { layersLib } = require("../../utils");
const FS_SLICED_LAYERS_REG = layersLib.getUpperLayers("shared").join("|");
const FS_SEGMENTS_REG = [
...layersLib.FS_SEGMENTS,
...layersLib.FS_SEGMENTS.map((seg) => `${seg}.*`),
].join('|');
module.exports = {
plugins: ["import"],
rules: {
"import/no-internal-modules": [
"error", {
"allow": [
/**
* Allow not segments import from slices
* @example
* 'entities/form/ui' // Fail
* 'entities/form' // Pass
*/
`**/*(${FS_SLICED_LAYERS_REG})/!(${FS_SEGMENTS_REG})`,
/**
* Allow slices with structure grouping
* @example
* 'features/auth/form' // Pass
*/
`**/*(${FS_SLICED_LAYERS_REG})/!(${FS_SEGMENTS_REG})/!(${FS_SEGMENTS_REG})`,
/**
* Allow not segments import in shared segments
* @example
* 'shared/ui/button' // Pass
*/
`**/*shared/*(${FS_SEGMENTS_REG})/!(${FS_SEGMENTS_REG})`,
/**
* Allow import from segments in shared
* @example
* 'shared/ui' // Pass
*/
`**/*shared/*(${FS_SEGMENTS_REG})`,
/** allow global modules */
`**/node_modules/**`,
/**
* allow custom shared segments with _prefix
*/
`**/*shared/_*`,
`**/*shared/_*/*`,
/**
* Used for allow import local modules
* @example
* './model/something' // Pass
*/
`./**`
],
}],
},
};