forked from connorgallopo/Tracearr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
124 lines (123 loc) · 4.55 KB
/
eslint.config.js
File metadata and controls
124 lines (123 loc) · 4.55 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import prettierConfig from 'eslint-config-prettier';
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
prettierConfig,
{
ignores: [
'**/dist/**',
'**/node_modules/**',
'**/.turbo/**',
'**/coverage/**',
'apps/mobile/plugins/**',
'apps/mobile/.expo/**',
'apps/mobile/**.config.js',
'apps/mobile/**.config.mjs',
],
},
{
languageOptions: {
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
],
'@typescript-eslint/no-misused-promises': [
'error',
{ checksVoidReturn: { attributes: false } },
],
'@typescript-eslint/require-await': 'off',
// Disable overly pedantic rules
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/prefer-regexp-exec': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/no-unnecessary-type-conversion': 'off',
// Warn instead of error for unsafe rules (too many to fix at once)
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
// Stylistic rules that are too noisy
'@typescript-eslint/return-await': 'warn',
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'warn',
'@typescript-eslint/no-unnecessary-type-parameters': 'warn',
'@typescript-eslint/no-confusing-void-expression': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
},
},
{
files: ['**/*.tsx', '**/*.jsx'],
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/no-unescaped-entities': 'off',
'react-hooks/set-state-in-effect': 'off',
// Disable React Compiler rules (new in v7) until codebase is ready
'react-hooks/react-compiler': 'off',
'react-hooks/refs': 'off',
'react-hooks/preserve-manual-memoization': 'off',
'react-hooks/static-components': 'off',
'react-hooks/purity': 'off',
},
},
{
files: [
'**/*.test.ts',
'**/*.test.tsx',
'**/test/**/*.ts',
'**/__tests__/**/*.ts',
'packages/test-utils/**/*.ts',
],
rules: {
// Unbound method warnings in tests are false positives when passing to mock callbacks
'@typescript-eslint/unbound-method': 'off',
// Non-null assertions are practical in tests where setup guarantees values exist
'@typescript-eslint/no-non-null-assertion': 'off',
// Mocking libraries return `any` types - fighting this provides little value in tests
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
// Sometimes needed for dynamic test data or complex mocks
'@typescript-eslint/no-explicit-any': 'off',
// Generic type parameter precision is less important in test utilities
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
},
}
);