forked from wormhole-foundation/wormhole-connect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
119 lines (109 loc) · 3.01 KB
/
eslint.config.mjs
File metadata and controls
119 lines (109 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
118
119
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';
import globals from 'globals';
export default [
// Global ignores (replaces .eslintignore)
{
ignores: [
'node_modules/**',
'dist/**',
'lib/**',
'coverage/**',
'*.config.js',
'*.config.mjs',
'*.config.ts',
'scripts/**/*.js',
'public/**',
],
},
// Apply to all JS/TS files
{
files: ['**/*.{js,jsx,ts,tsx,mjs,cjs}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
},
// Recommended configs
js.configs.recommended,
...tseslint.configs.recommended,
reactPlugin.configs.flat.recommended,
// React hooks plugin
{
plugins: {
'react-hooks': reactHooksPlugin,
},
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
},
// General rules for all files
{
rules: {
// Original rules from .eslintrc.json
'comma-dangle': ['error', 'always-multiline'],
semi: ['error', 'always'],
// Disable rules that TypeScript handles
'no-undef': 'off', // TypeScript handles this
'no-unused-vars': 'off', // Use @typescript-eslint/no-unused-vars instead
'no-constant-condition': 'off',
'no-redeclare': 'off',
// React rules
'react/prop-types': 'off', // We use TypeScript for type checking
'react/no-unescaped-entities': 'off', // Allow quotes in JSX
'react/display-name': 'off', // Not critical for our use case
},
},
// TypeScript-specific rules
{
files: ['**/*.{ts,tsx}'],
rules: {
// TypeScript rules
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'none',
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
disallowTypeAnnotations: false,
},
],
},
},
// Strict rules for hooks directory
{
files: ['src/hooks/**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': ['error'],
'@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }],
'@typescript-eslint/no-non-null-assertion': ['error'],
'react-hooks/exhaustive-deps': ['error'],
},
},
// Prettier config to disable conflicting rules (must be last)
prettierConfig,
];