-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
87 lines (86 loc) · 3.15 KB
/
eslint.config.js
File metadata and controls
87 lines (86 loc) · 3.15 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
import eslint from '@eslint/js';
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
export default defineConfig(
{
ignores: [
'**/node_modules/**',
'**/.venv/**',
'**/*.d.ts',
'**/dist/**',
'**/build/**',
'classifier/**',
'eslint.config.js',
],
},
eslint.configs.recommended,
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
globals: {
Bun: 'readonly',
},
},
},
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
files: ['**/*.ts'],
rules: {
'@typescript-eslint/explicit-function-return-type': [
'warn',
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowDirectConstAssertionInArrowFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
},
],
'@typescript-eslint/no-explicit-any': 'error',
// Prefer type for object shapes; interface is stylistic
'@typescript-eslint/consistent-type-definitions': 'off',
// Allow intentional empty callbacks (e.g. event handlers)
'@typescript-eslint/no-empty-function': [
'error',
{ allow: ['arrowFunctions', 'methods'] },
],
// Unused params: allow prefix with underscore
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
// Allow number/boolean in template literals (common and safe when coerced)
'@typescript-eslint/restrict-template-expressions': [
'error',
{ allowNumber: true, allowBoolean: true },
],
// Stylistic / refactor-heavy rules as warnings so lint exits 0; Cursor still shows them
'@typescript-eslint/no-unnecessary-condition': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
'@typescript-eslint/no-confusing-void-expression': 'warn',
'no-useless-assignment': 'warn',
'@typescript-eslint/no-unnecessary-type-conversion': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
// Require type info from deps to fix; warn so lint passes and Cursor shows them
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
},
}
);