-
Notifications
You must be signed in to change notification settings - Fork 237
Expand file tree
/
Copy patheslint.config.js
More file actions
198 lines (192 loc) · 6.1 KB
/
Copy patheslint.config.js
File metadata and controls
198 lines (192 loc) · 6.1 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
import js from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import unusedImports from "eslint-plugin-unused-imports";
import reactHooks from "eslint-plugin-react-hooks";
import globals from "globals";
export default [
// The recommended preset has no file scope of its own, so scope it off all of
// electron/ — that main-process tree is historically unlinted. The bridges
// get a focused rule set in the dedicated block at the end of this config;
// every other electron/ file matches no config and stays unlinted as before.
{ ...js.configs.recommended, ignores: ["electron/**"] },
{
ignores: ["node_modules/**", "dist/**", "scripts/**", "public/monaco/**", ".github/**", ".claude/**", "release/**", ".worktrees/**"],
},
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
globals: {
// Browser globals
window: "readonly",
document: "readonly",
navigator: "readonly",
console: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
setInterval: "readonly",
clearInterval: "readonly",
requestAnimationFrame: "readonly",
cancelAnimationFrame: "readonly",
fetch: "readonly",
URL: "readonly",
URLSearchParams: "readonly",
FormData: "readonly",
Blob: "readonly",
File: "readonly",
FileReader: "readonly",
AbortController: "readonly",
AbortSignal: "readonly",
Event: "readonly",
EventTarget: "readonly",
CustomEvent: "readonly",
MouseEvent: "readonly",
KeyboardEvent: "readonly",
DragEvent: "readonly",
ClipboardEvent: "readonly",
HTMLElement: "readonly",
HTMLInputElement: "readonly",
HTMLTextAreaElement: "readonly",
HTMLButtonElement: "readonly",
HTMLDivElement: "readonly",
HTMLFormElement: "readonly",
Element: "readonly",
Node: "readonly",
NodeList: "readonly",
MutationObserver: "readonly",
ResizeObserver: "readonly",
IntersectionObserver: "readonly",
localStorage: "readonly",
sessionStorage: "readonly",
crypto: "readonly",
performance: "readonly",
confirm: "readonly",
alert: "readonly",
prompt: "readonly",
getComputedStyle: "readonly",
atob: "readonly",
btoa: "readonly",
// Node.js globals (for Electron)
process: "readonly",
global: "readonly",
Buffer: "readonly",
__dirname: "readonly",
__filename: "readonly",
module: "readonly",
require: "readonly",
exports: "readonly",
},
},
plugins: {
"@typescript-eslint": tsPlugin,
"unused-imports": unusedImports,
"react-hooks": reactHooks,
},
rules: {
// Disable base rules that conflict with TypeScript
"no-unused-vars": "off",
"no-undef": "off", // TypeScript handles this
// TypeScript unused vars (disabled in favor of unused-imports)
"@typescript-eslint/no-unused-vars": "off",
// Disallow any type
"@typescript-eslint/no-explicit-any": "error",
// Unused imports plugin - this is the main feature you want
"unused-imports/no-unused-imports": "warn",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
// React Hooks rules
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
// Downgrade some rules to warnings (less critical)
"no-empty": "warn",
"no-useless-escape": "warn",
"no-case-declarations": "warn",
},
},
{
files: ["**/*.{ts,tsx}"],
rules: {
"no-restricted-properties": [
"error",
{
object: "window",
property: "netcatty",
message:
"Do not access window.netcatty directly; use netcattyBridge or an application/state backend hook.",
},
],
"no-restricted-globals": ["error", "localStorage", "sessionStorage"],
},
},
{
files: ["infrastructure/services/netcattyBridge.ts"],
rules: {
"no-restricted-properties": "off",
},
},
{
files: ["infrastructure/persistence/localStorageAdapter.ts"],
rules: {
"no-restricted-globals": "off",
},
},
{
files: ["components/**/*.{ts,tsx}"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: [
"../infrastructure/persistence/*",
"../infrastructure/services/*",
"../../infrastructure/persistence/*",
"../../infrastructure/services/*",
],
message:
"Components should not import infrastructure persistence/services; use application/state hooks instead.",
},
],
},
],
},
},
{
// Electron main-process bridges are CommonJS and were historically excluded
// from linting. Lint them for undefined references only — the cheap,
// high-value guard against e.g. a removed variable still referenced
// elsewhere. (The TS config disables no-undef because the type-checker
// already covers it there; these .cjs files have no such safety net.)
files: ["electron/bridges/**/*.cjs"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "commonjs",
globals: globals.node,
},
linterOptions: {
// Only no-undef is enabled here, so pre-existing eslint-disable comments
// for other rules (no-console, no-control-regex, …) would all report as
// "unused". Don't flag them — they stay valid for future rule additions.
reportUnusedDisableDirectives: "off",
},
rules: {
"no-undef": "error",
},
},
];