-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
independentModules.mjs
66 lines (59 loc) · 1.5 KB
/
independentModules.mjs
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
66
// @ts-check
import { createIndependentModules } from "eslint-plugin-project-structure";
export const independentModulesConfig = createIndependentModules({
debugMode: false,
modules: [
{
name: "Rules",
pattern: "rules/**",
allowImportsFrom: [
"{familyImports}",
"{globalHelpers}",
"{globalConsts}",
"{globalErrors}",
"{globalTypes}",
],
},
{
name: "Global helpers",
pattern: "helpers/**",
allowImportsFrom: [
"{familyImports}",
"{globalHelpers}",
"{globalConsts}",
"{globalErrors}",
"{globalTypes}",
],
},
{
name: "Global error",
pattern: "errors/**",
allowImportsFrom: ["{familyImports}", "{globalErrors}"],
},
{
name: "Globals",
pattern: "(consts|parser).ts",
allowImportsFrom: [],
},
],
reusableImportPatterns: {
privateFolders: ["(helpers|errors)"],
privateFiles: ["*.(types|consts).ts"],
notPrivateFilesAndFolders: [
"!(**/{privateFiles})",
"!(**/{privateFolders}/**)",
],
globalTypes: ["types.ts"],
globalConsts: ["consts.ts"],
globalErrors: ["errors/**"],
globalHelpers: [["helpers/**", "{notPrivateFilesAndFolders}"]],
familyImports: [
["{family}/*", "!{family}/*.test.ts"],
[
"{family}/{privateFolders}/*/*",
"!{family}/{privateFolders}/*/{privateFiles}",
],
["{family}/*/*", "!{family}/*/{privateFiles}"],
],
},
});