-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
47 lines (44 loc) · 1.47 KB
/
Copy patheslint.config.js
File metadata and controls
47 lines (44 loc) · 1.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
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import reactHooks from 'eslint-plugin-react-hooks'
const browserGlobals = {
window: 'readonly', document: 'readonly', navigator: 'readonly',
console: 'readonly', fetch: 'readonly', TextDecoder: 'readonly',
localStorage: 'readonly', sessionStorage: 'readonly',
setTimeout: 'readonly', clearTimeout: 'readonly',
setInterval: 'readonly', clearInterval: 'readonly',
ReadableStream: 'readonly', TextEncoder: 'readonly',
URL: 'readonly', URLSearchParams: 'readonly',
}
const vitestGlobals = {
describe: 'readonly', it: 'readonly', test: 'readonly',
expect: 'readonly', vi: 'readonly', beforeEach: 'readonly',
afterEach: 'readonly', beforeAll: 'readonly', afterAll: 'readonly',
global: 'writable',
}
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ['src/**/*.{ts,tsx}'],
plugins: { 'react-hooks': reactHooks },
languageOptions: {
globals: browserGlobals,
parserOptions: { ecmaFeatures: { jsx: true } },
},
rules: {
...reactHooks.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^React$', argsIgnorePattern: '^_' }],
'no-empty': ['error', { allowEmptyCatch: true }],
},
},
{
files: ['src/**/*.test.{ts,tsx}'],
languageOptions: {
globals: { ...browserGlobals, ...vitestGlobals },
},
},
{
ignores: ['dist/**', 'node_modules/**'],
},
)