-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
191 lines (183 loc) · 5.81 KB
/
Copy patheslint.config.js
File metadata and controls
191 lines (183 loc) · 5.81 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
// ESLint flat config (ESLint 10 + typescript-eslint 8).
//
// Type-aware rules run against tsconfig.eslint.json rather than
// parserOptions.projectService: projectService only discovers files that some
// tsconfig.json *includes*, and tsconfig.json (the build config, also used
// verbatim by scripts/build-release.sh) excludes every *.test.ts. The
// projectService escape hatch (allowDefaultProject) is capped at a handful of
// files and forbids `**` globs, so it cannot carry 190+ test files.
import js from "@eslint/js";
import { defineConfig, globalIgnores } from "eslint/config";
import globals from "globals";
import tseslint from "typescript-eslint";
// ── Baseline ────────────────────────────────────────────────────────────
// Pre-existing violations in files that other work streams are editing right
// now (T-4 review, 2026-09). Each entry downgrades ONE rule to `warn` for the
// files that still violate it, so `npm run lint` is error-free today without
// a cross-stream refactor. Shrink this list as files are cleaned up; do not
// add to it — new code must pass the rules at `error`.
const baseline = [
{
rule: "no-console",
files: [
"src/billing/iap.ts",
"src/billing/limits.ts",
"src/billing/media-meter.ts",
"src/billing/stripe.ts",
"src/channels/discord.ts",
"src/channels/feishu.ts",
"src/channels/imessage.ts",
"src/channels/router.ts",
"src/channels/slack.ts",
"src/channels/telegram.ts",
"src/channels/webhook.ts",
"src/cloud/turn-lease.ts",
"src/heartbeat/runner.ts",
"src/idle/runner.ts",
"src/integrations/claude-code/observer.ts",
"src/kb/feeds/classify.ts",
"src/kb/feeds/service.ts",
"src/kb/feeds/store.ts",
"src/providers/fallback.ts",
"src/reflect.ts",
"src/sandbox/sandbox.ts",
"src/soul/git.ts",
"src/web/accounts.ts",
],
},
{
rule: "no-empty",
files: ["src/autostart/install.ts", "src/cli.ts", "src/web/server.ts"],
},
{
rule: "no-useless-assignment",
files: ["src/integrations/claude-code/watcher.ts", "src/soul/birth.ts", "src/web/server.ts"],
},
{
rule: "no-useless-escape",
files: ["src/web/lisa-client.ts"],
},
{
rule: "prefer-const",
files: ["src/billing/quota.test.ts", "src/web/server.ts"],
},
{
rule: "@typescript-eslint/no-explicit-any",
files: [
"src/integrations/takoapi/a2a.ts",
"src/tools/github.ts",
"src/tools/mcp.test.ts",
"src/tools/npm_info.ts",
"src/tools/takoapi.ts",
],
},
{
rule: "@typescript-eslint/no-misused-promises",
files: ["src/cli.ts", "src/cli/repl.ts", "src/web/server.ts"],
},
{
rule: "@typescript-eslint/no-unnecessary-type-assertion",
files: [
"src/billing/meter.test.ts",
"src/billing/quota.ts",
"src/cli.ts",
"src/cli/account.ts",
"src/cli/sense.ts",
"src/integrations/claude-code/parser-steps.test.ts",
"src/integrations/claude-code/parser.ts",
"src/web/server.ts",
],
},
];
export default defineConfig([
globalIgnores([
"dist/**",
"dist-release/**",
"node_modules/**",
"coverage/**",
"website/**",
"research/**",
"packaging/**",
"deploy/**",
"docs/**",
"src/web/assets/**",
"**/*.generated.ts",
"playwright-report/**",
"test-results/**",
".claude/**",
]),
js.configs.recommended,
// Plain-JS tooling (scripts/*.mjs, this file) — Node globals, no type info.
{
files: ["**/*.{js,mjs,cjs}"],
languageOptions: { globals: globals.node },
},
// TypeScript: recommended + the type-aware rules that matter.
{
files: ["**/*.ts"],
extends: [tseslint.configs.recommended],
languageOptions: {
parserOptions: {
project: "./tsconfig.eslint.json",
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/no-floating-promises": [
"error",
{
// node:test's test()/describe()/hooks return promises that the runner
// itself tracks; awaiting them at top level would be wrong.
allowForKnownSafeCalls: [
{
from: "package",
package: "node:test",
name: [
"test",
"describe",
"it",
"suite",
"before",
"after",
"beforeEach",
"afterEach",
],
},
],
},
],
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
// `_`-prefixed names are the house convention for deliberately unused
// parameters and rest-destructuring discards.
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "after-used",
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
},
// House rules (all files).
{
rules: {
"no-empty": ["error", { allowEmptyCatch: false }],
"no-console": "error",
// `== null` / `!= null` is the idiomatic "null or undefined" check here.
eqeqeq: ["error", "always", { null: "ignore" }],
"prefer-const": "error",
},
},
// Surfaces whose job is to print: the CLI, the logger, dev scripts, tests.
{
files: ["src/cli.ts", "src/cli/**", "src/log.ts", "scripts/**", "**/*.test.ts", "tests/**"],
rules: { "no-console": "off" },
},
...baseline.map(({ rule, files }) => ({ files, rules: { [rule]: "warn" } })),
]);