-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
155 lines (152 loc) · 4.7 KB
/
eslint.config.js
File metadata and controls
155 lines (152 loc) · 4.7 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
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
import { defineConfig } from 'eslint/config'
import tsPrefixer from 'eslint-config-ts-prefixer'
import reactYouMightNotNeedAnEffect from 'eslint-plugin-react-you-might-not-need-an-effect'
import dslint from './packages/eslint-plugin-dslint/dist/index.js'
export default defineConfig([
reactYouMightNotNeedAnEffect.configs.recommended,
{
ignores: [
'.next/**',
'html/**',
'storybook-static/**',
'dist/**',
'out/**',
'build/**',
'next-env.d.ts',
'dist-electron/**',
'public/**',
'.playwright-electron/**',
'.playwright-mcp/**',
'packages/**',
'_trials/**',
],
},
...tsPrefixer,
{
rules: {
'no-console': ['error', { allow: ['warn', 'error'] }],
},
},
// Enforce typed IPC wrappers: raw `ipcMain.handle(...)` is forbidden outside
// the single `typedHandle` implementation. Same goes for raw
// `webContents.send(...)` — use `typedSend` so the payload tracks `IPCEventChannels`.
//
// Why: raw APIs bypass the `IPCChannels` contract and the `IPC_ARG_SCHEMAS`
// Zod runtime validation, which together are how we enforce that any value
// crossing the main/renderer boundary is typed + sanitized.
{
files: ['electron/**/*.ts', 'electron/**/*.tsx'],
ignores: [
'electron/ipc/typedHandle.ts',
'electron/ipc/typedInvoke.ts',
'electron/ipc/typedSend.ts',
'electron/auth-manager.ts', // Dead code — see comment at top of file
'electron/__tests__/**',
],
rules: {
'no-restricted-syntax': [
'error',
{
selector:
"CallExpression[callee.object.name='ipcMain'][callee.property.name='handle']",
message:
'Use typedHandle from electron/ipc/typedHandle.ts instead of raw ipcMain.handle — raw handlers bypass IPCChannels contract + Zod validation.',
},
{
selector:
"CallExpression[callee.object.name='ipcRenderer'][callee.property.name='invoke']",
message:
'Use typedInvoke from electron/ipc/typedInvoke.ts instead of raw ipcRenderer.invoke — raw invokes bypass IPCChannels contract.',
},
{
selector:
"CallExpression[callee.property.name='send'][callee.object.property.name='webContents']",
message:
'Use typedSend from electron/ipc/typedSend.ts instead of raw webContents.send — raw sends bypass IPCEventChannels contract.',
},
],
},
},
// Design System Lint - デザイントークン準拠を強制
{
plugins: { dslint },
rules: {
'dslint/token-only': [
'warn',
{
tokenSource: './tailwind.config.ts',
ignore: [
// Tailwind modifiers & pseudo-classes
'animate-*',
'group',
'group-*',
'peer',
'peer-*',
'data-*',
'container',
// Typography
'antialiased',
'subpixel-antialiased',
// Basic colors
'text-white',
'text-black',
'bg-white',
'bg-black',
'border-white',
'border-black',
'text-transparent',
'bg-transparent',
// Gradients
'from-*',
'via-*',
'to-*',
'bg-linear-*',
'bg-gradient-*',
// Electron window controls
'window-drag-region',
'no-drag',
'drag-handle',
// Custom animation CSS classes (defined in animations.css)
'achievement-*',
'level-up-*',
'confetti-*',
'floating-navigator-*',
// Tailwind default color palette (temporary - will migrate to tokens)
'text-red-*',
'text-blue-*',
'text-gray-*',
'text-green-*',
'text-yellow-*',
'bg-red-*',
'bg-blue-*',
'bg-gray-*',
'bg-green-*',
'bg-yellow-*',
'border-red-*',
'border-blue-*',
'border-gray-*',
'border-green-*',
'border-t-*',
'border-r-*',
'border-b-*',
'border-l-*',
// Custom size utilities
'h-100',
// Test file patterns
'custom-*',
],
},
],
},
// shadcn/ui, Storybook, packages, tests は除外
ignores: [
'src/components/ui/**',
'**/*.stories.tsx',
'**/*.stories.ts',
'packages/**',
'**/*.test.ts',
'**/*.test.tsx',
],
},
])