-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy patheslint.config.js
More file actions
117 lines (103 loc) · 3.01 KB
/
eslint.config.js
File metadata and controls
117 lines (103 loc) · 3.01 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import solid from 'eslint-plugin-solid/configs/typescript';
import * as tsParser from '@typescript-eslint/parser';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
export default [
// Ignore build output
{
ignores: [
'dist/**',
'dist-electron/**',
'dist-remote/**',
'release/**',
'node_modules/**',
'.worktrees/**',
'.claude/**',
// Build config is excluded from electron tsconfig; ignore the config and its test.
'electron/vite.config.electron.ts',
'electron/vite.config.electron.test.ts',
],
},
// Base JS recommended rules
js.configs.recommended,
// TypeScript strict rules (non-type-checked to avoid perf cost in CI)
...tseslint.configs.strict,
// SolidJS-specific rules for TSX files
{
files: ['src/**/*.{ts,tsx}'],
...solid,
languageOptions: {
parser: tsParser,
parserOptions: {
project: './tsconfig.json',
},
},
},
// Electron backend files use Node tsconfig
{
files: ['electron/**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
project: './electron/tsconfig.json',
},
},
},
// Custom strict rules
{
files: ['**/*.{ts,tsx}'],
rules: {
// Prevent `any` — use `unknown` instead
'@typescript-eslint/no-explicit-any': 'error',
// Require explicit return types on exported functions
'@typescript-eslint/explicit-module-boundary-types': 'off',
// No unused variables (underscore prefix allowed for intentional skips)
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
// Consistency
'prefer-const': 'error',
'no-var': 'error',
eqeqeq: ['error', 'always'],
curly: ['error', 'multi-line'],
// No console.log (allow warn/error for legitimate error reporting)
'no-console': ['warn', { allow: ['warn', 'error'] }],
// Prevent non-null assertions (prefer explicit checks)
'@typescript-eslint/no-non-null-assertion': 'warn',
},
},
// SolidJS store files use `produce()` which provides a mutable draft where
// `delete` on dynamic keys is the intended API for removing store entries.
{
files: ['src/store/**/*.ts'],
rules: {
'@typescript-eslint/no-dynamic-delete': 'off',
},
},
// CJS files (electron/preload.cjs): allow require(), CommonJS globals
{
files: ['**/*.cjs'],
languageOptions: {
sourceType: 'commonjs',
globals: {
require: 'readonly',
module: 'readonly',
exports: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
process: 'readonly',
},
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
// Disable rules that conflict with Prettier (must be last)
eslintConfigPrettier,
];