-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patheslint.config.js
More file actions
145 lines (137 loc) · 5.12 KB
/
eslint.config.js
File metadata and controls
145 lines (137 loc) · 5.12 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import tsParser from "@typescript-eslint/parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import importPlugin from "eslint-plugin-import";
import unusedImportsPlugin from "eslint-plugin-unused-imports";
export default [
{
ignores: ["node_modules/", "dist/", "build/", ".next/", "coverage/", "*.config.js"]
},
{
files: ["src/**/*.ts"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2020,
sourceType: "module"
}
},
plugins: {
"@typescript-eslint": tsPlugin,
import: importPlugin,
"unused-imports": unusedImportsPlugin
},
rules: {
// --- Code quality ---
"prefer-const": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": ["warn", {
args: "all",
argsIgnorePattern: "^_",
varsIgnorePattern: "^_"
}],
"unused-imports/no-unused-imports": "error",
// --- Formatting (ESLint is the sole formatter — no Prettier) ---
"no-trailing-spaces": "error",
"eol-last": ["error", "always"],
"quotes": ["error", "double", { avoidEscape: true, allowTemplateLiterals: true }],
"semi": ["error", "always"],
"comma-dangle": ["error", "never"],
"indent": ["warn", 2, { SwitchCase: 1 }],
"comma-spacing": ["error", { before: false, after: true }],
"key-spacing": ["error", { beforeColon: false, afterColon: true, mode: "strict" }],
"keyword-spacing": ["error", { before: true, after: true }],
"space-infix-ops": "error",
"no-multi-spaces": ["error", { ignoreEOLComments: true }],
"block-spacing": ["error", "always"],
// --- Compact / single-line formatting ---
"brace-style": ["error", "1tbs", { allowSingleLine: true }],
curly: ["error", "multi-line"],
"nonblock-statement-body-position": ["error", "beside"],
// Objects
"object-curly-spacing": ["error", "always"],
"object-curly-newline": ["error", {
ObjectExpression: { multiline: true },
ObjectPattern: { multiline: true },
ImportDeclaration: { multiline: true },
ExportDeclaration: { multiline: true }
}],
"object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
// Arrays
"array-bracket-spacing": ["error", "never"],
"array-bracket-newline": ["error", { multiline: true, minItems: 8 }],
"array-element-newline": ["error", { ArrayExpression: "consistent", ArrayPattern: { minItems: 8 } }],
// Functions
"function-paren-newline": ["error", "consistent"],
"function-call-argument-newline": ["error", "consistent"],
// Line length
"max-len": ["warn", {
code: 250,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreComments: true,
ignoreUrls: true,
ignoreRegExpLiterals: true
}],
// Module separation rules for monolith
"import/no-restricted-paths": [
"error",
{
zones: [
{
target: "./src/modules/attendance/**/*",
from: "./src/modules/!(attendance)/**/*",
message: "Attendance module should not import directly from other modules. Use shared interfaces or dependency injection."
},
{
target: "./src/modules/content/**/*",
from: "./src/modules/!(content)/**/*",
message: "Content module should not import directly from other modules. Use shared interfaces or dependency injection."
},
{
target: "./src/modules/doing/**/*",
from: "./src/modules/!(doing)/**/*",
message: "Doing module should not import directly from other modules. Use shared interfaces or dependency injection."
},
{
target: "./src/modules/giving/**/*",
from: "./src/modules/!(giving)/**/*",
message: "Giving module should not import directly from other modules. Use shared interfaces or dependency injection."
},
{
target: "./src/modules/membership/**/*",
from: "./src/modules/!(membership)/**/*",
message: "Membership module should not import directly from other modules. Use shared interfaces or dependency injection."
},
{
target: "./src/modules/messaging/**/*",
from: "./src/modules/!(messaging)/**/*",
message: "Messaging module should not import directly from other modules. Use shared interfaces or dependency injection."
}
]
}
]
},
settings: {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: "./tsconfig.json"
}
}
}
},
{
// Special rules for files that need cross-module access
files: [
"src/app.ts",
"src/routes.ts",
"src/lambda/**/*.ts",
"src/shared/infrastructure/RepoManager.ts",
"src/shared/helpers/StripeHelper.ts",
"src/modules/*/index.ts"
],
rules: {
"import/no-restricted-paths": "off"
}
}
];