-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
105 lines (102 loc) · 2.73 KB
/
eslint.config.js
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
import eslint from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import unusedImports from 'eslint-plugin-unused-imports';
import importPlugin from 'eslint-plugin-import';
export default [
eslint.configs.recommended,
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
// Browser globals
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
localStorage: 'readonly',
console: 'readonly',
// Test globals
HTMLSelectElement: 'readonly',
Response: 'readonly',
addEventListener: 'readonly',
},
},
plugins: {
'@typescript-eslint': tseslint,
react: reactPlugin,
'react-hooks': reactHooksPlugin,
'unused-imports': unusedImports,
import: importPlugin,
},
rules: {
// TypeScript specific rules
'@typescript-eslint/no-unused-vars': 'off', // Turned off in favor of unused-imports
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
// React rules
'react/react-in-jsx-scope': 'off', // Not needed in modern React
'react/prop-types': 'off', // We use TypeScript for prop validation
'react/jsx-uses-react': 'off',
'react/jsx-uses-vars': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// Import and unused imports rules
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
['parent', 'sibling'],
'index',
'object',
'type',
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
settings: {
react: {
version: 'detect',
},
},
},
{
ignores: [
'node_modules/',
'dist/',
'.astro/',
'coverage/',
'*.config.js',
'*.config.ts',
'compute-js/',
],
},
];