-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
146 lines (138 loc) · 4.41 KB
/
eslint.config.js
File metadata and controls
146 lines (138 loc) · 4.41 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
export default tseslint.config(
// Ignore patterns
{
ignores: [
'dist/**',
'node_modules/**',
'*.config.js',
'*.config.ts',
'scripts/**',
],
},
// Base JavaScript rules
js.configs.recommended,
// TypeScript rules
...tseslint.configs.recommended,
// Main configuration for source files
{
files: ['src/**/*.{ts,tsx}'],
plugins: {
react,
'react-hooks': reactHooks,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
globals: {
...globals.browser,
...globals.es2021,
chrome: 'readonly',
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
// ============================================
// TypeScript Rules
// ============================================
'@typescript-eslint/no-unused-vars': ['error', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_|^error$|^e$',
}],
'@typescript-eslint/no-explicit-any': 'off', // Allow any for API responses and dynamic data
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off', // Allow non-null assertions for known values
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': ['warn', {
'ts-expect-error': 'allow-with-description',
'ts-ignore': false,
'ts-nocheck': false,
}],
'@typescript-eslint/no-empty-interface': 'off',
// ============================================
// React Rules
// ============================================
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/jsx-uses-react': 'off',
'react/jsx-uses-vars': 'error',
'react/jsx-key': 'error',
'react/jsx-no-duplicate-props': 'error',
'react/jsx-no-undef': 'error',
'react/no-children-prop': 'error',
'react/no-danger-with-children': 'error',
'react/no-deprecated': 'warn',
'react/no-direct-mutation-state': 'error',
'react/no-unescaped-entities': 'off', // Too many false positives
'react/self-closing-comp': 'warn',
// ============================================
// React Hooks Rules
// ============================================
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// ============================================
// General JavaScript/Best Practices
// ============================================
'no-console': 'off', // Extension uses console for logging
'no-debugger': 'error',
'no-unused-vars': 'off',
'prefer-const': 'error',
'no-var': 'error',
'eqeqeq': ['error', 'always', { null: 'ignore' }],
'curly': ['error', 'multi-line'],
'no-duplicate-imports': 'error',
'no-case-declarations': 'off',
'no-useless-escape': 'warn',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-constant-condition': ['error', { checkLoops: false }],
'no-template-curly-in-string': 'warn',
'no-unreachable': 'error',
'no-unsafe-finally': 'error',
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
'no-return-await': 'warn',
'no-throw-literal': 'error',
'prefer-promise-reject-errors': 'error',
'no-async-promise-executor': 'error',
},
},
// Test files configuration - more relaxed
{
files: ['tests/**/*.{ts,tsx}'],
languageOptions: {
globals: {
...globals.node,
describe: 'readonly',
it: 'readonly',
expect: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
vi: 'readonly',
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'no-console': 'off',
},
}
);