-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
156 lines (155 loc) · 4.47 KB
/
Copy patheslint.config.js
File metadata and controls
156 lines (155 loc) · 4.47 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
147
148
149
150
151
152
153
154
155
156
import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
export default [
{
ignores: [
'dist/**',
'node_modules/**',
'coverage/**',
'*.config.ts',
'*.config.js',
'omnigrid_server',
],
},
js.configs.recommended,
// Scripts run in Node; do not redeclare built-in globals (causes no-redeclare errors in CI).
{
files: ['scripts/**/*.mjs', 'scripts/**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
// Only non-default / project-specific if needed — process/console are built-ins in Node.
__dirname: 'readonly',
__filename: 'readonly',
module: 'readonly',
require: 'readonly',
exports: 'readonly',
Buffer: 'readonly',
},
},
rules: {
'no-undef': 'off',
'no-redeclare': 'off',
},
},
{
files: ['public/sw.js'],
languageOptions: {
globals: {
self: 'readonly',
caches: 'readonly',
fetch: 'readonly',
Response: 'readonly',
URL: 'readonly',
},
},
},
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
console: 'readonly',
process: 'readonly',
__dirname: 'readonly',
module: 'readonly',
require: 'readonly',
exports: 'readonly',
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
fetch: 'readonly',
Response: 'readonly',
URL: 'readonly',
Blob: 'readonly',
File: 'readonly',
FileList: 'readonly',
FileReader: 'readonly',
HTMLInputElement: 'readonly',
HTMLCanvasElement: 'readonly',
HTMLDivElement: 'readonly',
HTMLSelectElement: 'readonly',
HTMLAudioElement: 'readonly',
HTMLTextAreaElement: 'readonly',
CanvasRenderingContext2D: 'readonly',
Element: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
requestAnimationFrame: 'readonly',
cancelAnimationFrame: 'readonly',
alert: 'readonly',
confirm: 'readonly',
prompt: 'readonly',
KeyboardEvent: 'readonly',
MouseEvent: 'readonly',
Event: 'readonly',
crypto: 'readonly',
btoa: 'readonly',
atob: 'readonly',
TextEncoder: 'readonly',
TextDecoder: 'readonly',
AudioContext: 'readonly',
AudioNode: 'readonly',
AudioBufferSourceNode: 'readonly',
GainNode: 'readonly',
OscillatorNode: 'readonly',
AnalyserNode: 'readonly',
MediaStreamAudioSourceNode: 'readonly',
localStorage: 'readonly',
CryptoKey: 'readonly',
ResizeObserver: 'readonly',
globalThis: 'readonly',
},
},
plugins: {
'@typescript-eslint': typescript,
react,
'react-hooks': reactHooks,
},
rules: {
...typescript.configs.recommended.rules,
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'no-undef': 'off',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
// Keep as warn so existing intentional `any` does not fail CI; tighten over time.
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'no-console': ['warn', { allow: ['warn', 'error'] }],
// Disable React Compiler specific rules that conflict with manual memoization
'react-hooks/preserve-manual-memoization': 'off',
'react-hooks/unsupported-syntax': 'off',
'react-compiler/react-compiler': 'off',
// Downgrade purity rule: it incorrectly flags Date.now() in event handlers
'react-hooks/purity': 'warn',
// Missing deps in large containers — warn, do not fail CI
'react-hooks/exhaustive-deps': 'warn',
},
settings: {
react: {
version: 'detect',
},
},
},
];