-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.legacy.js
65 lines (63 loc) · 1.58 KB
/
index.legacy.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
64
65
/**
* DO NOT MODIFY THIS FILE
* THERE ARE ONLY OLD RULES THAT SHOULD BE ACTUALIZED
* @see https://github.com/feature-sliced/eslint-config/issues/17
*/
// Allowed paths for public API
const PUBLIC_PATHS = [
"app",
"pages",
"features",
"shared",
"shared/**",
"models",
];
// Private imports are prohibited, use public imports instead
const PRIVATE_PATHS = [
"app/**",
"pages/**",
"features/**",
"shared/*/**",
];
// Prefer absolute imports instead of relatives (for root modules)
const RELATIVE_PATHS = [
"../**/app",
"../**/pages",
"../**/features",
"../**/shared",
"../**/models",
];
module.exports = {
parserOptions: {
ecmaVersion: "2015",
sourceType: "module",
},
plugins: [
"import",
],
rules: {
"import/first": 2,
"import/no-unresolved": 0, // experimental
"import/order": [
2,
{
pathGroups: PUBLIC_PATHS.map(
(pattern) => ({
pattern,
group: "internal",
position: "after",
}),
),
pathGroupsExcludedImportTypes: ["builtin"],
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
},
],
// TODO: with messages (https://github.com/feature-sliced/eslint-config/issues/3)
"no-restricted-imports": [
2,
{
patterns: [...PRIVATE_PATHS, ...RELATIVE_PATHS]
}
],
},
};