-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
166 lines (149 loc) · 3.83 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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import js from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
// Ignore configuration
const ignoreConfig = {
ignores: [
// Build outputs and dependencies
'.next',
'.next/**/*',
'lib',
'lib/**/*',
'out',
'out/**/*',
'dist',
'dist/**/*',
'build',
'build/**/*',
'node_modules',
'node_modules/**/*',
'coverage',
'coverage/**/*',
// Tool and config directories
'.husky',
'.husky/**/*',
'.vercel',
'.vercel/**/*',
'.demo',
'.demo/**/*',
'.renderer',
'.renderer/**/*',
// Generated and minified files
'**/*.min.js',
'**/*.bundle.js',
'**/*.generated.*',
'**/*.d.ts'
]
}
// Files to lint
const filesConfig = {
files: ['**/*.{js,jsx,ts,tsx}']
}
export default tseslint.config(
ignoreConfig,
filesConfig,
js.configs.recommended,
...tseslint.configs.recommended,
{
languageOptions: {
globals: {
// Browser globals
...globals.browser,
self: true,
window: true,
document: true,
localStorage: true,
sessionStorage: true,
// Node.js globals
...globals.node,
__dirname: true,
__filename: true,
process: true,
Buffer: true,
// Next.js specific globals
_N_E: true,
// Common web APIs
URL: true,
URLSearchParams: true,
FormData: true,
FileReader: true,
Blob: true,
TextEncoder: true,
TextDecoder: true,
fetch: true,
XMLHttpRequest: true,
// Timing functions
setTimeout: true,
clearTimeout: true,
setInterval: true,
clearInterval: true,
requestAnimationFrame: true,
cancelAnimationFrame: true,
// Console and debugging
console: true,
// Webpack specific
__webpack_exports__: true,
__webpack_require__: true,
__unused_webpack_module: true,
// Runtime environments
Bun: true,
Deno: true,
// Common variables
module: true,
exports: true,
require: true,
// TypeScript helpers
t: true,
e: true
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true
}
}
},
rules: {
// TypeScript-specific rules
'@typescript-eslint/no-unused-vars': [
'warn',
{
varsIgnorePattern: '^_|^(module|__webpack_.*|t|e)$',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
caughtErrors: 'none'
}
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-require-imports': 'off',
// Disable rules that TypeScript handles
'no-unused-vars': 'off',
'no-undef': 'off',
'no-redeclare': 'off',
// Next.js and React specific rules
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/display-name': 'off',
'react/no-unescaped-entities': 'off',
// General rules
'no-prototype-builtins': 'off',
'no-fallthrough': 'warn',
'no-empty': 'warn',
'no-sparse-arrays': 'warn',
'no-cond-assign': ['error', 'except-parens'],
'no-control-regex': 'off',
'no-self-assign': 'off',
'prefer-const': 'warn',
'no-var': 'warn',
eqeqeq: ['warn', 'smart'],
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}
}
)