Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
152 lines (137 loc) · 3.53 KB
/
Copy patheslint.config.js
File metadata and controls
152 lines (137 loc) · 3.53 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
146
147
148
149
150
151
152
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import reactHooks from "eslint-plugin-react-hooks";
import reactCompiler from "eslint-plugin-react-compiler";
import prettier from "eslint-config-prettier";
export default tseslint.config(
// Base JS recommended rules
js.configs.recommended,
// TypeScript recommended rules
...tseslint.configs.recommended,
// Downgrade new ESLint 10 recommended rules to warnings (ratcheted)
{
rules: {
"no-useless-assignment": "warn",
"preserve-caught-error": "warn",
},
},
// React Hooks configuration
{
files: ["**/*.{tsx,jsx,ts}"],
plugins: {
"react-hooks": reactHooks,
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
// React Hooks rules
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
// TypeScript-specific rules
{
files: ["**/*.{ts,tsx}"],
rules: {
// Allow unused vars prefixed with underscore
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
// Allow explicit any for now (can tighten later)
"@typescript-eslint/no-explicit-any": "warn",
// Allow non-null assertions (common in Electron IPC)
"@typescript-eslint/no-non-null-assertion": "off",
// Allow empty functions (common for cleanup callbacks)
"@typescript-eslint/no-empty-function": "off",
// Prefer const assertions
"@typescript-eslint/prefer-as-const": "error",
},
},
// Electron main process specific rules
{
files: ["electron/**/*.ts"],
rules: {
// Console is allowed in main process
"no-console": "off",
},
},
// Layering rules - prevent architecture violations
{
files: ["src/store/**/*.ts"],
rules: {
// Stores should not import IPC clients directly - use controllers
"no-restricted-imports": [
"warn",
{
paths: [
{
name: "@/clients/terminalClient",
message:
"Store files should not import IPC clients directly. Use controllers to encapsulate IPC calls.",
},
],
patterns: [
{
group: ["@/clients"],
message:
"Store files should not import IPC clients directly. Use controllers to encapsulate IPC calls.",
},
],
},
],
},
},
// React Compiler — surface bailout patterns
{
files: ["**/*.{tsx,jsx,ts}"],
plugins: {
"react-compiler": reactCompiler,
},
rules: {
"react-compiler/react-compiler": "warn",
},
},
// Prevent UI components from importing main-process types
{
files: ["src/components/**/*.{ts,tsx}"],
rules: {
"no-restricted-imports": [
"warn",
{
patterns: [
{
group: ["electron/**", "**/electron/**"],
message: "UI components should not import from electron main process modules.",
},
],
},
],
},
},
// Prettier must be last to override conflicting rules
prettier,
// Global ignores
{
ignores: [
"dist/**",
"dist-electron/**",
"release/**",
"node_modules/**",
"*.config.js",
"*.config.cjs",
"scripts/**",
"build/**",
"public/**",
],
}
);