Skip to content

Commit e235562

Browse files
committed
refactor: split legacy and cleaned rules
#12
1 parent d9c0a21 commit e235562

File tree

2 files changed

+65
-48
lines changed

2 files changed

+65
-48
lines changed

index.js

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
1-
// Allowed paths for public API
2-
const PUBLIC_PATHS = [
3-
"app",
4-
"pages",
5-
"features",
6-
"shared",
7-
"shared/**",
8-
"models",
9-
];
10-
// Private imports are prohibited, use public imports instead
11-
const PRIVATE_PATHS = [
12-
"app/**",
13-
"pages/**",
14-
"features/**",
15-
"shared/*/**",
16-
];
17-
// Prefer absolute imports instead of relatives (for root modules)
18-
const RELATIVE_PATHS = [
19-
"../**/app",
20-
"../**/pages",
21-
"../**/features",
22-
"../**/shared",
23-
"../**/models",
24-
];
25-
261
module.exports = {
272
parserOptions: {
283
ecmaVersion: "2015",
@@ -32,28 +7,5 @@ module.exports = {
327
"import",
338
],
349
rules: {
35-
"import/first": 2,
36-
"import/no-unresolved": 0, // experimental
37-
"import/order": [
38-
2,
39-
{
40-
pathGroups: PUBLIC_PATHS.map(
41-
(pattern) => ({
42-
pattern,
43-
group: "internal",
44-
position: "after",
45-
}),
46-
),
47-
pathGroupsExcludedImportTypes: ["builtin"],
48-
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
49-
},
50-
],
51-
// TODO: with messages (https://github.com/feature-sliced/eslint-config/issues/3)
52-
"no-restricted-imports": [
53-
2,
54-
{
55-
patterns: [...PRIVATE_PATHS, ...RELATIVE_PATHS]
56-
}
57-
],
5810
},
5911
};

index.legacy.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* DO NOT MODIFY THIS FILE
3+
* THERE ARE ONLY OLD RULES THAT SHOULD BE ACTUALIZED
4+
* @see https://github.com/feature-sliced/eslint-config/issues/17
5+
*/
6+
7+
// Allowed paths for public API
8+
const PUBLIC_PATHS = [
9+
"app",
10+
"pages",
11+
"features",
12+
"shared",
13+
"shared/**",
14+
"models",
15+
];
16+
// Private imports are prohibited, use public imports instead
17+
const PRIVATE_PATHS = [
18+
"app/**",
19+
"pages/**",
20+
"features/**",
21+
"shared/*/**",
22+
];
23+
// Prefer absolute imports instead of relatives (for root modules)
24+
const RELATIVE_PATHS = [
25+
"../**/app",
26+
"../**/pages",
27+
"../**/features",
28+
"../**/shared",
29+
"../**/models",
30+
];
31+
32+
module.exports = {
33+
parserOptions: {
34+
ecmaVersion: "2015",
35+
sourceType: "module",
36+
},
37+
plugins: [
38+
"import",
39+
],
40+
rules: {
41+
"import/first": 2,
42+
"import/no-unresolved": 0, // experimental
43+
"import/order": [
44+
2,
45+
{
46+
pathGroups: PUBLIC_PATHS.map(
47+
(pattern) => ({
48+
pattern,
49+
group: "internal",
50+
position: "after",
51+
}),
52+
),
53+
pathGroupsExcludedImportTypes: ["builtin"],
54+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
55+
},
56+
],
57+
// TODO: with messages (https://github.com/feature-sliced/eslint-config/issues/3)
58+
"no-restricted-imports": [
59+
2,
60+
{
61+
patterns: [...PRIVATE_PATHS, ...RELATIVE_PATHS]
62+
}
63+
],
64+
},
65+
};

0 commit comments

Comments
 (0)