-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
144 lines (143 loc) · 4.37 KB
/
Copy patheslint.config.js
File metadata and controls
144 lines (143 loc) · 4.37 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import reactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
plugins: { 'react-hooks': reactHooks },
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'warn',
'no-console': ['warn', { allow: ['warn', 'error'] }],
},
},
// CLI needs console.log
{
files: ['cli/src/**/*.ts'],
rules: {
'no-console': 'off',
},
},
// Relax rules for test files
{
files: ['**/*.test.ts', '**/test-helpers.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'no-console': 'off',
},
},
// Guard: ban direct 'tmux' invocations in server source — use execTmux()/tmuxSpawnSpec() instead.
{
files: ['server/**/*.ts'],
ignores: ['server/**/*.test.ts', 'server/tmux-bin.ts', 'server/test-helpers.ts'],
rules: {
'no-restricted-syntax': [
'error',
{
selector:
"CallExpression[callee.name=/^(execFile|execFileSync|spawn)$/] Literal[value='tmux']",
message:
"Do not invoke 'tmux' directly — use execTmux()/tmuxSpawnSpec() from server/tmux-bin.ts.",
},
],
},
},
// Guard: ban direct DB access (getDb()/.prepare()) outside the repository layer.
{
files: ['server/**/*.ts'],
ignores: [
'server/**/*.test.ts',
'server/tmux-bin.ts',
'server/test-helpers.ts',
'server/db.ts',
'server/db/**',
'server/repositories/**',
// The orchestrator's OWN repository for its owned tables (orchestrator_*,
// action_cards, managed_tasks, conversation_usage, permission_rules, events).
// All other orchestrator modules go through repositories/ + store.ts (SHR-179).
'server/orchestrator/store.ts',
'server/integrations/**',
],
rules: {
'no-restricted-syntax': [
'error',
{
selector:
"CallExpression[callee.name=/^(execFile|execFileSync|spawn)$/] Literal[value='tmux']",
message:
"Do not invoke 'tmux' directly — use execTmux()/tmuxSpawnSpec() from server/tmux-bin.ts.",
},
{
selector: "CallExpression[callee.name='getDb']",
message:
'Do not call getDb() outside the repository layer (server/repositories/). Add or use a repository function instead.',
},
{
selector: "CallExpression[callee.property.name='prepare']",
message:
'Do not call .prepare() outside the repository layer (server/repositories/). Add or use a repository function instead.',
},
],
},
},
// Guard: ban express imports in the service layer — services must stay HTTP-agnostic.
{
files: ['server/services/**/*.ts'],
ignores: ['server/services/**/*.test.ts'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'express',
message: 'Services must not import express — keep them HTTP-agnostic.',
},
],
},
],
},
},
{
ignores: [
'dist/',
'dist-server/',
'cli/dist/',
'node_modules/',
'data/',
'coverage/',
'.worktrees/',
'.claude/',
// Workflow scripts run in the Workflow runtime with injected globals
// (agent/parallel/pipeline/phase/log/args/budget) — not lintable as app code.
'workflows/',
'.local/',
'.config/',
'.remember/',
'*.config.js',
'*.config.ts',
// Per-platform tmux packages are pure CJS modules published separately.
'packages/',
// electron/ has its own tsconfig and uses Electron types not in the main project.
'electron/',
'dist-electron/',
// .cjs files are intentional CommonJS (build/electron hooks) — the ESM
// TS rules (e.g. no-require-imports) don't apply to them.
'**/*.cjs',
],
},
);